From Fedora Project Wiki

< Toolchain‎ | Watermark

Revision as of 10:34, 24 October 2016 by Fweimer (talk | contribs)

Page Size

A useful hardening feature is to have a page in the data segment which you can make read-only after initialization (using mprotect). Assuming the data is accessed using PC-relative instructions, there is no way that malicious code can patch it (without calling mprotect again first). For this to work, that data needs to be aligned on a page boundary, otherwise the protect call might make unrelated variables read-only. We currently do not encode the page size in the executable. There are some claims it is possible to guess it from the program header, but that seems to be a bit of a stretch.

Similarly, for figuring out if a binary has indeed full RELRO, we need to know if the dynamic linker can actually make the GOT read-only because it does not overlap with data which has to be read-write. Without explicit page size information, it is not possible to tell whether lack of RELRO due to misalignment is a static linker bug or a missing linker flag.