[PATCH v3 0/3] Arm/AArch64 tests: add permissions constraints to sections in custom linker scripts
Matthieu Longo
matthieu.longo@arm.com
Tue May 20 10:31:17 GMT 2025
Several custom linker scripts for AArch64 tests don't provide information enough to the linker to assess the right set of permisssions on segments (i.e. Read/Write/Execute). It resulted in the bundling of all the sections in a same segment with the union of all the required permissions: 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 information so that the linker can move automatically to a new segment and set the right permission for non-executable data.
The first option specifying the alignment constraints seems to be the preferred approach, even if not explicitly recommended. Examples of linker scripts for AArch64 are available at [1].
The patches for Arm and AArch64 use both approaches. Changing the alignment is sometimes difficult and would require to rewrite the tests. In those cases, the fix consisted in specifying the constraints explicitly.
Additionally, this patch series fixes the same typos present in AArch64, Arm, and TIC6x testsuites.
## References:
[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
## Testing
Regression testing on:
- arm-none-eabi
- aarch64-unknown-linux-gnu
- tic6x-none-elf
showed no failures, and the warning message was eliminated for all the tests under ld/testsuite/ld-aarch64* and ld/testsuite/ld-arm*.
Regards,
Matthieu.
Matthieu Longo (3):
AArch64, Arm and TIC6x tests: fix typo in linker scripts
AArch64 tests: add permissions constraints to sections in custom linker scripts
Arm tests: add permissions constraints to sections in custom linker scripts
ld/testsuite/ld-aarch64/aarch64.ld | 20 ++++--
ld/testsuite/ld-aarch64/gc-got-relocs.d | 15 ++--
ld/testsuite/ld-aarch64/gc-plt-relocs.d | 60 ++++++++--------
ld/testsuite/ld-aarch64/gc-relocs-257-dyn.d | 4 +-
ld/testsuite/ld-aarch64/gc-relocs-257.d | 4 +-
ld/testsuite/ld-aarch64/gc-tls-relocs.d | 14 ++--
.../ld-aarch64/protections/bti-plt.ld | 23 ++++--
ld/testsuite/ld-aarch64/relocs-ilp32.ld | 2 +-
ld/testsuite/ld-aarch64/relocs.ld | 5 +-
ld/testsuite/ld-aarch64/variant_pcs-now.d | 72 +++++++++----------
ld/testsuite/ld-aarch64/variant_pcs-shared.d | 72 +++++++++----------
ld/testsuite/ld-aarch64/variant_pcs.ld | 26 +++++--
ld/testsuite/ld-arm/arm.ld | 23 ++++--
ld/testsuite/ld-arm/arm_purecode.ld | 2 +-
ld/testsuite/ld-arm/cortex-a8-fix-plt.ld | 30 +++++---
ld/testsuite/ld-arm/discard-unwind.ld | 2 +-
ld/testsuite/ld-arm/script-type.ld | 4 +-
ld/testsuite/ld-arm/unwind-1.d | 2 +-
ld/testsuite/ld-arm/unwind-2.d | 2 +-
ld/testsuite/ld-arm/unwind-3.d | 2 +-
ld/testsuite/ld-arm/unwind-4.d | 2 +-
ld/testsuite/ld-tic6x/discard-unwind.ld | 2 +-
ld/testsuite/ld-tic6x/unwind.ld | 2 +-
23 files changed, 221 insertions(+), 169 deletions(-)
--
2.49.0
More information about the Binutils
mailing list