diff mbox

powerpc: Fix up elf_read_implies_exec() usage

Message ID Pine.LNX.4.64.0904280808220.8094@localhost.localdomain (mailing list archive)
State Superseded, archived
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Kumar Gala April 28, 2009, 1:08 p.m. UTC
On ppc64 we implemented elf_read_implies_exec() for 32-bit binaries
because old toolchains had bugs with regards to marking PHDRs as
executable that needed to be.  For some reason we didn't do this on
ppc32 builds.  This hadn't been an issue until recent changes to I$/D$
handling that impacted the per-page exec handling on embedded PPC.

Additionally we believe if a toolchain supported PT_GNU_STACK that it
sets the proper PHDR permissions so we only have elf_read_implies_exec()
true if we don't see PT_GNU_STACK set.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---

Paul, please pick this up for 2.6.30 and send onto linus.

- k

 arch/powerpc/include/asm/elf.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Kumar Gala April 28, 2009, 1:26 p.m. UTC | #1
On Apr 28, 2009, at 8:08 AM, Kumar Gala wrote:

> On ppc64 we implemented elf_read_implies_exec() for 32-bit binaries
> because old toolchains had bugs with regards to marking PHDRs as
> executable that needed to be.  For some reason we didn't do this on
> ppc32 builds.  This hadn't been an issue until recent changes to I$/D$
> handling that impacted the per-page exec handling on embedded PPC.
>
> Additionally we believe if a toolchain supported PT_GNU_STACK that it
> sets the proper PHDR permissions so we only have  
> elf_read_implies_exec()
> true if we don't see PT_GNU_STACK set.
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
> ---
>
> Paul, please pick this up for 2.6.30 and send onto linus.
>
> - k

oops.. didn't see you grabbed the old one already.  I'll send a new  
patch based on it to switch to testing against EXSTACK_DEFAULT

- k
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 087c22f..014a624 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -256,10 +256,11 @@  do {								\
  * even if we have an executable stack.
  */
 # define elf_read_implies_exec(ex, exec_stk) (test_thread_flag(TIF_32BIT) ? \
-		(exec_stk != EXSTACK_DISABLE_X) : 0)
+		(exec_stk == EXSTACK_DEFAULT) : 0)
 #else
 # define SET_PERSONALITY(ex) \
   set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
+# define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT)
 #endif /* __powerpc64__ */

 extern int dcache_bsize;