Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/24] vdso: Reject absolute relocations during build
@ 2026-09-08  6:33 Thomas Weißschuh
  2026-09-08  6:33 ` [PATCH v5 01/24] elf, uapi: Add a header for relocation constants Thomas Weißschuh
                   ` (23 more replies)
  0 siblings, 24 replies; 53+ messages in thread
From: Thomas Weißschuh @ 2026-09-08  6:33 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, Alexandre Ghiti, Thomas Weißschuh

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

libc elf.h is missing some of the relocation constants,
so make use of the kernels own UAPI headers instead.

Patches 13 onward contain the architecture specific changes,
interesting for the architecture maintaines.

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 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 (24):
      elf, uapi: Add a header for relocation constants
      x86/elf, um/x86/elf: Move relocation constants to UAPI
      ARM: elf: Move relocation constants to UAPI
      arm64: elf: Move relocation constants to UAPI
      powerpc/elf: Move relocation constants to UAPI
      riscv: elf: Move relocation constants to UAPI
      LoongArch: Move relocation constants to UAPI
      s390/elf: Move relocation constants to UAPI
      MIPS: ELF: Move relocation constants to UAPI
      sparc: elf: Move relocation constants to UAPI
      tools headers UAPI: Sync ELF headers with the kernel sources
      vdso: Add the vdsocheck tool
      x86/vdso: Enable the vdsocheck tool
      ARM: vdso: Enable the vdsocheck tool
      arm64: vdso: Enable the vdsocheck tool
      powerpc/elf: Add 32-bit REL16 relocation definitions
      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: ELF: Add more PC-relative relocation definitions
      MIPS: vdso: Enable the vdsocheck tool
      sparc: vdso: Enable the vdsocheck tool
      vDSO: Automatically enable VDSO_CHECK

 Makefile                                    |  19 +
 arch/arm/include/asm/elf.h                  |  24 -
 arch/arm/vdso/Makefile                      |   4 +-
 arch/arm64/include/asm/elf.h                |  55 ---
 arch/arm64/kernel/vdso/Makefile             |   4 +-
 arch/loongarch/include/asm/elf.h            | 130 -----
 arch/loongarch/vdso/Makefile                |   4 +-
 arch/mips/include/asm/elf.h                 |  55 ---
 arch/mips/vdso/Makefile                     |   8 +-
 arch/powerpc/include/uapi/asm/elf.h         | 201 --------
 arch/powerpc/kernel/vdso/Makefile           |   4 +-
 arch/riscv/include/uapi/asm/elf.h           |  66 ---
 arch/riscv/kernel/vdso/Makefile             |   4 +-
 arch/s390/include/asm/elf.h                 |  83 ----
 arch/s390/kernel/vdso/Makefile              |   4 +-
 arch/sparc/include/asm/elf_32.h             |  43 --
 arch/sparc/include/asm/elf_64.h             |  44 --
 arch/sparc/vdso/Makefile                    |   5 +-
 arch/x86/entry/vdso/common/Makefile.include |   2 +-
 arch/x86/include/asm/elf.h                  |  33 --
 arch/x86/um/asm/elf.h                       |  33 --
 include/uapi/linux/elf-r.h                  | 705 ++++++++++++++++++++++++++++
 include/uapi/linux/elf.h                    |   1 +
 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 ++++++++++++
 tools/include/uapi/linux/elf-em.h           |  71 +++
 tools/include/uapi/linux/elf-r.h            | 705 ++++++++++++++++++++++++++++
 tools/include/uapi/linux/elf.h              | 112 ++++-
 33 files changed, 2479 insertions(+), 797 deletions(-)
---
base-commit: 2f737a133fad3808f9993f704fb27fd7791a0a41
change-id: 20250428-vdso-absolute-reloc-a226293c1761

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


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2026-09-10  8:33 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08  6:33 [PATCH v5 00/24] vdso: Reject absolute relocations during build Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 01/24] elf, uapi: Add a header for relocation constants Thomas Weißschuh
2026-09-08  9:00   ` Christophe Leroy (CS GROUP)
2026-09-10  6:31   ` Mukesh Kumar Chaurasiya
2026-09-08  6:33 ` [PATCH v5 02/24] x86/elf, um/x86/elf: Move relocation constants to UAPI Thomas Weißschuh
2026-09-08 13:55   ` Borislav Petkov
2026-09-08 14:26     ` Thomas Weißschuh
2026-09-08 15:12       ` Borislav Petkov
2026-09-09  5:59         ` Thomas Weißschuh
2026-09-09 14:49           ` Borislav Petkov
2026-09-09 19:27             ` H. Peter Anvin
2026-09-09 19:47               ` Borislav Petkov
2026-09-10  8:33             ` Thomas Weißschuh
2026-09-08 14:32     ` Christophe Leroy (CS GROUP)
2026-09-08  6:33 ` [PATCH v5 03/24] ARM: elf: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 04/24] arm64: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 05/24] powerpc/elf: " Thomas Weißschuh
2026-09-08  9:02   ` Christophe Leroy (CS GROUP)
2026-09-08 14:01   ` R Nageswara Sastry
2026-09-10  6:30   ` Mukesh Kumar Chaurasiya
2026-09-08  6:33 ` [PATCH v5 06/24] riscv: elf: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 07/24] LoongArch: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 08/24] s390/elf: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 09/24] MIPS: ELF: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 10/24] sparc: elf: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 11/24] tools headers UAPI: Sync ELF headers with the kernel sources Thomas Weißschuh
2026-09-08  8:56   ` Christophe Leroy (CS GROUP)
2026-09-08  9:37     ` Thomas Weißschuh
2026-09-08  9:09   ` Christophe Leroy (CS GROUP)
2026-09-08  6:33 ` [PATCH v5 12/24] vdso: Add the vdsocheck tool Thomas Weißschuh
2026-09-08  7:19   ` Peter Zijlstra
2026-09-08  7:35     ` Thomas Weißschuh
2026-09-08  7:37       ` Peter Zijlstra
2026-09-09 19:31     ` H. Peter Anvin
2026-09-09 19:38       ` Miguel Ojeda
2026-09-10  6:52   ` Mukesh Kumar Chaurasiya
2026-09-08  6:33 ` [PATCH v5 13/24] x86/vdso: Enable " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 14/24] ARM: vdso: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 15/24] arm64: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 16/24] powerpc/elf: Add 32-bit REL16 relocation definitions Thomas Weißschuh
2026-09-08  9:21   ` Christophe Leroy (CS GROUP)
2026-09-08 14:01   ` R Nageswara Sastry
2026-09-08  6:33 ` [PATCH v5 17/24] powerpc/vdso: Enable the vdsocheck tool Thomas Weißschuh
2026-09-08 14:02   ` R Nageswara Sastry
2026-09-08 14:41   ` Christophe Leroy (CS GROUP)
2026-09-09  6:09     ` Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 18/24] riscv: vdso: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 19/24] LoongArch: vDSO: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 20/24] s390/vdso: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 21/24] MIPS: ELF: Add more PC-relative relocation definitions Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 22/24] MIPS: vdso: Enable the vdsocheck tool Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 23/24] sparc: " Thomas Weißschuh
2026-09-08  6:33 ` [PATCH v5 24/24] vDSO: Automatically enable VDSO_CHECK Thomas Weißschuh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox