linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 00/11] vdso: Reject absolute relocations during build
@ 2026-11-23 13:50 Thomas Weißschuh
  2026-11-23 13:50 ` [PATCH v6 01/11] vdso: Add the vdsocheck tool Thomas Weißschuh
                   ` (11 more replies)
  0 siblings, 12 replies; 20+ messages in thread
From: Thomas Weißschuh @ 2026-11-23 13:50 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Andy Lutomirski, Vincenzo Frascino, Kees Cook, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
	Richard Weinberger, Anton Ivanov, Johannes Berg, Russell King,
	Catalin Marinas, Will Deacon, Madhavan Srinivasan,
	Michael Ellerman, Nicholas Piggin, Huacai Chen, WANG Xuerui,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Thomas Bogendoerfer,
	Miguel Ojeda, Alex Gaynor, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Thomas Gleixner, Christophe Leroy, Boqun Feng,
	Nicolas Schier
  Cc: linux-riscv, linux-kernel, llvm, linux-mm, linux-um,
	linux-arm-kernel, linuxppc-dev, loongarch, linux-s390, linux-mips,
	rust-for-linux, linux-kbuild, Jan Stancek,
	Arnaldo Carvalho de Melo, Peter Zijlstra, Thomas Weißschuh

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@linutronix.de>
---
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@linutronix.de

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@linutronix.de

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@linutronix.de

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@linutronix.de

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@linutronix.de

---
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@linutronix.de>


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-11-24 13:53 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 01/11] vdso: Add the vdsocheck tool Thomas Weißschuh
2026-11-24 13:52   ` sashiko-bot
2026-11-23 13:50 ` [PATCH v6 02/11] x86/vdso: Enable " Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 03/11] ARM: vdso: " Thomas Weißschuh
2026-11-24 13:53   ` sashiko-bot
2026-11-23 13:50 ` [PATCH v6 04/11] arm64: " Thomas Weißschuh
2026-11-24 13:53   ` sashiko-bot
2026-11-23 13:50 ` [PATCH v6 05/11] powerpc/vdso: " Thomas Weißschuh
2026-11-24 13:53   ` sashiko-bot
2026-11-23 13:50 ` [PATCH v6 06/11] riscv: vdso: " Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 07/11] LoongArch: vDSO: " Thomas Weißschuh
2026-11-24 13:53   ` sashiko-bot
2026-11-23 13:50 ` [PATCH v6 08/11] s390/vdso: " Thomas Weißschuh
2026-11-23 13:51 ` [PATCH v6 09/11] MIPS: vdso: " Thomas Weißschuh
2026-11-24 13:53   ` sashiko-bot
2026-11-23 13:51 ` [PATCH v6 10/11] sparc: " Thomas Weißschuh
2026-11-23 13:51 ` [PATCH v6 11/11] vDSO: Automatically enable VDSO_CHECK Thomas Weißschuh
2026-11-24 13:53   ` sashiko-bot
2026-11-24 13:53 ` [PATCH v6 00/11] vdso: Reject absolute relocations during build sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).