[PATCH] D15423: [ELF] - Place RW sections that go after relro to another memory page.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 10 10:28:16 PST 2015


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: emaste, grimar, llvm-commits.

Ian Lance Taylor writes:
"When the dynamic linker sees a PT_GNU_RELRO segment, it uses mprotect to mark the pages as read-only after the dynamic relocations have been applied. Of course this only works if the segment does in fact cover an entire page. The linker will try to force this to happen." (http://www.airs.com/blog/archives/189).

Before this patch sections that go after relro sequence were placed at the same memory page with relro ones. It caused segmentation fault on freebsd.
This should fix the https://llvm.org/bugs/show_bug.cgi?id=25790 (I have no freebsd to check)

http://reviews.llvm.org/D15423

Files:
  ELF/Writer.cpp
  test/ELF/aarch64-copy.s
  test/ELF/dynamic-reloc-index.s
  test/ELF/dynamic-reloc.s
  test/ELF/mips-got-relocs.s
  test/ELF/plt-aarch64.s
  test/ELF/plt-i686.s
  test/ELF/plt.s
  test/ELF/ppc64-shared-rel-toc.s
  test/ELF/relocation-copy-i686.s
  test/ELF/relocation-copy.s
  test/ELF/relocation.s
  test/ELF/relro.s
  test/ELF/tls-opt-gdie.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15423.42444.patch
Type: text/x-patch
Size: 31246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151210/eb6901ca/attachment.bin>


More information about the llvm-commits mailing list