[PATCH v6 04/11] arm64: vdso: Enable the vdsocheck tool
From: Thomas Weißschuh
Date: Mon Nov 23 2026 - 08:51:34 EST
The vdsocheck tool validates the object files and final .so library.
It can detect if the compiler created relocations which are incompatible
with the vDSO which need to be worked around.
Wire it up for the architecture.
The compat vDSO will be handled by the existing 32-bit ARM configuration.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
arch/arm64/Kconfig | 1 +
arch/arm64/kernel/vdso/Makefile | 4 ++--
lib/vdso/check/vdsocheck.rs | 12 ++++++++++++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1075bc661833..df22b4ed5e29 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -258,6 +258,7 @@ config ARM64
select TRACE_IRQFLAGS_NMI_SUPPORT
select HAVE_SOFTIRQ_ON_OWN_STACK
select USER_STACKTRACE_SUPPORT
+ select VDSO_CHECK
select VDSO_GETRANDOM
select VMAP_STACK
help
diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
index f6619e1cb2ce..5d8c34c7be51 100644
--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -61,7 +61,7 @@ targets += vdso.lds
CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
# Link rule for the .so file, .lds has to be first
-$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) FORCE
+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
# Strip rule for the .so file
@@ -79,4 +79,4 @@ include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE
# Actual build commands
quiet_cmd_vdsold_and_vdso_check = LD $@
- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check)
+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check)
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index e28ee59a900d..0d5ceaca34d7 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -57,6 +57,18 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s
..Default::default()
}
.into(),
+ bindings::EM_AARCH64 => AllowedRelocations {
+ in_object_file: &[
+ 260, /* R_AARCH64_PREL64 */
+ 261, /* R_AARCH64_PREL32 */
+ 262, /* R_AARCH64_PREL16 */
+ 273, /* R_AARCH64_LD_PREL_LO19 */
+ 274, /* R_AARCH64_ADR_PREL_LO21 */
+ 283, /* R_AARCH64_CALL26 */
+ ],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.56.1