• Paul Mackerras's avatar
    [PATCH] PPC64 Implement non-executable stacks · cae15a85
    Paul Mackerras authored
    This patch, by Jake Moilanen with some further hacking from me, adds a
    real execute permission bit to the linux PTEs on PPC64, and connects
    that into the kernel infrastructure for implementing non-executable
    stacks and heaps.  This means that on any PPC64 cpu since the POWER4
    (i.e. POWER4, PPC970, PPC970FX, POWER4+, POWER5) you will get a
    segfault if you try to execute instructions from a region that doesn't
    have PROT_EXEC permission.  The patch also marks the pages of the
    linear mapping that aren't part of the kernel text as non-executable.
    
    Andrew and Linus, could you try this on your G5s?  I have tried it
    here on a Debian system and a SLES9 system and everything runs fine,
    but I haven't been able to try it on YDL, FC or RHEL4.
    
    With this patch we default to executable stack and read-implies-exec
    behaviour when there is no PT_GNU_STACK program header entry, or when
    there is one and it indicates the stack is executable.  For 32-bit
    processes, the heap is always executable, because the PLT contains
    instructions and it ends up in the bss segment.
    Signed-off-by: default avatarJake Moilanen <moilanen@austin.ibm.com>
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    cae15a85
elf.h 16.3 KB