[PATCH v1 00/27] aarch64: bugfix for BTI PLTs and refactoring of logic to prepare for GCS patch series
Matthieu Longo
matthieu.longo@arm.com
Mon Dec 2 14:21:52 GMT 2024
This patch series is based on the feedback from a previous review [1] on the GCS patch, but don't add any support for GCS.
Among the most noticeable changes, it addresses the missing documentation for BTI and PAC PLT options, decreases duplication of code in tests, improves test coverage for BTI tests, and fixes an issue discovered in the look-up/merge of BTI feature stored in GNU_PROPERTY_AARCH64_FEATURE_1_AND.
## Details:
The feedback of [1] regarding the restructuration of the test suite for architecture extensions is addressed in patches 1 to 9, 25, and 26.
Patch 1 moves all the tests related to GNU_PROPERTY_AARCH64_FEATURE_1_AND, and BTI and PAC PLTs into a subfolder.
Patch 2 and 9 are a refactoring of the tests to use selectable GNU properties, and a centralized declaration of GNU properties.
The remaining feedback of [1] is addressed in patches 10, 11, 13 to 21, 24, and 27.
Patch 10 regroups the software protection options under a same structure, and decreases the number of arguments passed to functions by replacing them by a pointer to this new struct.
Patches 11, 13 to 21 are generic refactorings (see the commit description for more details).
Patches 16 to 21 split the code in _bfd_aarch64_elf_link_setup_gnu_properties into subfunctions and simplify the logic in some parts of it.
Patch 24 limits the number of reported issues on missing GNU properties.
Patch 27 follows the recommendation on renaming the previous message for missing GNU properties, or feature in GNU properties.
This patch series also addressed additional issues.
Patch 12 feels the gap between the documentation of ld, and the current implementation.
Patch 22 removes the early exit for partial linking during the set-up of GNU properties.
Patch 23 fixes a newly discovered issue in the invalid look-up of properties on dynamic objects not part of the link unit.
Regression tested on aarch64-unknown-linux-gnu.
Ok for binutils-master?
Regards,
Matthieu.
[1]: https://inbox.sourceware.org/binutils/4796b1c0-20b5-4ffd-a71f-fdd955cf139b@arm.com/
Matthieu Longo (27):
aarch64: move tests for AArch64 protections (BTI, PAC) into a
subfolder
aarch64: new tests covering the merge of feature markings
aarch64: delete old tests covering the merge of feature markings
aarch64: adapt bti-plt-so to use selectable GNU properties
aarch64: new tests for BTI & PAC PLT to use selectable GNU properties
aarch64: delete old tests for PAC & BTI PLT
aarch64: adapt tests for PAC PLT to use selectable GNU properties
aarch64: adapt bti-far* tests to use selectable GNU properties
aarch64: adapt BTI tests to use selectable GNU properties
aarch64: group software protection options under a same struct.
aarch64: use only one type for feature marking report
aarch64: update ld documentation with bti and pac options
aarch64: rename parameter of _bfd_aarch64_elf_merge_gnu_properties
aarch64: simplify condition in elfNN_aarch64_merge_gnu_properties
aarch64: rename gnu_and_prop to gnu_property_aarch64_feature_1_and
aarch64: refactoring _bfd_aarch64_elf_link_setup_gnu_properties (part
1)
aarch64: refactoring _bfd_aarch64_elf_check_bti_report
aarch64: refactoring _bfd_aarch64_elf_link_setup_gnu_properties (part
2)
aarch64: refactoring _bfd_aarch64_elf_link_setup_gnu_properties (part
3)
aarch64: refactoring _bfd_aarch64_elf_link_setup_gnu_properties (part
4)
aarch64: refactoring _bfd_aarch64_elf_link_setup_gnu_properties (part
5)
aarch64: remove early exit when setting up GNU properties with partial
linking
aarch64: bugfix when finding 1st bfd input with GNU property
aarch64: limit number of reported issues on missing GNU properties
aarch64: improve test coverage for combination of BTI options
aarch64: delete duplicated BTI tests
aarch64: rename BTI error/warning message
bfd/elfnn-aarch64.c | 137 ++++------
bfd/elfxx-aarch64.c | 254 ++++++++++++------
bfd/elfxx-aarch64.h | 72 +++--
ld/emultempl/aarch64elf.em | 66 +++--
ld/ld.texi | 28 ++
ld/testsuite/ld-aarch64/aarch64-elf.exp | 64 +----
ld/testsuite/ld-aarch64/bti-plt-1.s | 40 ---
ld/testsuite/ld-aarch64/bti-plt-2.s | 21 --
ld/testsuite/ld-aarch64/bti-plt-5.d | 28 --
ld/testsuite/ld-aarch64/bti-plt-7.d | 17 --
ld/testsuite/ld-aarch64/bti-warn.d | 17 --
.../ld-aarch64/lib/aarch64-elf-lib.exp | 59 ++++
ld/testsuite/ld-aarch64/property-bti-pac1.s | 37 ---
ld/testsuite/ld-aarch64/property-bti-pac2.s | 50 ----
.../protections/aarch64-protections.exp | 60 +++++
.../ld-aarch64/{ => protections}/bti-far-1.d | 27 +-
.../ld-aarch64/{ => protections}/bti-far-2.d | 25 +-
.../ld-aarch64/{ => protections}/bti-far-3.d | 1 +
.../ld-aarch64/{ => protections}/bti-far-3.ld | 0
.../ld-aarch64/{ => protections}/bti-far-3a.s | 11 +-
.../ld-aarch64/{ => protections}/bti-far-3b.s | 11 +-
.../ld-aarch64/{ => protections}/bti-far-3c.s | 11 +-
.../{ => protections}/bti-far-opt.d | 85 +++---
.../{ => protections}/bti-far-opt.s | 11 +-
.../ld-aarch64/{ => protections}/bti-far.ld | 0
.../ld-aarch64/{ => protections}/bti-far.s | 11 +-
.../bti-pac-plt-1-a.d} | 13 +-
.../ld-aarch64/protections/bti-pac-plt-1-b.d | 36 +++
.../ld-aarch64/protections/bti-pac-plt-2-a.d | 36 +++
.../bti-pac-plt-2-b.d} | 7 +-
.../ld-aarch64/protections/bti-pac-plt-3-a.d | 36 +++
.../ld-aarch64/protections/bti-pac-plt-3-b.d | 36 +++
.../ld-aarch64/protections/bti-pac-plt.s | 12 +
.../ld-aarch64/protections/bti-plt-1-a.d | 32 +++
.../bti-plt-1-b.d} | 8 +-
.../ld-aarch64/protections/bti-plt-1-c.d | 33 +++
.../ld-aarch64/protections/bti-plt-1.s | 12 +
.../ld-aarch64/protections/bti-plt-2-a-i.d | 17 ++
.../ld-aarch64/protections/bti-plt-2-a-ii.d | 8 +
.../ld-aarch64/protections/bti-plt-2-a-iii.d | 17 ++
.../ld-aarch64/protections/bti-plt-2-a-iv.d | 12 +
.../ld-aarch64/protections/bti-plt-2-a-v.d | 17 ++
.../ld-aarch64/protections/bti-plt-2-b.d | 12 +
.../bti-plt-2-c.d} | 4 +-
.../ld-aarch64/protections/bti-plt-2.s | 14 +
.../ld-aarch64/{ => protections}/bti-plt-3.d | 6 +-
.../ld-aarch64/protections/bti-plt-4-a-i.d | 15 ++
.../ld-aarch64/protections/bti-plt-4-a-ii.d | 6 +
.../ld-aarch64/protections/bti-plt-4-a-iii.d | 15 ++
.../ld-aarch64/protections/bti-plt-4-a-iv.d | 11 +
.../ld-aarch64/protections/bti-plt-4-a-v.d | 15 ++
.../ld-aarch64/protections/bti-plt-4-b.d | 11 +
.../bti-plt-4-c.d} | 4 +-
.../ld-aarch64/{ => protections}/bti-plt-6.d | 8 +-
.../ld-aarch64/{ => protections}/bti-plt-so.s | 17 +-
.../ld-aarch64/{ => protections}/bti-plt.ld | 0
.../gnu-note-properties-maskable-merged.inc | 28 ++
.../gnu-note-properties-maskable-split.inc | 51 ++++
.../gnu-note-properties-selectable-merged.inc | 28 ++
.../gnu-note-properties-selectable-split.inc | 51 ++++
.../gnu-properties-1-all-merged.d} | 6 +-
.../protections/gnu-properties-1-all-split.d | 11 +
.../protections/gnu-properties-all.s | 28 ++
.../gnu-properties-combine-2-all-all.d | 12 +
.../gnu-properties-combine-2-all-bti.d} | 6 +-
.../gnu-properties-combine-2-all-pac.d} | 6 +-
.../protections/gnu-properties-maskable.s | 22 ++
.../protections/gnu-properties-selectable.s | 22 ++
.../pac-plt-1-a.d} | 5 +-
.../ld-aarch64/protections/pac-plt-1-b.d | 36 +++
.../ld-aarch64/{ => protections}/pac-plt-2.d | 8 +-
.../protections/property-bti-pac1.s | 12 +
.../protections/property-bti-pac2.s | 20 ++
.../{ => protections}/property-bti-pac4-a.d | 2 +-
.../{ => protections}/property-bti-pac4-b.d | 2 +-
.../{ => protections}/property-bti-pac4.s | 0
76 files changed, 1326 insertions(+), 643 deletions(-)
delete mode 100644 ld/testsuite/ld-aarch64/bti-plt-1.s
delete mode 100644 ld/testsuite/ld-aarch64/bti-plt-2.s
delete mode 100644 ld/testsuite/ld-aarch64/bti-plt-5.d
delete mode 100644 ld/testsuite/ld-aarch64/bti-plt-7.d
delete mode 100644 ld/testsuite/ld-aarch64/bti-warn.d
create mode 100644 ld/testsuite/ld-aarch64/lib/aarch64-elf-lib.exp
delete mode 100644 ld/testsuite/ld-aarch64/property-bti-pac1.s
delete mode 100644 ld/testsuite/ld-aarch64/property-bti-pac2.s
create mode 100644 ld/testsuite/ld-aarch64/protections/aarch64-protections.exp
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far-1.d (76%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far-2.d (69%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far-3.d (98%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far-3.ld (100%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far-3a.s (53%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far-3b.s (55%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far-3c.s (54%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far-opt.d (60%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far-opt.s (78%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far.ld (100%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-far.s (59%)
rename ld/testsuite/ld-aarch64/{bti-pac-plt-1.d => protections/bti-pac-plt-1-a.d} (79%)
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-pac-plt-1-b.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-pac-plt-2-a.d
rename ld/testsuite/ld-aarch64/{bti-pac-plt-2.d => protections/bti-pac-plt-2-b.d} (79%)
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-a.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-pac-plt-3-b.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-pac-plt.s
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-1-a.d
rename ld/testsuite/ld-aarch64/{bti-plt-1.d => protections/bti-plt-1-b.d} (76%)
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-1-c.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-1.s
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-2-a-i.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-2-a-ii.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-2-a-iii.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-2-a-iv.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-2-a-v.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-2-b.d
rename ld/testsuite/ld-aarch64/{bti-plt-2.d => protections/bti-plt-2-c.d} (65%)
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-2.s
rename ld/testsuite/ld-aarch64/{ => protections}/bti-plt-3.d (83%)
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-4-a-i.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-4-a-ii.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-4-a-iii.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-4-a-iv.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-4-a-v.d
create mode 100644 ld/testsuite/ld-aarch64/protections/bti-plt-4-b.d
rename ld/testsuite/ld-aarch64/{bti-plt-4.d => protections/bti-plt-4-c.d} (66%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-plt-6.d (59%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-plt-so.s (54%)
rename ld/testsuite/ld-aarch64/{ => protections}/bti-plt.ld (100%)
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-merged.inc
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-note-properties-maskable-split.inc
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-note-properties-selectable-merged.inc
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-note-properties-selectable-split.inc
rename ld/testsuite/ld-aarch64/{property-bti-pac1.d => protections/gnu-properties-1-all-merged.d} (65%)
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-properties-1-all-split.d
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-properties-all.s
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-properties-combine-2-all-all.d
rename ld/testsuite/ld-aarch64/{property-bti-pac2.d => protections/gnu-properties-combine-2-all-bti.d} (66%)
rename ld/testsuite/ld-aarch64/{property-bti-pac3.d => protections/gnu-properties-combine-2-all-pac.d} (66%)
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-properties-maskable.s
create mode 100644 ld/testsuite/ld-aarch64/protections/gnu-properties-selectable.s
rename ld/testsuite/ld-aarch64/{pac-plt-1.d => protections/pac-plt-1-a.d} (87%)
create mode 100644 ld/testsuite/ld-aarch64/protections/pac-plt-1-b.d
rename ld/testsuite/ld-aarch64/{ => protections}/pac-plt-2.d (85%)
create mode 100644 ld/testsuite/ld-aarch64/protections/property-bti-pac1.s
create mode 100644 ld/testsuite/ld-aarch64/protections/property-bti-pac2.s
rename ld/testsuite/ld-aarch64/{ => protections}/property-bti-pac4-a.d (69%)
rename ld/testsuite/ld-aarch64/{ => protections}/property-bti-pac4-b.d (73%)
rename ld/testsuite/ld-aarch64/{ => protections}/property-bti-pac4.s (100%)
--
2.47.0
More information about the Binutils
mailing list