X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fbinfmt_elf.c;h=785da46c866a1b9f9b2dc70106644b945f604103;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=38130a27653631ab94972e03125a918ebe7c038b;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 38130a276..785da46c8 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -37,10 +37,10 @@ #include #include #include +#include #include #include -#include #include @@ -202,7 +202,10 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, NEW_AUX_ENT(AT_EGID, (elf_addr_t) tsk->egid); NEW_AUX_ENT(AT_SECURE, (elf_addr_t) security_bprm_secureexec(bprm)); if (k_platform) { - NEW_AUX_ENT(AT_PLATFORM, (elf_addr_t)(long)u_platform); + NEW_AUX_ENT(AT_PLATFORM, (elf_addr_t)(unsigned long)u_platform); + } + if (bprm->interp_flags & BINPRM_FLAGS_EXECFD) { + NEW_AUX_ENT(AT_EXECFD, (elf_addr_t) bprm->interp_data); } #undef NEW_AUX_ENT /* AT_NULL is zero; clear the rest too */ @@ -235,8 +238,8 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec, if (interp_aout) { argv = sp + 2; envp = argv + argc + 1; - __put_user((elf_addr_t)(long)argv, sp++); - __put_user((elf_addr_t)(long)envp, sp++); + __put_user((elf_addr_t)(unsigned long)argv, sp++); + __put_user((elf_addr_t)(unsigned long)envp, sp++); } else { argv = sp; envp = argv + argc + 1; @@ -490,7 +493,8 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) struct exec interp_ex; char passed_fileno[6]; struct files_struct *files; - int executable_stack = EXSTACK_DEFAULT; + int have_pt_gnu_stack, executable_stack = EXSTACK_DEFAULT; + unsigned long def_flags = 0; /* Get the exec-header */ elf_ex = *((struct elfhdr *) bprm->buf); @@ -622,7 +626,9 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) executable_stack = EXSTACK_ENABLE_X; else executable_stack = EXSTACK_DISABLE_X; + break; } + have_pt_gnu_stack = (i < elf_ex.e_phnum); /* Some simple consistency checks for the interpreter */ if (elf_interpreter) { @@ -690,10 +696,13 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) current->mm->end_code = 0; current->mm->mmap = NULL; current->flags &= ~PF_FORKNOEXEC; + current->mm->def_flags = def_flags; /* Do this immediately, since STACK_TOP as used in setup_arg_pages may depend on the personality. */ SET_PERSONALITY(elf_ex, ibcs2_interpreter); + if (elf_read_implies_exec(elf_ex, have_pt_gnu_stack)) + current->personality |= READ_IMPLIES_EXEC; /* Do this so that we can load the interpreter, if need be. We will change some of these later */