[PATCH v2 0/4] aarch64: Support enforcing BTI
Yury Khrustalev
yury.khrustalev@arm.com
Wed Nov 19 16:35:17 GMT 2025
Current behaviour on AArch64 targets that support Branch Target
Authentication (BTI) allows to load a dependency that is not
BTI-marked (via appropriate ELF property). It is useful to support
behaviour when loading dependencies with and without BTI marking
in the same process results in an error. To do this, we add new
Glibc tunable glibc.cpu.aarch64_bti.
The default value 0 of this tunable corresponds to existing behaviour
and we lable this value as "permissive". To enforce BTI protection,
the process might be started with value 1 of this tunable. In this
case all the dependencies loaded by the dynamic loader will have to
be correctly marked and, if a module is loaded via dlopen, an error
will be returned from this function.
To facilitate testing, we need to add new configure checks.
---
Passes regression in AArch64. OK for trunk?
Base commit: 40a751b004
---
Changes in v2:
- Fixed several things based on upstream feedback.
- Added new configure check for a macro defined by a compiler
to check if BTI branch protection was enabled.
- v1: https://inbox.sourceware.org/libc-alpha/20251031153704.3883875-1-yury.khrustalev@arm.com/
---
Yury Khrustalev (4):
aarch64: add configure checks for BTI support
aarch64: Add glibc.cpu.aarch64_bti tunable
aarch64: Support enforcing BTI on dependencies
aarch64: add tests for glibc.cpu.aarch64_bti behaviour
aclocal.m4 | 14 ++
configure | 126 ++++++++++++++++++
configure.ac | 27 ++++
manual/tunables.texi | 16 +++
sysdeps/aarch64/Makefile | 58 +++++++-
sysdeps/aarch64/cpu-features.h | 5 +
sysdeps/aarch64/dl-bti.c | 16 ++-
sysdeps/aarch64/dl-tunables.list | 6 +
sysdeps/aarch64/linkmap.h | 1 +
sysdeps/aarch64/tst-bti-abort-imm.c | 3 +
sysdeps/aarch64/tst-bti-abort-transitive.c | 3 +
sysdeps/aarch64/tst-bti-abort-unprot.c | 3 +
sysdeps/aarch64/tst-bti-abort.sh | 39 ++++++
sysdeps/aarch64/tst-bti-dep-prot.c | 3 +
sysdeps/aarch64/tst-bti-dlopen-imm.c | 6 +
sysdeps/aarch64/tst-bti-dlopen-prot.c | 6 +
sysdeps/aarch64/tst-bti-dlopen-transitive.c | 6 +
sysdeps/aarch64/tst-bti-mod-prot.c | 2 +
sysdeps/aarch64/tst-bti-mod-unprot.c | 2 +
sysdeps/aarch64/tst-bti-mod.c | 25 ++++
sysdeps/aarch64/tst-bti-permissive-dlopen.c | 6 +
sysdeps/aarch64/tst-bti-permissive-imm.c | 3 +
.../aarch64/tst-bti-permissive-transitive.c | 3 +
sysdeps/aarch64/tst-bti-skeleton-dlopen.c | 62 +++++++++
sysdeps/aarch64/tst-bti-skeleton.c | 45 +++++++
.../unix/sysv/linux/aarch64/cpu-features.c | 2 +
sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c | 16 +++
27 files changed, 502 insertions(+), 2 deletions(-)
create mode 100644 sysdeps/aarch64/tst-bti-abort-imm.c
create mode 100644 sysdeps/aarch64/tst-bti-abort-transitive.c
create mode 100644 sysdeps/aarch64/tst-bti-abort-unprot.c
create mode 100644 sysdeps/aarch64/tst-bti-abort.sh
create mode 100644 sysdeps/aarch64/tst-bti-dep-prot.c
create mode 100644 sysdeps/aarch64/tst-bti-dlopen-imm.c
create mode 100644 sysdeps/aarch64/tst-bti-dlopen-prot.c
create mode 100644 sysdeps/aarch64/tst-bti-dlopen-transitive.c
create mode 100644 sysdeps/aarch64/tst-bti-mod-prot.c
create mode 100644 sysdeps/aarch64/tst-bti-mod-unprot.c
create mode 100644 sysdeps/aarch64/tst-bti-mod.c
create mode 100644 sysdeps/aarch64/tst-bti-permissive-dlopen.c
create mode 100644 sysdeps/aarch64/tst-bti-permissive-imm.c
create mode 100644 sysdeps/aarch64/tst-bti-permissive-transitive.c
create mode 100644 sysdeps/aarch64/tst-bti-skeleton-dlopen.c
create mode 100644 sysdeps/aarch64/tst-bti-skeleton.c
--
2.47.3
More information about the Libc-alpha
mailing list