RFA: Add a new gynamic tag: DT_GNU_GOT_PLT_END

Cary Coutant ccoutant@gmail.com
Mon Jan 1 00:00:00 GMT 2018


>> Fourth: Isn't the size of .got.plt inferrable from DT_PLTRELSZ? Divide
>> that by the size of each relocation (DT_PLTREL == DT_REL ? DT_RELENT :
>> DT_RELAENT), then multiply by the size of the PLTGOT entry (4 or 8),
>> then add the three reserved entries. There's a one-to-one relationship
>> between the PLT and the PLTGOT, and every PLTGOT entry must have a
>> relocation.
>
> The PLT count wouldn't include the padding at the end of the section, so it
> doesn't confer the required information.

That plus a simple flag does, though.

>> Fifth: If all you're trying to say is "the .got.plt section is
>> isolated on its own pages", couldn't you just use one of the DT_FLAGS
>> or DT_FLAGS_1? Letting the presence of an END or SZ entry signal this
>> condition is a bit risky -- what if someone decides they'd like to
>> record the size of .got.plt even when it's not isolated on its own
>> pages?
>
> Well, isn't this a problem no matter what we specify?  That someone might
> provide incorrect information?  If we use a number, at least disagreement
> about the run-time page size isn't a source of potential issues.

My point is that a DT_PLTGOTSZ entry could be useful on its own to
indicate the size of the PLT GOT. If you make it *also* imply that the
PLT GOT is isolated on its own pages, you're pre-empting that meaning
of the tag (which, given the name, would be the most obvious meaning).
Although I guess DT_PLTGOTSZ could be taken to mean: "Here's the size
of the PLT GOT, possibly including any trailing padding intended to
pad it out to a page boundary. If it works out that the beginning and
end of the segment are both at page boundaries, then it's possible to
make it relro." In other words, the tag's presence doesn't -- on its
own -- imply that the PLT GOT has been placed on separate pages, but
provides the information to determine whether it has.

That leads me to another question: How would this be different from -z
relro -z now? It looks to me like a binary with such a PLT GOT would
be nothing more than a -z relro -z now binary where nothing but the
.got.plt section ends up as RELRO. So why not just use the
PT_GNU_RELRO program header for this?

-cary



More information about the Gnu-gabi mailing list