[PATCH v5 13/24] x86/vdso: Enable the vdsocheck tool
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Mon Sep 7 23:33:47 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/x86/Kconfig | 1 +
arch/x86/entry/vdso/common/Makefile.include | 2 +-
lib/vdso/check/vdsocheck.rs | 14 ++++++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 15fd9ec5ecac..ee0f2c401980 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -305,6 +305,7 @@ config X86
select HAVE_UNSTABLE_SCHED_CLOCK
select HAVE_UNWIND_USER_FP if X86_64
select HAVE_USER_RETURN_NOTIFIER
+ select VDSO_CHECK
select VDSO_GETRANDOM if X86_64
select HOTPLUG_PARALLEL if SMP && X86_64
select HOTPLUG_SMT if SMP
diff --git a/arch/x86/entry/vdso/common/Makefile.include b/arch/x86/entry/vdso/common/Makefile.include
index 687b3d89b40d..510d5e79857e 100644
--- a/arch/x86/entry/vdso/common/Makefile.include
+++ b/arch/x86/entry/vdso/common/Makefile.include
@@ -71,7 +71,7 @@ quiet_cmd_vdso = VDSO $@
quiet_cmd_vdso_and_check = VDSO $@
cmd_vdso_and_check = $(cmd_vdso); $(cmd_vdso_check)
-$(obj)/vdso%.so.dbg: $(obj)/vdso%.lds FORCE
+$(obj)/vdso%.so.dbg: $(obj)/vdso%.lds $(vdsocheck) FORCE
$(call if_changed,vdso_and_check)
$(obj)/%.so: OBJCOPYFLAGS := -S --remove-section __ex_table
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index f4c0730bc976..1174d896a68b 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -34,6 +34,20 @@ fn is_ignored_section(&self, section: &elf::Section<'_>) -> bool {
fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'static>> {
match machine as u32 {
+ bindings::EM_386 => AllowedRelocations {
+ in_object_file: &[
+ bindings::R_386_PC32,
+ bindings::R_386_GOTOFF,
+ bindings::R_386_GOTPC,
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_X86_64 => AllowedRelocations {
+ in_object_file: &[bindings::R_X86_64_PC32, bindings::R_X86_64_PLT32],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.55.0
More information about the linux-riscv
mailing list