[PATCH v6 00/11] vdso: Reject absolute relocations during build

From: Thomas Weißschuh

Date: Mon Nov 23 2026 - 08:51:26 EST


The compiler can emit absolute relocations in vDSO code,
which are invalid in vDSO code.
Detect them at compile-time.

The tool is written in Rust. However this does *not* introduce a Rust
dependency for kernel builds with CONFIG_RUST=n. If no Rust toolchain is
available, the new comprehensive check is skipped automatically.

libc elf.h is missing some of the relocation constants,
so hardcode the magic numbers instead.

Kbuild and Rust folks: This contains custom definitions of hostprog
bindgen and rust library commands.
These are currently only defined inside the subsystem directory.
Let me know if they should go into scripts/Makefile.host.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
---
Changes in v6:
- Drop all UAPI header changes, hardcode relocation numbers instead.
- Add note about Rust *non*-dependency to cover letter.
- Link to v5: https://patch.msgid.link/20260908-vdso-absolute-reloc-v5-0-3a93791af1cf@xxxxxxxxxxxxx

Changes in v5:
- Rebase on v7.3-rc1
- s/HOSTRUSTLIB/HOSTRUSTC L/
- Pick up review tags.
- Also handle SPARC.
- Build 'vdsocheck' during the prepare phase.
- Drop now unnecessary riscv LTO preparation patches.
- Link to v4: https://lore.kernel.org/r/20250812-vdso-absolute-reloc-v4-0-61a8b615e5ec@xxxxxxxxxxxxx

Changes in v4:
- Replace the inline shell logic with a dedicated build-time tool
- Link to v3: https://lore.kernel.org/r/20250611-vdso-absolute-reloc-v3-0-47897d73784b@xxxxxxxxxxxxx

Changes in v3:
- Drop already applied bugfix for arm64
- Disable LTO for the riscv vDSO, as it is incompatible
- Link to v2: https://lore.kernel.org/r/20250430-vdso-absolute-reloc-v2-0-5efcc3bc4b26@xxxxxxxxxxxxx

Changes in v2:
- Link to openend (invalid) GCC bug containing more explanations
- Refine commit messages
- Don't fail on commit absolute relocations in debug info
- Link to v1: https://lore.kernel.org/r/20250429-vdso-absolute-reloc-v1-0-987a0afd10b5@xxxxxxxxxxxxx

---
Thomas Weißschuh (11):
vdso: Add the vdsocheck tool
x86/vdso: Enable the vdsocheck tool
ARM: vdso: Enable the vdsocheck tool
arm64: vdso: Enable the vdsocheck tool
powerpc/vdso: Enable the vdsocheck tool
riscv: vdso: Enable the vdsocheck tool
LoongArch: vDSO: Enable the vdsocheck tool
s390/vdso: Enable the vdsocheck tool
MIPS: vdso: Enable the vdsocheck tool
sparc: vdso: Enable the vdsocheck tool
vDSO: Automatically enable VDSO_CHECK

Makefile | 19 ++
arch/arm/vdso/Makefile | 4 +-
arch/arm64/kernel/vdso/Makefile | 4 +-
arch/loongarch/vdso/Makefile | 4 +-
arch/mips/vdso/Makefile | 8 +-
arch/powerpc/kernel/vdso/Makefile | 4 +-
arch/riscv/kernel/vdso/Makefile | 4 +-
arch/s390/kernel/vdso/Makefile | 4 +-
arch/sparc/vdso/Makefile | 5 +-
arch/x86/entry/vdso/common/Makefile.include | 2 +-
lib/vdso/Kconfig | 7 +
lib/vdso/Makefile | 2 +
lib/vdso/Makefile.include | 14 +
lib/vdso/check/.gitignore | 3 +
lib/vdso/check/Makefile | 34 ++
lib/vdso/check/elf.rs | 498 ++++++++++++++++++++++++++++
lib/vdso/check/vdsocheck.rs | 299 +++++++++++++++++
17 files changed, 896 insertions(+), 19 deletions(-)
---
base-commit: 0e2fcd5208a4bbe53419a0e4359df3a614135649
change-id: 20250428-vdso-absolute-reloc-a226293c1761

Best regards,
--
Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>