RFA: Add a new gynamic tag: DT_GNU_GOT_PLT_END

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


>   I would like to propose the addition of a new dynamic tag to the gABI:
>
> #define DT_GNU_GOT_PLT_END 0x60000100
>
>   This tag would have two effects:
>
>     * Its presence in the dynamic section would indicate that the
>       .got.plt section is on its own in a page aligned region of
>       memory.
>
>   IE no other sections overlap the pages used by the .got.plt, and
>   the section has been padded so that it ends on a page alignment
>   boundary.
>
>     * The value of the tag would give the address of the first
>       byte beyond the end of the .got.plt.
>
>   This means that the size of the .got.plt can be computed by
>   subtracting the value of the DT_PLTGOT tag from the DT_GNU_GOT_PLT_END
>   tag.
>
>   The practical use of this tag is to allow the dynamic linker to
>   isolate the .got.plt section by changing the permissions on the pages
>   that it occupies.

First: If you're proposing this for the gABI, you should drop the
"GNU_" from the name. Or are you really proposing this just for the
Gnu ABI?

Second: Spelling. If the other related tag is DT_PLTGOT, let's spell
this one similarly -- DT_PLTGOT_END.

Third: Adding an "end of section" address is unusual for the dynamic
table. You've been quite explicit to say "the address of the first
byte beyond the end of the .got.plt", but it's actually much less
error prone to give the size of the section rather than its ending
address. You could have DT_PLTGOTSZ, which would parallel other
dynamic tags.

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.

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?

-cary



More information about the Gnu-gabi mailing list