
Messages in this thread
Patch in this message
Subject[patch 30/47] exec: fix stack excutability without PT_GNU_STACK

From: Hugh Dickins <>
commit 96a8e13ed44e380fc2bb6c711d74d5ba698c00b2 upstream

Kernel Bugzilla #11063 points out that on some architectures (e.g. x86_32)
exec'ing an ELF without a PT_GNU_STACK program header should default to an
executable stack; but this got broken by the unlimited argv feature because
stack vma is now created before the right personality has been established:
so breaking old binaries using nested function trampolines.

Therefore re-evaluate VM_STACK_FLAGS in setup_arg_pages, where stack
vm_flags used to be set, before the mprotect_fixup. Checking through
our existing VM_flags, none would have changed since insert_vm_struct:
so this seems safer than finding a way through the personality labyrinth.

Signed-off-by: Hugh Dickins <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: Greg Kroah-Hartman <>

fs/exec.c | 2 +-
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -605,7 +605,7 @@ int setup_arg_pages(struct linux_binprm
bprm->exec -= stack_shift;

- vm_flags = vma->vm_flags;
+ vm_flags = VM_STACK_FLAGS;

* Adjust stack execute permissions; explicitly enable for

 \ /
  Last update: 2008-07-23 01:31    [from the cache]
©2003-2011 Jasper Spaans