[lld] r290986 - ELF: Round p_memsz of the PT_GNU_RELRO program header up to the page size.

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 07:49:30 PST 2017


On 4 January 2017 at 13:56, Peter Collingbourne via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: pcc
> Date: Wed Jan  4 12:56:15 2017
> New Revision: 290986
>
> URL: http://llvm.org/viewvc/llvm-project?rev=290986&view=rev
> Log:
> ELF: Round p_memsz of the PT_GNU_RELRO program header up to the page size.

It turns out this introduces a bug on FreeBSD/arm64. The PT_GNU_RELRO
header is rounded up to DefaultMaxPageSize of 64K, but with 4K pages
we mprotect() several pages beyond the last segment, leading to a
segfault when an allocation that happened in that region is changed to
RO.

We need to at least avoid applying this rounding when outputting
objects for FreeBSD, but this same issue will apply anywhere the
target supports multiple page sizes. Anyone know what page size(s)
Linux/arm64 distros use?


More information about the llvm-commits mailing list