[PATCH v5 14/24] ARM: vdso: Enable the vdsocheck tool
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Mon Sep 7 23:33:48 PDT 2026
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.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
arch/arm/mm/Kconfig | 1 +
arch/arm/vdso/Makefile | 4 ++--
lib/vdso/check/vdsocheck.rs | 9 +++++++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 6574659dfb61..565988a66e98 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -950,6 +950,7 @@ config VDSO
depends on AEABI && MMU && CPU_V7
default y if ARM_ARCH_TIMER
select GENERIC_GETTIMEOFDAY
+ select VDSO_CHECK
help
Place in the process address space an ELF shared object
providing fast implementations of gettimeofday and
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index cf8cd39ab804..fd34d0ff018a 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -37,7 +37,7 @@ endif
$(obj)/vdso.o : $(obj)/vdso.so
# Link rule for the .so file
-$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) FORCE
+$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE
@@ -50,7 +50,7 @@ $(obj)/%.so: $(obj)/%.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)
quiet_cmd_vdsomunge = MUNGE $@
cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index 1174d896a68b..fb88ef0be09d 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -48,6 +48,15 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s
..Default::default()
}
.into(),
+ bindings::EM_ARM => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_ARM_NONE,
+ bindings::R_ARM_REL32,
+ bindings::R_ARM_PREL31,
+ ],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.55.0
More information about the linux-riscv
mailing list