rtld: Add stubs to support PT_GNU_STACK
authorJohn Marino <draco@marino.st>
Sat, 21 Jan 2012 20:53:12 +0000 (21:53 +0100)
committerJohn Marino <draco@marino.st>
Mon, 23 Jan 2012 16:13:17 +0000 (17:13 +0100)
commite9de6dccf96c643b779ee1f2d5de6a19375e7fa8
tree49a877fcd22669151189e01680947a6d9f00a54c
parent35b2b265aa300727e840990e41e604edb8b25314
rtld: Add stubs to support PT_GNU_STACK

This functionality requires kernel support to determine the initial stack
access mode.  This is how it's supposed to work:

If the loaded DSO requires an executable stack as specified by the PF_X
bit or p_flags on PT_GNU_STACK phdr, yet the current stack protection does
not permit execution: The map_stacks_exec function should change the
stack protection mode of all thread stacks.

The PT_GNU_STACK phdr parser has been implemented as well as a private
interface to _rtld_get_stack_prot() in order to export the stack access
mode calculated by rtld.

Left to do:
1) Implement stack protection in the kernel
2) Add PT_GNU_STACK functionality in the kernel
3) Add a method to change stack protection mode in libc or libthread
4) Implement map_stacks_exec function in rtld.
lib/libc/gen/dlfcn.c
libexec/rtld-elf/i386/rtld_machdep.h
libexec/rtld-elf/map_object.c
libexec/rtld-elf/rtld.c
libexec/rtld-elf/rtld.h
libexec/rtld-elf/x86_64/rtld_machdep.h
sys/sys/link_elf.h