path: root/fs
diff options
authorIngo Molnar <mingo@elte.hu>2010-07-14 00:50:02 -0700
committerJohn Rigby <john.rigby@linaro.org>2011-11-16 14:24:34 -0700
commit4c1f0b6a6487f7d3fb534598a4d74bfc70faf17d (patch)
tree9a5d56cf052cb0d3953a7fa39ee937cb70f3e98a /fs
parent3cd25dfc627b72b95ee349f14b815c3636d82738 (diff)
UBUNTU: ubuntu: nx-emu - i386: NX emulation
This is old code with some cruft, all originally by Ingo Molnar with much later rebasing by Fedora folks and at least one arcane fix by Roland McGrath a few years ago. No longer uses exec-shield sysctl, merged with disable_nx. Kees Cook fixed boottime NX reporting for various corner cases. Signed-off-by: Kees Cook <kees.cook@canonical.com> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Diffstat (limited to 'fs')
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 21ac5ee4b43..3f269630d81 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -711,6 +711,15 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
if (retval)
goto out_free_dentry;
+#ifdef CONFIG_X86_32
+ /*
+ * Turn off the CS limit completely if exec-shield disabled or
+ * NX active:
+ */
+ if (disable_nx || executable_stack != EXSTACK_DISABLE_X || (__supported_pte_mask & _PAGE_NX))
+ arch_add_exec_range(current->mm, -1);
/* OK, This is the point of no return */
current->flags &= ~PF_FORKNOEXEC;
current->mm->def_flags = def_flags;