diff options
author | dchagin <dchagin@FreeBSD.org> | 2014-06-17 05:21:48 +0000 |
---|---|---|
committer | dchagin <dchagin@FreeBSD.org> | 2014-06-17 05:21:48 +0000 |
commit | 4fc656028601c789cff990c31467dfbad11e4241 (patch) | |
tree | 0123a2eeea4b11a43b292dd772b9d165cb1fd66a /sys/kern/imgact_elf.c | |
parent | e3bd23da81912e3b08d4e9709b65dcf85b19c67f (diff) | |
download | FreeBSD-src-4fc656028601c789cff990c31467dfbad11e4241.zip FreeBSD-src-4fc656028601c789cff990c31467dfbad11e4241.tar.gz |
Revert MFC r266925 because it can lead to instant panic at fexecve():
To allow to run interpreter itself add a new ELF branding type.
Pointed out by: kib, mjg
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r-- | sys/kern/imgact_elf.c | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index a9659a1..8783670 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -261,8 +261,6 @@ __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, { const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header; Elf_Brandinfo *bi; - const char *fname_name, *interp_brand_name; - int fname_len, interp_len; boolean_t ret; int i; @@ -313,33 +311,6 @@ __elfN(get_brandinfo)(struct image_params *imgp, const char *interp, } } - /* Some ABI allows to run the interpreter itself. */ - for (i = 0; i < MAX_BRANDS; i++) { - bi = elf_brand_list[i]; - if (bi == NULL || bi->flags & BI_BRAND_NOTE_MANDATORY) - continue; - if (hdr->e_machine != bi->machine || - (bi->flags & BI_CAN_EXEC_INTERP) == 0) - continue; - /* - * Compare the interpreter name not the path to allow run it - * from everywhere. - */ - interp_brand_name = strrchr(bi->interp_path, '/'); - if (interp_brand_name == NULL) - interp_brand_name = bi->interp_path; - interp_len = strlen(interp_brand_name); - fname_name = strrchr(imgp->args->fname, '/'); - if (fname_name == NULL) - fname_name = imgp->args->fname; - fname_len = strlen(fname_name); - if (fname_len < interp_len) - continue; - ret = strncmp(fname_name, interp_brand_name, interp_len); - if (ret == 0) - return (bi); - } - /* Lacking a recognized interpreter, try the default brand */ for (i = 0; i < MAX_BRANDS; i++) { bi = elf_brand_list[i]; |