Patched to 2.6.10-1.14_FC2.
[linux-2.6.git] / fs / binfmt_elf.c
index 42de9c8..55235a6 100644 (file)
@@ -776,7 +776,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
         * Turn off the CS limit completely if exec-shield disabled or
         * NX active:
         */
-       if (!exec_shield || executable_stack != EXSTACK_DISABLE_X)
+       if (!exec_shield || executable_stack != EXSTACK_DISABLE_X || nx_enabled)
                arch_add_exec_range(current->mm, -1);
 #endif
 
@@ -798,7 +798,8 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        /* Do this immediately, since STACK_TOP as used in setup_arg_pages
           may depend on the personality.  */
        SET_PERSONALITY(loc->elf_ex, ibcs2_interpreter);
-       if (elf_read_implies_exec(loc->elf_ex, have_pt_gnu_stack))
+       if (exec_shield != 2 &&
+                       elf_read_implies_exec(loc->elf_ex, have_pt_gnu_stack))
                current->personality |= READ_IMPLIES_EXEC;
 
        arch_pick_mmap_layout(current->mm);