[PATCH] D28267: ELF: Round p_memsz of the PT_GNU_RELRO program header up to the page size.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 4 11:06:04 PST 2017


pcc added a comment.

In https://reviews.llvm.org/D28267#635130, @davide wrote:

> LGTM. Out of curiosity, how did you discover this?


To test my change https://reviews.llvm.org/D28272, I compiled and ran a small test program (essentially the one in figure 2 in the referenced paper). I was surprised to find that even after the copy relocation was moved to relro the program terminated without segfaulting. An strace revealed that the loader wasn't calling mprotect on the relro region at all, which turned out to be because it was smaller than the page size.


https://reviews.llvm.org/D28267





More information about the llvm-commits mailing list