powerpc: ppc32 needs elf_read_implies_exec()
Subsystems (2)
PATCH 1/1 powerpc: ppc32 needs elf_read_implies_exec()
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.
--- arch/powerpc/include/asm/elf.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/elf.h +1 -0
@@ -259,6 +259,7 @@ do { \ (exec_stk != EXSTACK_DISABLE_X) : 0)#else # define SET_PERSONALITY (ex) set_personality(PER_LINUX) +# define elf_read_implies_exec (ex, exec_stk) (exec_stk != EXSTACK_DISABLE_X)#endif /* __powerpc64__ */ extern int dcache_bsize;
Signature · 1 line
1.6.0.6
Quoted 23 lines · Kumar Gala
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.Signed-off-by Kumar Gala <[email protected]>---
arch/powerpc/include/asm/elf.h| 1 +1 files changed, 1 insertions(+), 0 deletions(-)arch/powerpc/include/asm/elf.h +1
-0@@ -259,6 +259,7 @@ do { \ (exec_stk != EXSTACK_DISABLE_X) : 0)#else # define SET_PERSONALITY (ex) set_personality(PER_LINUX) +# define elf_read_implies_exec (ex, exec_stk) (exec_stk != EXSTACK_DISABLE_X)#endif /* __powerpc64__ */
Quoted 3 lines
extern int
dcache_bsize;Signature · 1 line
1.6.0.6
I just want to make sure I understand the implications of this change. It seems to me that we will not be able to support stack exec perms on any ppc32 part that has per-page exec support. Is that correct?
I'm wondering if we are too generous in the check, exec_stk can be:
EXSTACK_DEFAULTEXSTACK_DISABLE_XEXSTACK_ENABLE_X
It seems like EXSTACK_DISABLE_X/EXSTACK_ENABLE_X are only set if p_type == PT_GNU_STACK. Do we think toolchains existed that set p_type to PT_GNU_STACK that don't set PF_X properly?
My thinking is elf_read_implies_exec() should be changed to:
# define elf_read_implies_exec(ex, exec_stk) (exec_stk == EXSTACK_DEFAULT)
- k