[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 13:01:03 PST 2017


On 27 January 2017 at 13:36, Rafael Avila de Espindola
<rafael.espindola at gmail.com> wrote:
>
> Can you expand a bit on how this crashes? The first section after
> PT_GNU_RELRO is also aligned to MaxPageSize:

But the end of the final PT_LOAD is not aligned to MaxPageSize.

I don't have the exact details (they were relayed to me over IRC), but
this isn't an allocation from LLD, it's e.g. a malloc() from the
application. It might be that it requires multiple threads, with
simultaneous dlopen() and malloc().

The problem here is that the PT_GNU_RELRO covered up to 15 pages
beyond the final PT_LOAD, with MaxPageSize=64K and 4K pages. So rtld
maps the final PT_LOAD and then after relocation applies mprotect to
pages that were never mapped by rtld.


More information about the llvm-commits mailing list