aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2005-05-01 11:58:45 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:58:45 -0400
commita2f95a5ae99eb8209ad8d9faeaada00600bd8027 (patch)
treec135aff1ea47e57fcdfe22cca12e77738f433d27 /include/asm-ppc64
parentd03853d566fb32c6bb8cab4bf2ecf53e692f001c (diff)
[PATCH] ppc64: noexec fixes
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>
Diffstat (limited to 'include/asm-ppc64')
-rw-r--r--include/asm-ppc64/elf.h8
-rw-r--r--include/asm-ppc64/page.h15
2 files changed, 18 insertions, 5 deletions
diff --git a/include/asm-ppc64/elf.h b/include/asm-ppc64/elf.h
index 8457d90244fb..6c42d61bedd1 100644
--- a/include/asm-ppc64/elf.h
+++ b/include/asm-ppc64/elf.h
@@ -229,9 +229,13 @@ do { \
229 229
230/* 230/*
231 * An executable for which elf_read_implies_exec() returns TRUE will 231 * An executable for which elf_read_implies_exec() returns TRUE will
232 * have the READ_IMPLIES_EXEC personality flag set automatically. 232 * have the READ_IMPLIES_EXEC personality flag set automatically. This
233 * is only required to work around bugs in old 32bit toolchains. Since
234 * the 64bit ABI has never had these issues dont enable the workaround
235 * even if we have an executable stack.
233 */ 236 */
234#define elf_read_implies_exec(ex, exec_stk) (exec_stk != EXSTACK_DISABLE_X) 237#define elf_read_implies_exec(ex, exec_stk) (test_thread_flag(TIF_32BIT) ? \
238 (exec_stk != EXSTACK_DISABLE_X) : 0)
235 239
236#endif 240#endif
237 241
diff --git a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h
index 20e0f19324e8..86219574c1a5 100644
--- a/include/asm-ppc64/page.h
+++ b/include/asm-ppc64/page.h
@@ -252,10 +252,19 @@ extern u64 ppc64_pft_size; /* Log 2 of page table size */
252 252
253/* 253/*
254 * This is the default if a program doesn't have a PT_GNU_STACK 254 * This is the default if a program doesn't have a PT_GNU_STACK
255 * program header entry. 255 * program header entry. The PPC64 ELF ABI has a non executable stack
256 * stack by default, so in the absense of a PT_GNU_STACK program header
257 * we turn execute permission off.
256 */ 258 */
257#define VM_STACK_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 259#define VM_STACK_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \
258 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 260 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
261
262#define VM_STACK_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \
263 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
264
265#define VM_STACK_DEFAULT_FLAGS \
266 (test_thread_flag(TIF_32BIT) ? \
267 VM_STACK_DEFAULT_FLAGS32 : VM_STACK_DEFAULT_FLAGS64)
259 268
260#endif /* __KERNEL__ */ 269#endif /* __KERNEL__ */
261#endif /* _PPC64_PAGE_H */ 270#endif /* _PPC64_PAGE_H */