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 <[email protected]> --- arch/powerpc/Kconfig | 1 + arch/powerpc/kernel/vdso/Makefile | 4 ++-- lib/vdso/check/vdsocheck.rs | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c3b6cd655606..1c4a75c3a830 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -327,6 +327,7 @@ config PPC select SYSCTL_EXCEPTION_TRACE select THREAD_INFO_IN_TASK select TRACE_IRQFLAGS_SUPPORT + select VDSO_CHECK select VDSO_DATASTORE select VDSO_GETRANDOM # diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile index 0d1a49529885..b2e399e10273 100644 --- a/arch/powerpc/kernel/vdso/Makefile +++ b/arch/powerpc/kernel/vdso/Makefile @@ -82,9 +82,9 @@ targets += vdso64.lds CPPFLAGS_vdso64.lds += -P -C # link rule for the .so file, .lds has to be first -$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o FORCE +$(obj)/vdso32.so.dbg: $(obj)/vdso32.lds $(obj-vdso32) $(obj)/vgettimeofday-32.o $(obj)/vgetrandom-32.o $(obj)/crtsavres-32.o $(vdsocheck) FORCE $(call if_changed,vdso32ld_and_check) -$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o FORCE +$(obj)/vdso64.so.dbg: $(obj)/vdso64.lds $(obj-vdso64) $(obj)/vgettimeofday-64.o $(obj)/vgetrandom-64.o $(vdsocheck) FORCE $(call if_changed,vdso64ld_and_check) # assembly rules for the .S files diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs index 0d5ceaca34d7..da58ff220eab 100644 --- a/lib/vdso/check/vdsocheck.rs +++ b/lib/vdso/check/vdsocheck.rs @@ -69,6 +69,33 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s ..Default::default() } .into(), + bindings::EM_PPC => AllowedRelocations { + in_object_file: &[ + 10, /* R_PPC_REL24 */ + 11, /* R_PPC_REL14 */ + 26, /* R_PPC_REL32 */ + 249, /* R_PPC_REL16 */ + 250, /* R_PPC_REL16_LO */ + 251, /* R_PPC_REL16_HI */ + 252, /* R_PPC_REL16_HA */ + ], + ..Default::default() + } + .into(), + bindings::EM_PPC64 => AllowedRelocations { + in_object_file: &[ + 10, /* R_PPC64_REL24 */ + 11, /* R_PPC64_REL14 */ + 26, /* R_PPC64_REL32 */ + 44, /* R_PPC64_REL64 */ + 249, /* R_PPC64_REL16 */ + 250, /* R_PPC64_REL16_LO */ + 251, /* R_PPC64_REL16_HI */ + 252, /* R_PPC64_REL16_HA */ + ], + ..Default::default() + } + .into(), _ => None, } } -- 2.56.1
