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 --- 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 b5a51b0ef944..1caaf4737f02 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 7dec05dd33b7..9fac0e54097d 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 fb88ef0be09d..e45a1fbc6829 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 { + in_object_file: &[ + bindings::R_AARCH64_PREL64, + bindings::R_AARCH64_PREL32, + bindings::R_AARCH64_PREL16, + bindings::R_AARCH64_LD_PREL_LO19, + bindings::R_AARCH64_ADR_PREL_LO21, + bindings::R_AARCH64_CALL26, + ], + ..Default::default() + } + .into(), _ => None, } } -- 2.55.0