* [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
` (10 more replies)
0 siblings, 11 replies; 13+ 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] 13+ messages in thread
* [PATCH v6 01/11] vdso: Add the vdsocheck tool
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
@ 2026-11-23 13:50 ` Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 02/11] x86/vdso: Enable " Thomas Weißschuh
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ 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
All vDSO code needs to be completely position independent. Symbol
references are marked as hidden so the compiler emits PC-relative
relocations. However there are cases where the compiler may still
emit absolute relocations, as they are valid in regular PIC DSO code.
These would be resolved by the linker and will break at runtime.
This has been observed on arm64, see commit 0c314cda9325 ("arm64: vdso:
Work around invalid absolute relocations from GCC")
Introduce a tool to check for absolute relocations during the build,
as the current inline-shell logic is not expressive enough.
The check is done on the object files as the relocations will not exist
anymore in the final DSO. As there is no extension point for the
compilation of each object file, perform the validation in vdso_check.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
Makefile | 19 ++
lib/vdso/Kconfig | 5 +
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 | 154 ++++++++++++++
8 files changed, 729 insertions(+)
diff --git a/Makefile b/Makefile
index f895752d4b05..a3403066c1cf 100644
--- a/Makefile
+++ b/Makefile
@@ -1571,6 +1571,25 @@ vdso_install: export INSTALL_FILES = $(vdso-install-y)
vdso_install:
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.vdsoinst
+# ---------------------------------------------------------------------------
+# vDSO check
+
+ifdef CONFIG_RUST_IS_AVAILABLE
+ifdef CONFIG_VDSO_CHECK
+
+# Build the checker early.
+prepare: vdsocheck
+
+# If the architecture builds the vDSO early, make sure to be earlier.
+PHONY += vdso_prepare
+vdso_prepare: vdsocheck
+
+PHONY += vdsocheck
+vdsocheck:
+ $(Q)$(MAKE) $(build)=lib/vdso/check $@
+endif
+endif
+
# ---------------------------------------------------------------------------
# Tools
diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig
index 597f5f0f9681..559f5534831e 100644
--- a/lib/vdso/Kconfig
+++ b/lib/vdso/Kconfig
@@ -23,3 +23,8 @@ config VDSO_GETRANDOM
select VDSO_DATASTORE
help
Selected by architectures that support vDSO getrandom().
+
+config VDSO_CHECK
+ bool
+ help
+ Selected for architectures that are supported by the 'vdsocheck' program.
diff --git a/lib/vdso/Makefile b/lib/vdso/Makefile
index ac304def42d6..9932b43d5bac 100644
--- a/lib/vdso/Makefile
+++ b/lib/vdso/Makefile
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_VDSO_DATASTORE) += datastore.o
+
+obj-y += check/
diff --git a/lib/vdso/Makefile.include b/lib/vdso/Makefile.include
index cedbf15f8087..5528e548f02e 100644
--- a/lib/vdso/Makefile.include
+++ b/lib/vdso/Makefile.include
@@ -6,6 +6,12 @@ GENERIC_VDSO_DIR := $(dir $(GENERIC_VDSO_MK_PATH))
c-gettimeofday-$(CONFIG_GENERIC_GETTIMEOFDAY) := $(addprefix $(GENERIC_VDSO_DIR), gettimeofday.c)
c-getrandom-$(CONFIG_VDSO_GETRANDOM) := $(addprefix $(GENERIC_VDSO_DIR), getrandom.c)
+ifeq ($(CONFIG_RUST_IS_AVAILABLE)$(CONFIG_VDSO_CHECK),yy)
+vdsocheck := lib/vdso/check/vdsocheck
+else
+vdsocheck :=
+endif
+
# This cmd checks that the vdso library does not contain dynamic relocations.
# It has to be called after the linking of the vdso library and requires it
# as a parameter.
@@ -13,6 +19,14 @@ c-getrandom-$(CONFIG_VDSO_GETRANDOM) := $(addprefix $(GENERIC_VDSO_DIR), getrand
# As a workaround for some GNU ld ports which produce unneeded R_*_NONE
# dynamic relocations, ignore R_*_NONE.
quiet_cmd_vdso_check = VDSOCHK $@
+ifneq ($(vdsocheck),)
+ cmd_vdso_check = $(vdsocheck) $(filter %.o, $(real-prereqs)) $@
+else
cmd_vdso_check = if $(READELF) -rW $@ | grep -v _NONE | grep -q " R_\w*_"; \
then (echo >&2 "$@: dynamic relocations are not supported"; \
rm -f $@; /bin/false); fi
+endif
+
+# Variant of cmd_ld which does not try to link the vdsocheck tool.
+quiet_cmd_ld_vdso = VDSOLD $@
+ cmd_ld_vdso = $(LD) $(ld_flags) $(filter-out $(vdsocheck), $(real-prereqs)) -o $@
diff --git a/lib/vdso/check/.gitignore b/lib/vdso/check/.gitignore
new file mode 100644
index 000000000000..751be38f11f2
--- /dev/null
+++ b/lib/vdso/check/.gitignore
@@ -0,0 +1,3 @@
+/bindings.rs
+/libbindings.rlib
+/vdsocheck
diff --git a/lib/vdso/check/Makefile b/lib/vdso/check/Makefile
new file mode 100644
index 000000000000..98de42c6c0eb
--- /dev/null
+++ b/lib/vdso/check/Makefile
@@ -0,0 +1,34 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+quiet_cmd_host_bindgen = HOSTBINDGEN $@
+ cmd_host_bindgen = $(BINDGEN) $< -o $@ --depfile $(depfile) -- $(HOSTBINDGEN_FLAGS)
+
+quiet_cmd_host_rustlib = HOSTRUSTC L $@
+ cmd_host_rustlib = \
+ $(HOSTRUSTC) $(hostrust_flags) \
+ --emit=dep-info=$(depfile) --emit=link=$@ \
+ --crate-type rlib \
+ --crate-name $(patsubst %.rlib,%,$(notdir $@)) $<
+
+uapi-directory := $(srctree)/tools/include/uapi
+
+# bindings.rs will be generated in the build directory, but rustc can not use
+# source code from both the source and build directory together.
+# Compile the binding code into a library first.
+$(obj)/bindings.rs: HOSTBINDGEN_FLAGS := -I$(uapi-directory)
+$(obj)/bindings.rs: $(uapi-directory)/linux/elf.h FORCE
+ $(call if_changed_dep,host_bindgen)
+
+HOSTRUSTFLAGS_libbindings := -Amissing_docs -Anon-camel-case-types
+$(obj)/libbindings.rlib: $(obj)/bindings.rs FORCE
+ $(call if_changed_dep,host_rustlib)
+
+targets += bindings.rs libbindings.rlib
+
+hostprogs += vdsocheck
+vdsocheck-rust := y
+HOSTRUSTFLAGS_vdsocheck := --extern=bindings=$(obj)/libbindings.rlib
+$(obj)/vdsocheck: $(obj)/libbindings.rlib
+
+PHONY += vdsocheck
+vdsocheck: $(obj)/vdsocheck
diff --git a/lib/vdso/check/elf.rs b/lib/vdso/check/elf.rs
new file mode 100644
index 000000000000..520285d6fd10
--- /dev/null
+++ b/lib/vdso/check/elf.rs
@@ -0,0 +1,498 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#![allow(unreachable_pub)]
+
+use core::fmt;
+use core::iter::Iterator;
+use core::result::Result;
+use core::str;
+
+use ::bindings;
+
+#[derive(Debug, Copy, Clone)]
+enum ByteOrder {
+ LittleEndian,
+ BigEndian,
+}
+
+trait ToCpu {
+ fn to_cpu(self, byteorder: ByteOrder) -> Self;
+}
+
+macro_rules! declare_to_cpu {
+ ($t:ty) => {
+ impl ToCpu for $t {
+ fn to_cpu(self, byteorder: ByteOrder) -> Self {
+ match byteorder {
+ ByteOrder::LittleEndian => Self::from_le(self),
+ ByteOrder::BigEndian => Self::from_be(self),
+ }
+ }
+ }
+ };
+}
+
+declare_to_cpu!(u16);
+declare_to_cpu!(u32);
+declare_to_cpu!(u64);
+
+#[derive(Debug, Copy, Clone)]
+enum Class {
+ Elf32,
+ Elf64,
+}
+
+enum ClassAlternative<T32, T64> {
+ Elf32(T32),
+ Elf64(T64),
+}
+
+#[derive(Debug)]
+pub enum ParseError {
+ InvalidFileMagic([u8; 4]),
+ InvalidFileClass(u32),
+ InvalidFileByteOrder(u32),
+ InvalidSectionSize,
+ MissingStringTable,
+ StrtabIndexOutOfRange,
+ IndexOutOfRange,
+ StrtabInvalidData(str::Utf8Error),
+}
+
+pub type ParseResult<T> = Result<T, ParseError>;
+
+impl fmt::Display for ParseError {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ ParseError::InvalidFileMagic(m) => write!(f, "Invalid ELF magic {:?}", m),
+ ParseError::InvalidFileClass(c) => write!(f, "Invalid ELF class {}", c),
+ ParseError::InvalidFileByteOrder(b) => write!(f, "Invalid ELF byteorder {}", b),
+ ParseError::InvalidSectionSize => write!(f, "Invalid ELF section size"),
+ ParseError::MissingStringTable => write!(f, "Missing string table"),
+ ParseError::IndexOutOfRange => write!(f, "Index out of range"),
+ ParseError::StrtabIndexOutOfRange => write!(f, "String table index out of range"),
+ ParseError::StrtabInvalidData(e) => write!(f, "Invalid data in string table: {}", e),
+ }
+ }
+}
+
+fn read_from_bytes<T: Copy>(data: &[u8]) -> ParseResult<T> {
+ if data.len() < core::mem::size_of::<T>() {
+ Err(ParseError::IndexOutOfRange)?
+ }
+ let ptr = data.as_ptr() as *const T;
+ // SAFETY: `T` is `Copy` by the type constraints.
+ // `ptr` is valid as it is derived from the slice `data` above.
+ // `self.data.len()` being large enough is guaranteed by the runtime check above.
+ Ok(unsafe { ptr.read_unaligned() })
+}
+
+fn get_data_subslice(data: &[u8], offset: u64, size: u64) -> ParseResult<&[u8]> {
+ let start: usize = offset.try_into().map_err(|_| ParseError::IndexOutOfRange)?;
+ let size: usize = size.try_into().map_err(|_| ParseError::IndexOutOfRange)?;
+ let end = start.checked_add(size).ok_or(ParseError::IndexOutOfRange)?;
+
+ Ok(&data[start..end])
+}
+
+/// Representation of a complete ELF file.
+#[derive(Debug)]
+pub struct File<'a> {
+ byteorder: ByteOrder,
+ class: Class,
+ pub type_: u16,
+ pub machine: u16,
+ pub data: &'a [u8],
+ section_headers: SectionInfo<'a>,
+ section_names: StrtabSection<'a>,
+}
+
+impl<'a> File<'a> {
+ pub fn new_from_bytes(data: &'a [u8]) -> Result<Self, ParseError> {
+ const ELF_MAGIC: [u8; 4] = [
+ bindings::ELFMAG0 as u8,
+ bindings::ELFMAG1 as u8,
+ bindings::ELFMAG2 as u8,
+ bindings::ELFMAG3 as u8,
+ ];
+ let ehdr: bindings::elf32_hdr = read_from_bytes(data)?;
+
+ let magic = [
+ ehdr.e_ident[bindings::EI_MAG0 as usize],
+ ehdr.e_ident[bindings::EI_MAG1 as usize],
+ ehdr.e_ident[bindings::EI_MAG2 as usize],
+ ehdr.e_ident[bindings::EI_MAG3 as usize],
+ ];
+
+ if magic != ELF_MAGIC {
+ return Err(ParseError::InvalidFileMagic(magic));
+ }
+
+ let class = match ehdr.e_ident[bindings::EI_CLASS as usize] as u32 {
+ bindings::ELFCLASS32 => Class::Elf32,
+ bindings::ELFCLASS64 => Class::Elf64,
+ c => return Err(ParseError::InvalidFileClass(c)),
+ };
+
+ let byteorder = match ehdr.e_ident[bindings::EI_DATA as usize] as u32 {
+ bindings::ELFDATA2LSB => ByteOrder::LittleEndian,
+ bindings::ELFDATA2MSB => ByteOrder::BigEndian,
+ b => return Err(ParseError::InvalidFileByteOrder(b)),
+ };
+
+ let (type_, machine, shnum, shoff, shentsize, shstrndx) = match class {
+ Class::Elf32 => {
+ let ehdr: bindings::elf32_hdr = read_from_bytes(data)?;
+ (
+ ehdr.e_type.to_cpu(byteorder),
+ ehdr.e_machine.to_cpu(byteorder),
+ ehdr.e_shnum.to_cpu(byteorder),
+ ehdr.e_shoff.to_cpu(byteorder).into(),
+ ehdr.e_shentsize.to_cpu(byteorder),
+ ehdr.e_shstrndx.to_cpu(byteorder),
+ )
+ }
+ Class::Elf64 => {
+ let ehdr: bindings::elf64_hdr = read_from_bytes(data)?;
+ (
+ ehdr.e_type.to_cpu(byteorder),
+ ehdr.e_machine.to_cpu(byteorder),
+ ehdr.e_shnum.to_cpu(byteorder),
+ ehdr.e_shoff.to_cpu(byteorder),
+ ehdr.e_shentsize.to_cpu(byteorder),
+ ehdr.e_shstrndx.to_cpu(byteorder),
+ )
+ }
+ };
+
+ let section_headers = SectionInfo {
+ byteorder,
+ class,
+ entsize: shentsize.into(),
+ data: get_data_subslice(data, shoff, u64::from(shnum) * u64::from(shentsize))?,
+ name: "<section headers>",
+ };
+
+ let string_table = SectionHeaderIterator::new(§ion_headers, data)?
+ .nth(shstrndx.into())
+ .ok_or(ParseError::MissingStringTable)??;
+
+ let section_names = StrtabSection(SectionInfo {
+ name: "<section header names>",
+ byteorder,
+ class,
+ data: string_table.data,
+ entsize: string_table.entsize,
+ });
+
+ Ok(File {
+ byteorder,
+ class,
+ type_,
+ machine,
+ section_headers,
+ section_names,
+ data,
+ })
+ }
+
+ pub fn sections(&self) -> ParseResult<SectionIterator<'_>> {
+ Ok(SectionIterator {
+ file: self,
+ section_headers: SectionHeaderIterator::new(&self.section_headers, self.data)?,
+ })
+ }
+}
+
+/// High-level representation of an ELF section.
+#[derive(Clone, Debug)]
+pub struct SectionInfo<'a> {
+ byteorder: ByteOrder,
+ class: Class,
+ pub name: &'a str,
+ entsize: u64,
+ pub data: &'a [u8],
+}
+
+/// Typed high-level iterator over all sections in a `File`.
+#[derive(Debug)]
+pub enum Section<'a> {
+ Null(SectionInfo<'a>),
+ Rel(RelSection<'a>),
+ Rela(RelaSection<'a>),
+ Strtab(StrtabSection<'a>),
+ Unknown(SectionInfo<'a>),
+}
+
+impl<'a> Section<'a> {
+ pub fn info(&'a self) -> &'a SectionInfo<'a> {
+ match self {
+ Section::Null(info) | Section::Unknown(info) => info,
+ Section::Rel(rel) => &rel.0,
+ Section::Rela(rela) => &rela.0,
+ Section::Strtab(strtab) => &strtab.0,
+ }
+ }
+}
+
+pub struct SectionIterator<'a> {
+ file: &'a File<'a>,
+ section_headers: SectionHeaderIterator<'a, 'a>,
+}
+
+impl<'a> Iterator for SectionIterator<'a> {
+ type Item = ParseResult<Section<'a>>;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ self.section_headers.next().map(|header| {
+ let header = header?;
+ let info = SectionInfo {
+ byteorder: self.file.byteorder,
+ class: self.file.class,
+ name: self.file.section_names.entry(header.name)?,
+ entsize: header.entsize,
+ data: header.data,
+ };
+
+ Ok(match header.type_ {
+ bindings::SHT_NULL => Section::Null(info),
+ bindings::SHT_RELA => Section::Rela(RelaSection(info)),
+ bindings::SHT_REL => Section::Rel(RelSection(info)),
+ bindings::SHT_STRTAB => Section::Strtab(StrtabSection(info)),
+ _ => Section::Unknown(info),
+ })
+ })
+ }
+}
+
+/// Iterator over a section of data containing instances of type `T`.
+struct SectionEntityIterator<'a, T: Copy> {
+ data: &'a [u8],
+ byteorder: ByteOrder,
+ _phantom: core::marker::PhantomData<T>,
+}
+
+impl<'a, T: Copy> SectionEntityIterator<'a, T> {
+ const ENTITY_SIZE: usize = core::mem::size_of::<T>();
+
+ fn new(section: &'a SectionInfo<'a>) -> ParseResult<Self> {
+ let data = section.data;
+
+ if section.entsize != Self::ENTITY_SIZE as u64 {
+ return Err(ParseError::InvalidSectionSize);
+ }
+
+ if !data.len().is_multiple_of(Self::ENTITY_SIZE) {
+ return Err(ParseError::InvalidSectionSize);
+ }
+
+ Ok(Self {
+ data,
+ byteorder: section.byteorder,
+ _phantom: core::marker::PhantomData,
+ })
+ }
+}
+
+impl<'a, T: Copy> Iterator for SectionEntityIterator<'a, T> {
+ type Item = T;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ if self.data.len() != 0 {
+ let ptr = self.data.as_ptr() as *const T;
+ // SAFETY: `T` is `Copy` by the type constraints.
+ // `ptr` is valid as it is derived from the slice `data` above.
+ // `self.data.len()` being a multiple of `Self::ENTITY_SIZE` is
+ // guaranteed by `SectionEntityIterator::new`.
+ let entity: T = unsafe { ptr.read_unaligned() };
+ self.data = &self.data[Self::ENTITY_SIZE..];
+ Some(entity)
+ } else {
+ None
+ }
+ }
+}
+
+/// Class-independent representation of an entry in a section header table.
+#[derive(Debug)]
+struct SectionHeader<'a> {
+ name: u32,
+ type_: u32,
+ entsize: u64,
+ data: &'a [u8],
+}
+
+/// Iterator over the section header table.
+struct SectionHeaderIterator<'f: 'a, 'a>(
+ ClassAlternative<
+ SectionEntityIterator<'a, bindings::elf32_shdr>,
+ SectionEntityIterator<'a, bindings::elf64_shdr>,
+ >,
+ &'f [u8],
+);
+
+impl<'f: 'a, 'a> SectionHeaderIterator<'f, 'a> {
+ fn new(section: &'a SectionInfo<'a>, file_data: &'f [u8]) -> ParseResult<Self> {
+ Ok(Self(
+ match section.class {
+ Class::Elf32 => ClassAlternative::Elf32(SectionEntityIterator::new(section)?),
+ Class::Elf64 => ClassAlternative::Elf64(SectionEntityIterator::new(section)?),
+ },
+ file_data,
+ ))
+ }
+}
+
+impl<'f: 'a, 'a> Iterator for SectionHeaderIterator<'f, 'a> {
+ type Item = ParseResult<SectionHeader<'f>>;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ let file_data = self.1;
+
+ match &mut self.0 {
+ ClassAlternative::Elf32(iter) => iter.next().map(|n| {
+ Ok(SectionHeader {
+ name: n.sh_name.to_cpu(iter.byteorder).into(),
+ type_: n.sh_type.to_cpu(iter.byteorder).into(),
+ entsize: n.sh_entsize.to_cpu(iter.byteorder).into(),
+ data: get_data_subslice(
+ file_data,
+ n.sh_offset.to_cpu(iter.byteorder).into(),
+ n.sh_size.to_cpu(iter.byteorder).into(),
+ )?,
+ })
+ }),
+ ClassAlternative::Elf64(iter) => iter.next().map(|n| {
+ Ok(SectionHeader {
+ name: n.sh_name.to_cpu(iter.byteorder).into(),
+ type_: n.sh_type.to_cpu(iter.byteorder).into(),
+ entsize: n.sh_entsize.to_cpu(iter.byteorder).into(),
+ data: get_data_subslice(
+ file_data,
+ n.sh_offset.to_cpu(iter.byteorder).into(),
+ n.sh_size.to_cpu(iter.byteorder).into(),
+ )?,
+ })
+ }),
+ }
+ }
+}
+
+/// High-level interface to a SHT_STRTAB string table.
+#[derive(Debug)]
+pub struct StrtabSection<'a>(SectionInfo<'a>);
+
+impl<'a> StrtabSection<'a> {
+ pub fn entry(&'a self, index: u32) -> ParseResult<&'a str> {
+ let data = self.0.data;
+ let index = index as usize;
+
+ if index >= data.len() {
+ Err(ParseError::StrtabIndexOutOfRange)
+ } else {
+ let len = data[index..]
+ .iter()
+ .position(|b| *b == 0x00)
+ .ok_or(ParseError::StrtabIndexOutOfRange)?;
+ let s = str::from_utf8(&data[index..index + len])
+ .map_err(|e| ParseError::StrtabInvalidData(e))?;
+ Ok(s)
+ }
+ }
+}
+
+/// High-level interface to a SHT_REL relocation table.
+#[derive(Debug)]
+pub struct RelSection<'a>(SectionInfo<'a>);
+
+impl<'a> RelSection<'a> {
+ pub fn entries(&'a self) -> ParseResult<RelSectionIterator<'a>> {
+ RelSectionIterator::new(&self.0)
+ }
+}
+
+#[derive(Debug)]
+pub struct Rel {
+ pub type_: u32,
+}
+
+pub struct RelSectionIterator<'a>(
+ ClassAlternative<
+ SectionEntityIterator<'a, bindings::elf32_rel>,
+ SectionEntityIterator<'a, bindings::elf64_rel>,
+ >,
+);
+
+impl<'a> RelSectionIterator<'a> {
+ fn new(section: &'a SectionInfo<'a>) -> ParseResult<Self> {
+ Ok(Self(match section.class {
+ Class::Elf32 => ClassAlternative::Elf32(SectionEntityIterator::new(section)?),
+ Class::Elf64 => ClassAlternative::Elf64(SectionEntityIterator::new(section)?),
+ }))
+ }
+}
+
+impl<'a> Iterator for RelSectionIterator<'a> {
+ type Item = Rel;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ match &mut self.0 {
+ ClassAlternative::Elf32(iter) => iter.next().map(|n| {
+ let type_ = n.r_info.to_cpu(iter.byteorder) & 0xff;
+ Self::Item { type_ }
+ }),
+ ClassAlternative::Elf64(iter) => iter.next().map(|n| {
+ let type_ = n.r_info.to_cpu(iter.byteorder) as u32;
+ Self::Item { type_ }
+ }),
+ }
+ }
+}
+
+/// High-level interface to a SHT_RELA relocation table.
+#[derive(Debug)]
+pub struct RelaSection<'a>(SectionInfo<'a>);
+
+impl<'a> RelaSection<'a> {
+ pub fn entries(&'a self) -> ParseResult<RelaSectionIterator<'a>> {
+ RelaSectionIterator::new(&self.0)
+ }
+}
+
+#[derive(Debug)]
+pub struct Rela {
+ pub type_: u32,
+}
+
+pub struct RelaSectionIterator<'a>(
+ ClassAlternative<
+ SectionEntityIterator<'a, bindings::elf32_rela>,
+ SectionEntityIterator<'a, bindings::elf64_rela>,
+ >,
+);
+
+impl<'a> RelaSectionIterator<'a> {
+ fn new(section: &'a SectionInfo<'a>) -> ParseResult<Self> {
+ Ok(Self(match section.class {
+ Class::Elf32 => ClassAlternative::Elf32(SectionEntityIterator::new(section)?),
+ Class::Elf64 => ClassAlternative::Elf64(SectionEntityIterator::new(section)?),
+ }))
+ }
+}
+
+impl<'a> Iterator for RelaSectionIterator<'a> {
+ type Item = Rela;
+
+ fn next(&mut self) -> Option<Self::Item> {
+ match &mut self.0 {
+ ClassAlternative::Elf32(iter) => iter.next().map(|n| {
+ let type_ = n.r_info.to_cpu(iter.byteorder) & 0xff;
+ Self::Item { type_ }
+ }),
+ ClassAlternative::Elf64(iter) => iter.next().map(|n| {
+ let type_ = n.r_info.to_cpu(iter.byteorder) as u32;
+ Self::Item { type_ }
+ }),
+ }
+ }
+}
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
new file mode 100644
index 000000000000..f4c0730bc976
--- /dev/null
+++ b/lib/vdso/check/vdsocheck.rs
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0
+
+//! vDSO build-time validation
+//!
+//! Check that the vDSO library does not contain dynamic relocations.
+
+use std::default::Default;
+use std::fmt;
+use std::fs;
+use std::option::Option;
+use std::process;
+
+use ::bindings;
+
+mod elf;
+
+#[derive(Default)]
+struct AllowedRelocations<'a> {
+ ignored_object_file_sections: &'a [&'a str],
+ in_object_file: &'a [u32],
+}
+
+impl<'a> AllowedRelocations<'a> {
+ fn is_ignored_section(&self, section: &elf::Section<'_>) -> bool {
+ let name = section.info().name;
+
+ if name.starts_with(".rel.debug_") || name.starts_with(".rela.debug_") {
+ true
+ } else {
+ self.ignored_object_file_sections.contains(&name)
+ }
+ }
+}
+
+fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'static>> {
+ match machine as u32 {
+ _ => None,
+ }
+}
+
+#[derive(Debug)]
+enum ValidationError<'a> {
+ ParseError(elf::ParseError),
+ UnsupportedArchitecture(u16),
+ UnrecognizedElfFileType(u32),
+ UnexpectedSection(elf::Section<'a>),
+ InvalidRelocation(elf::Section<'a>, u32),
+}
+
+impl<'a> From<elf::ParseError> for ValidationError<'a> {
+ fn from(parse_error: elf::ParseError) -> Self {
+ Self::ParseError(parse_error)
+ }
+}
+
+impl fmt::Display for ValidationError<'_> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ match self {
+ ValidationError::ParseError(e) => write!(f, "Parsing error: {}", e),
+ ValidationError::UnsupportedArchitecture(n) => {
+ write!(f, "Unsupported ELF architecture {}", n)
+ }
+ ValidationError::UnrecognizedElfFileType(t) => {
+ write!(f, "Unrecognized ELF file type {}", t)
+ }
+ ValidationError::UnexpectedSection(ref s) => {
+ write!(f, "Unexpected section '{}'", s.info().name)
+ }
+ ValidationError::InvalidRelocation(ref s, t) => {
+ write!(f, "Invalid relocation {} in section '{}'", t, s.info().name)
+ }
+ }
+ }
+}
+
+type ValidationResult<'a> = Result<(), ValidationError<'a>>;
+
+fn validate_linked_dso<'a>(file: &'a elf::File<'a>) -> ValidationResult<'a> {
+ for section in file.sections()? {
+ let section = section?;
+
+ /* No relocations are allowed */
+ match section {
+ elf::Section::Rel(_) | elf::Section::Rela(_) => {
+ return Err(ValidationError::UnexpectedSection(section))
+ }
+ _ => {}
+ }
+ }
+
+ Ok(())
+}
+
+fn validate_object_file<'a>(file: &'a elf::File<'a>) -> ValidationResult<'a> {
+ let allowed_relocs = allowed_relocations_for_machine(file.machine)
+ .ok_or(ValidationError::UnsupportedArchitecture(file.machine))?;
+
+ for section in file.sections()? {
+ let section = section?;
+
+ if allowed_relocs.is_ignored_section(§ion) {
+ continue;
+ }
+
+ match section {
+ elf::Section::Rel(ref rel) => {
+ for entry in rel.entries()? {
+ if !allowed_relocs.in_object_file.contains(&entry.type_) {
+ return Err(ValidationError::InvalidRelocation(section, entry.type_));
+ }
+ }
+ }
+ elf::Section::Rela(ref rela) => {
+ for entry in rela.entries()? {
+ if !allowed_relocs.in_object_file.contains(&entry.type_) {
+ return Err(ValidationError::InvalidRelocation(section, entry.type_));
+ }
+ }
+ }
+ _ => {}
+ };
+ }
+
+ Ok(())
+}
+
+fn main() {
+ let mut args = std::env::args_os();
+
+ let program_name = args.next().unwrap_or("vdsocheck".into());
+
+ for path in args {
+ let data = fs::read(&path).unwrap_or_else(|err| {
+ println!("{}: {}: {}", program_name.display(), path.display(), err);
+ process::exit(1);
+ });
+
+ let file = elf::File::new_from_bytes(&data).unwrap_or_else(|err| {
+ println!("{}: {}: {}", program_name.display(), path.display(), err);
+ process::exit(2);
+ });
+
+ let result = match file.type_ as u32 {
+ bindings::ET_DYN => validate_linked_dso(&file),
+ bindings::ET_REL => validate_object_file(&file),
+ t => Err(ValidationError::UnrecognizedElfFileType(t)),
+ };
+
+ result.unwrap_or_else(|err| {
+ println!("{}: {}: {}", program_name.display(), path.display(), err);
+ process::exit(3);
+ });
+ }
+}
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 02/11] x86/vdso: Enable the vdsocheck tool
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-23 13:50 ` Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 03/11] ARM: vdso: " Thomas Weißschuh
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ 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 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 <thomas.weissschuh@linutronix.de>
---
arch/x86/Kconfig | 1 +
arch/x86/entry/vdso/common/Makefile.include | 2 +-
lib/vdso/check/vdsocheck.rs | 14 ++++++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 58dce0b66179..09d3aa04ee82 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -302,6 +302,7 @@ config X86
select HAVE_UNSTABLE_SCHED_CLOCK
select HAVE_UNWIND_USER_FP if X86_64
select HAVE_USER_RETURN_NOTIFIER
+ select VDSO_CHECK
select VDSO_GETRANDOM if X86_64
select HOTPLUG_PARALLEL if SMP && X86_64
select HOTPLUG_SMT if SMP
diff --git a/arch/x86/entry/vdso/common/Makefile.include b/arch/x86/entry/vdso/common/Makefile.include
index 687b3d89b40d..510d5e79857e 100644
--- a/arch/x86/entry/vdso/common/Makefile.include
+++ b/arch/x86/entry/vdso/common/Makefile.include
@@ -71,7 +71,7 @@ quiet_cmd_vdso = VDSO $@
quiet_cmd_vdso_and_check = VDSO $@
cmd_vdso_and_check = $(cmd_vdso); $(cmd_vdso_check)
-$(obj)/vdso%.so.dbg: $(obj)/vdso%.lds FORCE
+$(obj)/vdso%.so.dbg: $(obj)/vdso%.lds $(vdsocheck) FORCE
$(call if_changed,vdso_and_check)
$(obj)/%.so: OBJCOPYFLAGS := -S --remove-section __ex_table
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index f4c0730bc976..8cd8c7f3fec8 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -34,6 +34,20 @@ fn is_ignored_section(&self, section: &elf::Section<'_>) -> bool {
fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'static>> {
match machine as u32 {
+ bindings::EM_386 => AllowedRelocations {
+ in_object_file: &[
+ 2, /* R_386_PC32 */
+ 9, /* R_386_GOTOFF */
+ 10, /* R_386_GOTPC */
+ ],
+ ..Default::default()
+ }
+ .into(),
+ bindings::EM_X86_64 => AllowedRelocations {
+ in_object_file: &[2 /* R_X86_64_PC32 */, 4 /* R_X86_64_PLT32 */],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 03/11] ARM: vdso: Enable the vdsocheck tool
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-23 13:50 ` [PATCH v6 02/11] x86/vdso: Enable " Thomas Weißschuh
@ 2026-11-23 13:50 ` Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 04/11] arm64: " Thomas Weißschuh
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ 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 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 <thomas.weissschuh@linutronix.de>
---
arch/arm/mm/Kconfig | 1 +
arch/arm/vdso/Makefile | 4 ++--
lib/vdso/check/vdsocheck.rs | 9 +++++++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 41d7b495ec45..7f55ed37f464 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -943,6 +943,7 @@ config VDSO
depends on AEABI && MMU && CPU_V7
default y if ARM_ARCH_TIMER
select GENERIC_GETTIMEOFDAY
+ select VDSO_CHECK
help
Place in the process address space an ELF shared object
providing fast implementations of gettimeofday and
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index cf8cd39ab804..fd34d0ff018a 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -37,7 +37,7 @@ endif
$(obj)/vdso.o : $(obj)/vdso.so
# Link rule for the .so file
-$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) FORCE
+$(obj)/vdso.so.raw: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso.so.dbg: $(obj)/vdso.so.raw $(obj)/vdsomunge FORCE
@@ -50,7 +50,7 @@ $(obj)/%.so: $(obj)/%.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)
quiet_cmd_vdsomunge = MUNGE $@
cmd_vdsomunge = $(objtree)/$(obj)/vdsomunge $< $@
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index 8cd8c7f3fec8..e28ee59a900d 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -48,6 +48,15 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s
..Default::default()
}
.into(),
+ bindings::EM_ARM => AllowedRelocations {
+ in_object_file: &[
+ 0, /* R_ARM_NONE */
+ 3, /* R_ARM_REL32 */
+ 42, /* R_ARM_PREL31 */
+ ],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 04/11] arm64: vdso: Enable the vdsocheck tool
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
` (2 preceding siblings ...)
2026-11-23 13:50 ` [PATCH v6 03/11] ARM: vdso: " Thomas Weißschuh
@ 2026-11-23 13:50 ` Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 05/11] powerpc/vdso: " Thomas Weißschuh
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ 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 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 <thomas.weissschuh@linutronix.de>
---
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 1075bc661833..df22b4ed5e29 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 f6619e1cb2ce..5d8c34c7be51 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 e28ee59a900d..0d5ceaca34d7 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<'s
..Default::default()
}
.into(),
+ bindings::EM_AARCH64 => AllowedRelocations {
+ in_object_file: &[
+ 260, /* R_AARCH64_PREL64 */
+ 261, /* R_AARCH64_PREL32 */
+ 262, /* R_AARCH64_PREL16 */
+ 273, /* R_AARCH64_LD_PREL_LO19 */
+ 274, /* R_AARCH64_ADR_PREL_LO21 */
+ 283, /* R_AARCH64_CALL26 */
+ ],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 05/11] powerpc/vdso: Enable the vdsocheck tool
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
` (3 preceding siblings ...)
2026-11-23 13:50 ` [PATCH v6 04/11] arm64: " Thomas Weißschuh
@ 2026-11-23 13:50 ` Thomas Weißschuh
2026-11-25 19:19 ` Shivang Upadhyay
2026-11-23 13:50 ` [PATCH v6 06/11] riscv: vdso: " Thomas Weißschuh
` (5 subsequent siblings)
10 siblings, 1 reply; 13+ 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 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 <thomas.weissschuh@linutronix.de>
---
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 06/11] riscv: vdso: Enable the vdsocheck tool
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
` (4 preceding siblings ...)
2026-11-23 13:50 ` [PATCH v6 05/11] powerpc/vdso: " Thomas Weißschuh
@ 2026-11-23 13:50 ` Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 07/11] LoongArch: vDSO: " Thomas Weißschuh
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ 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 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 <thomas.weissschuh@linutronix.de>
---
arch/riscv/Kconfig | 1 +
arch/riscv/kernel/vdso/Makefile | 4 ++--
lib/vdso/check/vdsocheck.rs | 26 ++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index e7891a2a89da..2a0f5fbcd7e3 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -226,6 +226,7 @@ config RISCV
select THREAD_INFO_IN_TASK
select TRACE_IRQFLAGS_SUPPORT
select UACCESS_MEMCPY if !MMU
+ select VDSO_CHECK if MMU
select VDSO_DATASTORE if MMU
select VDSO_GETRANDOM if MMU && 64BIT
select USER_STACKTRACE_SUPPORT
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index c023046a3fd7..b15039d0309e 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -75,7 +75,7 @@ endif
$(obj)/$(vdso_o): $(obj)/$(vdso_so)
# 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_check)
LDFLAGS_$(vdso_so_dbg) = -shared -soname=linux-vdso.so.1 \
--build-id=sha1 --eh-frame-hdr
@@ -97,7 +97,7 @@ include/generated/$(vdso_offsets): $(obj)/$(vdso_so_dbg) FORCE
# The DSO images are built using a special linker script
# Make sure only to export the intended __vdso_xxx symbol offsets.
quiet_cmd_vdsold_and_check = VDSOLD $@
- cmd_vdsold_and_check = $(LD) $(CFI_FULL) $(ld_flags) -T $(filter-out FORCE,$^) -o $@.tmp && \
+ cmd_vdsold_and_check = $(LD) $(CFI_FULL) $(ld_flags) -T $(filter-out FORCE $(vdsocheck),$^) -o $@.tmp && \
$(OBJCOPY) $(patsubst %, -G __vdso_%, $(vdso-syms)) $@.tmp $@ && \
rm $@.tmp && \
$(cmd_vdso_check)
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index da58ff220eab..37455d326110 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -96,6 +96,32 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s
..Default::default()
}
.into(),
+ bindings::EM_RISCV => AllowedRelocations {
+ in_object_file: &[
+ 16, /* R_RISCV_BRANCH */
+ 17, /* R_RISCV_JAL */
+ 18, /* R_RISCV_CALL */
+ 19, /* R_RISCV_CALL_PLT */
+ 23, /* R_RISCV_PCREL_HI20 */
+ 24, /* R_RISCV_PCREL_LO12_I */
+ 25, /* R_RISCV_PCREL_LO12_S */
+ 33, /* R_RISCV_ADD8 */
+ 34, /* R_RISCV_ADD16 */
+ 35, /* R_RISCV_ADD32 */
+ 36, /* R_RISCV_ADD64 */
+ 37, /* R_RISCV_SUB8 */
+ 38, /* R_RISCV_SUB16 */
+ 39, /* R_RISCV_SUB32 */
+ 40, /* R_RISCV_SUB64 */
+ 43, /* R_RISCV_ALIGN */
+ 44, /* R_RISCV_RVC_BRANCH */
+ 45, /* R_RISCV_RVC_JUMP */
+ 51, /* R_RISCV_RELAX */
+ 57, /* R_RISCV_32_PCREL */
+ ],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 07/11] LoongArch: vDSO: Enable the vdsocheck tool
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
` (5 preceding siblings ...)
2026-11-23 13:50 ` [PATCH v6 06/11] riscv: vdso: " Thomas Weißschuh
@ 2026-11-23 13:50 ` Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 08/11] s390/vdso: " Thomas Weißschuh
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ 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 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 <thomas.weissschuh@linutronix.de>
---
arch/loongarch/Kconfig | 1 +
arch/loongarch/vdso/Makefile | 4 ++--
lib/vdso/check/vdsocheck.rs | 26 ++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index b5ed4881d3c0..ad4cafeddbb8 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -211,6 +211,7 @@ config LOONGARCH
select TRACE_IRQFLAGS_SUPPORT
select USE_PERCPU_NUMA_NODE_ID
select USER_STACKTRACE_SUPPORT
+ select VDSO_CHECK
select VDSO_DATASTORE
select VDSO_GETRANDOM
select ZONE_DMA32 if 64BIT
diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
index 0b84892d084b..ad54383b1908 100644
--- a/arch/loongarch/vdso/Makefile
+++ b/arch/loongarch/vdso/Makefile
@@ -51,7 +51,7 @@ ldflags-y := -Bsymbolic --no-undefined -soname=linux-vdso.so.1 \
#
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)
quiet_cmd_vdsoas_o_S = AS $@
cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $<
@@ -80,7 +80,7 @@ $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)
$(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)
-$(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)
$(obj)/vdso.so: OBJCOPYFLAGS := -S
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index 37455d326110..7952ad6ba72b 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -122,6 +122,32 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s
..Default::default()
}
.into(),
+ bindings::EM_LOONGARCH => AllowedRelocations {
+ in_object_file: &[
+ 47, /* R_LARCH_ADD8 */
+ 48, /* R_LARCH_ADD16 */
+ 49, /* R_LARCH_ADD24 */
+ 50, /* R_LARCH_ADD32 */
+ 51, /* R_LARCH_ADD64 */
+ 52, /* R_LARCH_SUB8 */
+ 53, /* R_LARCH_SUB16 */
+ 54, /* R_LARCH_SUB24 */
+ 55, /* R_LARCH_SUB32 */
+ 56, /* R_LARCH_SUB64 */
+ 64, /* R_LARCH_B16 */
+ 65, /* R_LARCH_B21 */
+ 66, /* R_LARCH_B26 */
+ 71, /* R_LARCH_PCALA_HI20 */
+ 72, /* R_LARCH_PCALA_LO12 */
+ 73, /* R_LARCH_PCALA64_LO20 */
+ 74, /* R_LARCH_PCALA64_HI12 */
+ 99, /* R_LARCH_32_PCREL */
+ 128, /* R_LARCH_PCADD_HI20 */
+ 128, /* R_LARCH_PCADD_LO12 */
+ ],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 08/11] s390/vdso: Enable the vdsocheck tool
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
` (6 preceding siblings ...)
2026-11-23 13:50 ` [PATCH v6 07/11] LoongArch: vDSO: " Thomas Weißschuh
@ 2026-11-23 13:50 ` Thomas Weißschuh
2026-11-23 13:51 ` [PATCH v6 09/11] MIPS: vdso: " Thomas Weißschuh
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ 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 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 <thomas.weissschuh@linutronix.de>
---
arch/s390/Kconfig | 1 +
arch/s390/kernel/vdso/Makefile | 4 ++--
lib/vdso/check/vdsocheck.rs | 9 +++++++++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 7138d923d86f..71a614832886 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -289,6 +289,7 @@ config S390
select TRACE_IRQFLAGS_SUPPORT
select TTY
select USER_STACKTRACE_SUPPORT
+ select VDSO_CHECK
select VDSO_GETRANDOM
select VIRT_CPU_ACCOUNTING
select VMAP_STACK
diff --git a/arch/s390/kernel/vdso/Makefile b/arch/s390/kernel/vdso/Makefile
index 54bcf2984ca1..6bc2b7bffd89 100644
--- a/arch/s390/kernel/vdso/Makefile
+++ b/arch/s390/kernel/vdso/Makefile
@@ -45,10 +45,10 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
$(obj)/vdso_wrapper.o : $(obj)/vdso.so
quiet_cmd_vdso_and_check = VDSO $@
- cmd_vdso_and_check = $(cmd_ld); $(cmd_vdso_check)
+ cmd_vdso_and_check = $(cmd_ld_vdso); $(cmd_vdso_check)
# link rule for the .so file, .lds has to be first
-$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(obj-cvdso) FORCE
+$(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(obj-cvdso) $(vdsocheck) FORCE
$(call if_changed,vdso_and_check)
# strip rule for the .so file
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index 7952ad6ba72b..1ef3f240f886 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -148,6 +148,15 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s
..Default::default()
}
.into(),
+ bindings::EM_S390 => AllowedRelocations {
+ in_object_file: &[
+ 5, /* R_390_PC32 */
+ 19, /* R_390_PC32DBL */
+ 20, /* R_390_PLT32DBL */
+ ],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 09/11] MIPS: vdso: Enable the vdsocheck tool
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
` (7 preceding siblings ...)
2026-11-23 13:50 ` [PATCH v6 08/11] s390/vdso: " Thomas Weißschuh
@ 2026-11-23 13:51 ` Thomas Weißschuh
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
10 siblings, 0 replies; 13+ messages in thread
From: Thomas Weißschuh @ 2026-11-23 13:51 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 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 <thomas.weissschuh@linutronix.de>
---
arch/mips/Kconfig | 1 +
arch/mips/vdso/Makefile | 8 ++++----
lib/vdso/check/vdsocheck.rs | 15 +++++++++++++++
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index ed17c9b1624c..31c247c2faeb 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -106,6 +106,7 @@ config MIPS
select TRACE_IRQFLAGS_SUPPORT
select ARCH_HAS_ELFCORE_COMPAT
select HAVE_ARCH_KCSAN if 64BIT
+ select VDSO_CHECK
config MIPS_FIXUP_BIGPHYS_ADDR
bool
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile
index 00d3ba2c482a..63060057cd21 100644
--- a/arch/mips/vdso/Makefile
+++ b/arch/mips/vdso/Makefile
@@ -66,7 +66,7 @@ quiet_cmd_vdso_mips_check = VDSOCHK $@
#
quiet_cmd_vdsold_and_vdso_check = LD $@
- cmd_vdsold_and_vdso_check = $(cmd_ld); $(cmd_vdso_check); $(cmd_vdso_mips_check)
+ cmd_vdsold_and_vdso_check = $(cmd_ld_vdso); $(cmd_vdso_check); $(cmd_vdso_mips_check)
quiet_cmd_vdsoas_o_S = AS $@
cmd_vdsoas_o_S = $(CC) $(a_flags) -c -o $@ $<
@@ -103,7 +103,7 @@ $(obj-vdso): KBUILD_AFLAGS := $(aflags-vdso) $(native-abi)
$(obj)/vdso.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) $(native-abi)
-$(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) FORCE
+$(obj)/vdso.so.dbg.raw: $(obj)/vdso.lds $(obj-vdso) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso-image.c: $(obj)/vdso.so.dbg.raw $(obj)/vdso.so.raw \
@@ -141,7 +141,7 @@ $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32
$(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
-$(obj)/vdso-o32.so.dbg.raw: $(obj)/vdso-o32.lds $(obj-vdso-o32) FORCE
+$(obj)/vdso-o32.so.dbg.raw: $(obj)/vdso-o32.lds $(obj-vdso-o32) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso-o32-image.c: VDSO_NAME := o32
@@ -181,7 +181,7 @@ $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32
$(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
-$(obj)/vdso-n32.so.dbg.raw: $(obj)/vdso-n32.lds $(obj-vdso-n32) FORCE
+$(obj)/vdso-n32.so.dbg.raw: $(obj)/vdso-n32.lds $(obj-vdso-n32) $(vdsocheck) FORCE
$(call if_changed,vdsold_and_vdso_check)
$(obj)/vdso-n32-image.c: VDSO_NAME := n32
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index 1ef3f240f886..120d8fa551e6 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -157,6 +157,21 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s
..Default::default()
}
.into(),
+ bindings::EM_MIPS => AllowedRelocations {
+ ignored_object_file_sections: &[".rel.pdr", ".rela.pdr"],
+ in_object_file: &[
+ 10, /* R_MIPS_PC16 */
+ 60, /* R_MIPS_PC21_S2 */
+ 61, /* R_MIPS_PC26_S2 */
+ 62, /* R_MIPS_PC18_S3 */
+ 63, /* R_MIPS_PC19_S2 */
+ 64, /* R_MIPS_PCHI16 */
+ 65, /* R_MIPS_PCLO16 */
+ 248, /* R_MIPS_PC32 */
+ ],
+ ..Default::default()
+ }
+ .into(),
_ => None,
}
}
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 10/11] sparc: vdso: Enable the vdsocheck tool
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
` (8 preceding siblings ...)
2026-11-23 13:51 ` [PATCH v6 09/11] MIPS: vdso: " Thomas Weißschuh
@ 2026-11-23 13:51 ` Thomas Weißschuh
2026-11-23 13:51 ` [PATCH v6 11/11] vDSO: Automatically enable VDSO_CHECK Thomas Weißschuh
10 siblings, 0 replies; 13+ messages in thread
From: Thomas Weißschuh @ 2026-11-23 13:51 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 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 <thomas.weissschuh@linutronix.de>
---
arch/sparc/Kconfig | 1 +
arch/sparc/vdso/Makefile | 5 +++--
lib/vdso/check/vdsocheck.rs | 7 +++++++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 742ffff8c37f..90df77235184 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -114,6 +114,7 @@ config SPARC64
select ARCH_SUPPORTS_SCHED_SMT if SMP
select ARCH_SUPPORTS_SCHED_MC if SMP
select ARCH_HAS_LAZY_MMU_MODE
+ select VDSO_CHECK
select GENERIC_GETTIMEOFDAY
config ARCH_PROC_KCORE_TEXT
diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile
index 83fb2aca59cb..8bb235c3a618 100644
--- a/arch/sparc/vdso/Makefile
+++ b/arch/sparc/vdso/Makefile
@@ -28,7 +28,7 @@ CPPFLAGS_vdso.lds += -P -C
VDSO_LDFLAGS_vdso.lds = -m elf64_sparc -soname linux-vdso.so.1 \
-z max-page-size=8192
-$(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
+$(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) $(vdsocheck) FORCE
$(call if_changed,vdso)
HOST_EXTRACFLAGS += -I$(srctree)/tools/include
@@ -99,7 +99,8 @@ $(obj)/vdso32.so.dbg: CHECKFLAGS = $(CHECKFLAGS_32)
$(obj)/vdso32.so.dbg: FORCE \
$(obj)/vdso32/vdso32.lds \
$(obj)/vdso32/vclock_gettime.o \
- $(obj)/vdso32/vdso-note.o
+ $(obj)/vdso32/vdso-note.o \
+ $(vdsocheck)
$(call if_changed,vdso)
#
diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
index 120d8fa551e6..245d8af9f704 100644
--- a/lib/vdso/check/vdsocheck.rs
+++ b/lib/vdso/check/vdsocheck.rs
@@ -172,6 +172,13 @@ fn allowed_relocations_for_machine(machine: u16) -> Option<AllowedRelocations<'s
..Default::default()
}
.into(),
+ bindings::EM_SPARC | bindings::EM_SPARC32PLUS | bindings::EM_SPARCV9 => {
+ AllowedRelocations {
+ in_object_file: &[6 /* R_SPARC_DISP32 */],
+ ..Default::default()
+ }
+ .into()
+ }
_ => None,
}
}
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 11/11] vDSO: Automatically enable VDSO_CHECK
2026-11-23 13:50 [PATCH v6 00/11] vdso: Reject absolute relocations during build Thomas Weißschuh
` (9 preceding siblings ...)
2026-11-23 13:51 ` [PATCH v6 10/11] sparc: " Thomas Weißschuh
@ 2026-11-23 13:51 ` Thomas Weißschuh
10 siblings, 0 replies; 13+ messages in thread
From: Thomas Weißschuh @ 2026-11-23 13:51 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
All architectures using the generic vDSO library should enable
VDSO_CHECK. Now that this is the case, enable VDSO_CHECK automatically.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
arch/arm/mm/Kconfig | 1 -
arch/arm64/Kconfig | 1 -
arch/loongarch/Kconfig | 1 -
arch/mips/Kconfig | 1 -
arch/powerpc/Kconfig | 1 -
arch/riscv/Kconfig | 1 -
arch/s390/Kconfig | 1 -
arch/sparc/Kconfig | 1 -
arch/x86/Kconfig | 1 -
lib/vdso/Kconfig | 2 ++
10 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 7f55ed37f464..41d7b495ec45 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -943,7 +943,6 @@ config VDSO
depends on AEABI && MMU && CPU_V7
default y if ARM_ARCH_TIMER
select GENERIC_GETTIMEOFDAY
- select VDSO_CHECK
help
Place in the process address space an ELF shared object
providing fast implementations of gettimeofday and
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index df22b4ed5e29..1075bc661833 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -258,7 +258,6 @@ 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/loongarch/Kconfig b/arch/loongarch/Kconfig
index ad4cafeddbb8..b5ed4881d3c0 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -211,7 +211,6 @@ config LOONGARCH
select TRACE_IRQFLAGS_SUPPORT
select USE_PERCPU_NUMA_NODE_ID
select USER_STACKTRACE_SUPPORT
- select VDSO_CHECK
select VDSO_DATASTORE
select VDSO_GETRANDOM
select ZONE_DMA32 if 64BIT
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 31c247c2faeb..ed17c9b1624c 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -106,7 +106,6 @@ config MIPS
select TRACE_IRQFLAGS_SUPPORT
select ARCH_HAS_ELFCORE_COMPAT
select HAVE_ARCH_KCSAN if 64BIT
- select VDSO_CHECK
config MIPS_FIXUP_BIGPHYS_ADDR
bool
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 1c4a75c3a830..c3b6cd655606 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -327,7 +327,6 @@ 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/riscv/Kconfig b/arch/riscv/Kconfig
index 2a0f5fbcd7e3..e7891a2a89da 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -226,7 +226,6 @@ config RISCV
select THREAD_INFO_IN_TASK
select TRACE_IRQFLAGS_SUPPORT
select UACCESS_MEMCPY if !MMU
- select VDSO_CHECK if MMU
select VDSO_DATASTORE if MMU
select VDSO_GETRANDOM if MMU && 64BIT
select USER_STACKTRACE_SUPPORT
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 71a614832886..7138d923d86f 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -289,7 +289,6 @@ config S390
select TRACE_IRQFLAGS_SUPPORT
select TTY
select USER_STACKTRACE_SUPPORT
- select VDSO_CHECK
select VDSO_GETRANDOM
select VIRT_CPU_ACCOUNTING
select VMAP_STACK
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 90df77235184..742ffff8c37f 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -114,7 +114,6 @@ config SPARC64
select ARCH_SUPPORTS_SCHED_SMT if SMP
select ARCH_SUPPORTS_SCHED_MC if SMP
select ARCH_HAS_LAZY_MMU_MODE
- select VDSO_CHECK
select GENERIC_GETTIMEOFDAY
config ARCH_PROC_KCORE_TEXT
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 09d3aa04ee82..58dce0b66179 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -302,7 +302,6 @@ config X86
select HAVE_UNSTABLE_SCHED_CLOCK
select HAVE_UNWIND_USER_FP if X86_64
select HAVE_USER_RETURN_NOTIFIER
- select VDSO_CHECK
select VDSO_GETRANDOM if X86_64
select HOTPLUG_PARALLEL if SMP && X86_64
select HOTPLUG_SMT if SMP
diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig
index 559f5534831e..741de1abe923 100644
--- a/lib/vdso/Kconfig
+++ b/lib/vdso/Kconfig
@@ -6,6 +6,7 @@ config VDSO_DATASTORE
config GENERIC_GETTIMEOFDAY
bool
select VDSO_DATASTORE
+ select VDSO_CHECK
help
This is a generic implementation of gettimeofday vdso.
Each architecture that enables this feature has to
@@ -21,6 +22,7 @@ config GENERIC_VDSO_OVERFLOW_PROTECT
config VDSO_GETRANDOM
bool
select VDSO_DATASTORE
+ select VDSO_CHECK
help
Selected by architectures that support vDSO getrandom().
--
2.56.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 05/11] powerpc/vdso: Enable the vdsocheck tool
2026-11-23 13:50 ` [PATCH v6 05/11] powerpc/vdso: " Thomas Weißschuh
@ 2026-11-25 19:19 ` Shivang Upadhyay
0 siblings, 0 replies; 13+ messages in thread
From: Shivang Upadhyay @ 2026-11-25 19:19 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: 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, 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
On Mon, Nov 23, 2026 at 02:50:56PM +0100, Thomas Weißschuh wrote:
> + 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 */
> + ],
Seems to excluise list of all reletive relocations.
I only could find the following being actually used, for defconfig ppc64le.
But good to have all there.
[root@system vdso]# for i in `ls *.o`; do objdump -r -SD $i | grep -oP 'R_PPC\w*' ; done | sort | uniq
R_PPC64_REL16_HA
R_PPC64_REL16_LO
R_PPC64_REL24
R_PPC64_REL32
R_PPC64_REL64
[root@system vdso]#
Looks good. Feel free to add,
Reviewed-by: Shivang Upadhyay <shivangu@linux.ibm.com>
~Shivang.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-11-25 19:21 UTC | newest]
Thread overview: 13+ 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-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-23 13:50 ` [PATCH v6 04/11] arm64: " Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 05/11] powerpc/vdso: " Thomas Weißschuh
2026-11-25 19:19 ` Shivang Upadhyay
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-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-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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®