[PATCH 0/4] aarch64: Support enforcing BTI
Yury Khrustalev
yury.khrustalev@arm.com
Fri Oct 31 15:37:00 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. As with
GCS, we expect that if the tests are executed on a system that supports
BTI, Glibc itself and the tests should be built with a toolchain that
supports BTI as well.
---
Passes regression in AArch64. OK for trunk?
Base commit: 7d99ff550f
---
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
configure | 98 +++++++++++++++++++
configure.ac | 17 ++++
manual/tunables.texi | 15 +++
sysdeps/aarch64/Makefile | 58 ++++++++++-
sysdeps/aarch64/dl-bti.c | 18 ++++
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 | 63 ++++++++++++
sysdeps/aarch64/tst-bti-skeleton.c | 46 +++++++++
.../unix/sysv/linux/aarch64/cpu-features.c | 2 +
sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c | 16 +++
25 files changed, 449 insertions(+), 1 deletion(-)
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