[PATCH] D33251: [lld][ELF]Add option to make .dynamic read only

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 13:03:20 PDT 2017


On Thu, May 25, 2017 at 02:04:11PM -0700, Roland McGrath wrote:
> I'm still not completely clear on what this suggestion is.
> As I said above, modifying an auxv entry itself does not fill the need.
> There's only one plan based on auxv I can think of that would work,
> so perhaps that is what Joerg actually meant:
> 
> The kernel provides a new entry {AT_FOO, <addr>} where <addr> is the
> address of some word
> (presumably on the initial stack the kernel sets up, near where auxv
> itself is passed at startup).
> Then the dynamic linker can store &r_debug at *<addr>.
> Debuggers can find AT_FOO in /proc/$pid/auxv or NT_AUXV to discover <addr>.

I'm operating based on what NetBSD is doing and it doesn't cache the AUX
vector on the kernel side, so it doesn't care about modifications to it
either. As such, AT_FOO can be directly changed in-place. Making it an
indirection to some word on the initial stack works just as well though.
The main point was that it can be done as part of the normal interface
without requiring space reserved in the ELF headers or dynamic section.

Joerg


More information about the llvm-commits mailing list