]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PCC bounds now span READONLY and RELRO sections
authorMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 10 Feb 2022 18:15:49 +0000 (18:15 +0000)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Thu, 10 Feb 2022 18:17:12 +0000 (18:17 +0000)
commit0e02111bdd4fcab9e521c114e4a71b7d3fc408fb
tree33851d7fce9b49613373bf42891bbb8979d1bed1
parent5a9e7a184dd05b707113ed5a2890241c8fa2be36
PCC bounds now span READONLY and RELRO sections

Before this they would span sections which are SEC_CODE or some specific
known sections like the GOT and PLT.

This is not enough, since the compiler can want to access .rodata via
relative offsets to PCC.  Hence we need to include READONLY sections.

Similarly, we want to include .data.rel.ro sections in the PCC bounds so
that they can be accessed via PCC -- this allows the capability
indirection table to be accessed.

We have not been noticing this until now because the default linker
script happens to order sections such that the PCC being required to
span .got and .text happens to end up including these problematic
sections.

RELRO sections are a bit interesting since the fact they are RELRO is
not recorded anywhere on the section itself.  Rather it is stored in the
fact that the section is covered by the RELRO segment.

This means that we need to check if the sections VMA is within the
relevant range rather than just look at the section.  This turns out to
be pretty easy since we have a structure containing the RELRO range,
however we do need to ensure that we don't mix up the uses of the
section VMA and the RELRO start and end around calls of
layout_sections_again since this call can change both.
bfd/elfnn-aarch64.c