rtld: add RELRO support
authorJohn Marino <draco@marino.st>
Mon, 16 Jan 2012 14:39:15 +0000 (15:39 +0100)
committerJohn Marino <draco@marino.st>
Mon, 16 Jan 2012 18:47:31 +0000 (19:47 +0100)
commit007f494e0a1eec2db98703bbe5e4b29a890c01d1
treeffd89b31f2f349c6c441d4794b77c603e808382e
parentf609f0351a301d4718a3bda7208d3f190462cce6
rtld: add RELRO support

"RELRO" means PLT (partial) or PLT+GOT (full) data is shifted to a
dedicated page by the linker which triggers the dynamic linker to
protect the page by setting the memory to read-only.  This feature
assists in detecting memory corruption and also prevents some types
of buffer overflow exploits.

Until now, this feature was only supported by Linux's glibc.  No BSD
had relro support in their dynamic linker.  I proposed the patch and
it was reviewed by a FreeBSD dynamic linker expert.  Attempts to
access protected data currently results in a bus error signal, but the
next commit will update the kernel trap files to cause the segfault
signal to be emitted instead.

Reviewed-by: Kostik Belousov
libexec/rtld-elf/map_object.c
libexec/rtld-elf/rtld.c
libexec/rtld-elf/rtld.h
sys/sys/elf_common.h