]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
[PATCH] ppc64: noexec fixes
authorAnton Blanchard <anton@samba.org>
Sun, 1 May 2005 15:58:45 +0000 (08:58 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 1 May 2005 15:58:45 +0000 (08:58 -0700)
There were a few issues with the ppc64 noexec support:

The 64bit ABI has a non executable stack by default.  At the moment 64bit apps
require a PT_GNU_STACK section in order to have a non executable stack.

Disable the read implies exec workaround on the 64bit ABI.  The 64bit
toolchain has never had problems with incorrect mmap permissions (the 32bit
has, thats why we need to retain the workaround).

With these fixes as well as a gcc fix from Alan Modra (that was recently
committed) 64bit apps work as expected.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-ppc64/elf.h
include/asm-ppc64/page.h

index 8457d90244fbef006f7042ad3e8f325334e99f17..6c42d61bedd13447e219150362a0dbc7e058734a 100644 (file)
@@ -229,9 +229,13 @@ do {                                                               \
 
 /*
  * An executable for which elf_read_implies_exec() returns TRUE will
- * have the READ_IMPLIES_EXEC personality flag set automatically.
+ * have the READ_IMPLIES_EXEC personality flag set automatically. This
+ * is only required to work around bugs in old 32bit toolchains. Since
+ * the 64bit ABI has never had these issues dont enable the workaround
+ * even if we have an executable stack.
  */
-#define elf_read_implies_exec(ex, exec_stk)    (exec_stk != EXSTACK_DISABLE_X)
+#define elf_read_implies_exec(ex, exec_stk) (test_thread_flag(TIF_32BIT) ? \
+               (exec_stk != EXSTACK_DISABLE_X) : 0)
 
 #endif
 
index 20e0f19324e8ab2af84619ec8dd41b774931c650..86219574c1a53cdf5f940a64bade4e4ea3073255 100644 (file)
@@ -252,10 +252,19 @@ extern u64 ppc64_pft_size;                /* Log 2 of page table size */
 
 /*
  * This is the default if a program doesn't have a PT_GNU_STACK
- * program header entry.
+ * program header entry. The PPC64 ELF ABI has a non executable stack
+ * stack by default, so in the absense of a PT_GNU_STACK program header
+ * we turn execute permission off.
  */
-#define VM_STACK_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
-                                VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
+#define VM_STACK_DEFAULT_FLAGS32       (VM_READ | VM_WRITE | VM_EXEC | \
+                                        VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
+
+#define VM_STACK_DEFAULT_FLAGS64       (VM_READ | VM_WRITE | \
+                                        VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
+
+#define VM_STACK_DEFAULT_FLAGS \
+       (test_thread_flag(TIF_32BIT) ? \
+        VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64)
 
 #endif /* __KERNEL__ */
 #endif /* _PPC64_PAGE_H */