]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
AArch64 tests: remove RWX permissions on segments
authorMatthieu Longo <matthieu.longo@arm.com>
Wed, 21 May 2025 10:18:48 +0000 (11:18 +0100)
committerMatthieu Longo <matthieu.longo@arm.com>
Wed, 11 Jun 2025 10:32:45 +0000 (11:32 +0100)
commit3d8523e3a45e583b2472df55d3752a2b41e3550f
treea3f1e912f6fb23f0deab95d5ef567bea6cd2bc5b
parenta23ef19dec706d7fd1f85d2d47e15630f1c59896
AArch64 tests: remove RWX permissions on segments

aarch64.ld is the linker script used by most of the relocation tests in AArch64
testsuite. The script does not provide information enough to the linker to assess
the right set of permisssions on segments (i.e. Read/Write/Execute).
This insufficiency caused the linker to bundle all the sections in a same segment
with the union of all the required permissions, i.e. RWX.
A segment with such lax permissions constitutes a security hole, so the linker
emits the following warning message:
    <ELF file> has a LOAD segment with RWX permissions.
This warning message is noisy in the tests, and has no reason to exist.

This issue can be addressed in two ways:
- either by providing the right set of permissions on a section so that the
  linker assigns them to a segment with compatible permissions.
- or by providing alignment constraints so that the linker can move the sections
  automatically to a new segment and set the right permission for non-executable
  data.

The second option seems to be the preferred approach, even if not explicitly
recommended. Examples of linker scripts for AArch64 are available at [1].

[1]: https://developer.arm.com/documentation/dui0474/m/gnu-ld-script-support-in
     -armlink/default-gnu-ld-scripts-used-by-armlink/default-ld-script-when
     -building-an-executable?lang=en
ld/testsuite/ld-aarch64/aarch64.ld
ld/testsuite/ld-aarch64/gc-got-relocs.d
ld/testsuite/ld-aarch64/gc-plt-relocs.d
ld/testsuite/ld-aarch64/gc-relocs-257-dyn.d
ld/testsuite/ld-aarch64/gc-relocs-257.d
ld/testsuite/ld-aarch64/gc-tls-relocs.d