Linux s390 Architecture development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	"Andy Lutomirski" <luto@kernel.org>,
	"Vincenzo Frascino" <vincenzo.frascino@arm.com>,
	"Kees Cook" <kees@kernel.org>, "Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Russell King" <linux@armlinux.org.uk>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Madhavan Srinivasan" <maddy@linux.ibm.com>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Nicholas Piggin" <npiggin@gmail.com>,
	"Huacai Chen" <chenhuacai@kernel.org>,
	"WANG Xuerui" <kernel@xen0n.name>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Sven Schnelle" <svens@linux.ibm.com>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Thomas Gleixner" <tglx@kernel.org>,
	"Christophe Leroy" <chleroy@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>,
	"Nicolas Schier" <nsc@kernel.org>
Cc: linux-mm@kvack.org, linux-s390@vger.kernel.org,
	linux-kbuild@vger.kernel.org, "Jan Stancek" <jstancek@redhat.com>,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>
Subject: Re: [PATCH v6 01/11] vdso: Add the vdsocheck tool
Date: Tue, 24 Nov 2026 13:52:59 +0000	[thread overview]
Message-ID: <sashiko-outbox-231255@kernel.org> (raw)
In-Reply-To: <20261123-vdso-absolute-reloc-v6-1-161e218dd217@linutronix.de>

Thank you for your contribution! Sashiko AI review found 6 potential
issues to consider:
- [Medium] vdso: vdsocheck uses Rust 1.87 APIs breaking 1.85.0 minimum
  version
- [Medium] vdso: unchecked slice in get_data_subslice() and SHT_NOBITS
  slicing
- [Medium] vdso: missing include/uapi in HOSTBINDGEN_FLAGS and + on
  host_rustlib
- [Medium] vdso: validate_linked_dso() rejects SHT_REL/SHT_RELA with
  R_*_NONE
- [Low] vdso: missing scripts_basic prerequisite on vdsocheck Makefile
  target
- [Low] vdso: vdsocheck main() prints errors to stdout instead of stderr
--

commit ba87ba62d5b7688443f8778322978989d53ab4f8
Author: Thomas Weißschuh <thomas.weissschuh@linutronix.de>

vdso: Add the vdsocheck tool

This commit adds a Rust host build tool, vdsocheck, along with Kbuild
rules to validate that vDSO object files and the linked vDSO shared object
do not contain invalid relocations.

[Severity: Low]
In Makefile (at the vdsocheck target, lines 1575-1577), does the vdsocheck
target need a dependency on scripts_basic?

Building bindings.rs, libbindings.rlib, and vdsocheck in
lib/vdso/check/Makefile uses if_changed_dep, which runs
scripts/basic/fixdep. In a parallel build from a clean tree (or via make
vdsocheck), vdsocheck can run before scripts_basic finishes and fail with a
missing fixdep binary.

[Severity: Medium]
In lib/vdso/check/Makefile (lines 18-24), can building bindings.rs fail
when the host lacks kernel UAPI headers or has an older
/usr/include/linux/elf-em.h?

tools/include/uapi/linux/elf.h includes <linux/types.h> (which includes
<asm-generic/int-ll64.h>) and <linux/elf-em.h>, which reside in
$(srctree)/include/uapi rather than $(srctree)/tools/include/uapi. Passing
only -I$(srctree)/tools/include/uapi in HOSTBINDGEN_FLAGS causes bindgen to
fall back to the host's /usr/include.

Also on line 24, the $(call if_changed_dep,host_rustlib) rule for
$(obj)/libbindings.rlib is missing a leading '+' prefix, so GNU Make closes
the jobserver file descriptors and rustc emits a jobserver warning that
fails the build under CONFIG_WERROR=y.

[Severity: Medium]
In lib/vdso/check/elf.rs, inside get_data_subslice() (lines 87-96) and
SectionHeaderIterator::next() (lines 355-374), can get_data_subslice()
panic on out-of-bounds slices or on SHT_NOBITS sections?

get_data_subslice() checks start.checked_add(size) for integer overflow,
but then directly indexes &data[start..end] without checking end <=
data.len(), panicking instead of returning Err(ParseError::IndexOutOfRange)
when a section or header extends past the end of the file. In addition,
SectionHeaderIterator::next() unconditionally calls get_data_subslice() for
every section header using sh_offset and sh_size. Because SHT_NOBITS
sections (such as .bss) occupy no space in the file, their sh_offset +
sh_size can legitimately exceed file_data.len() and trigger a panic. Using
data.get(start..end).ok_or(ParseError::IndexOutOfRange) and passing a size
of 0 when sh_type == bindings::SHT_NOBITS would avoid this.

[Severity: Medium]
In lib/vdso/check/elf.rs (SectionEntityIterator::new(), line 285) and
lib/vdso/check/vdsocheck.rs (main(), lines 134, 139, and 150), does this
fail to build on Rust 1.85.x and 1.86.x?

The minimum supported Rust version in Documentation/process/changes.rst is
1.85.0, and KBUILD_HOSTRUSTFLAGS passes -Zallow-features= to disallow
unstable features in host tools. However, usize::is_multiple_of() in
SectionEntityIterator::new() and OsStr::display() on the OsString values in
main() were only stabilized in Rust 1.87.0, causing E0658 compilation
errors on older supported compilers.

[Severity: Medium]
In lib/vdso/check/vdsocheck.rs (validate_linked_dso(), lines 78-92), does
validate_linked_dso() reject linked vDSOs that contain only R_*_NONE
relocations?

As noted in the comment above cmd_vdso_check in lib/vdso/Makefile.include
and in commit aff69273af61 ("vdso: Improve cmd_vdso_check to check all
dynamic relocations"), some GNU ld ports emit trailing R_*_NONE (type 0)
dynamic relocations in .rel.dyn or .rela.dyn, which the readelf fallback
explicitly filters out. validate_linked_dso() rejects any SHT_REL or
SHT_RELA section unconditionally without checking whether its entries are
all R_*_NONE.

[Severity: Low]
In lib/vdso/check/vdsocheck.rs (main(), lines 134, 139, and 150), should
these error messages use eprintln!() instead of println!()?

Silent kernel builds (make -s) redirect stdout of build commands to
/dev/null, so printing fatal errors to stdout hides the failure diagnostic.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-vdso-absolute-reloc-v6-0-161e218dd217@linutronix.de?part=1

  reply	other threads:[~2026-11-24 13:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-231255@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acme@redhat.com \
    --cc=agordeev@linux.ibm.com \
    --cc=alex.gaynor@gmail.com \
    --cc=alex@ghiti.fr \
    --cc=aliceryhl@google.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=borntraeger@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=chenhuacai@kernel.org \
    --cc=chleroy@kernel.org \
    --cc=dakr@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=gary@garyguo.net \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=johannes@sipsolutions.net \
    --cc=jstancek@redhat.com \
    --cc=justinstitt@google.com \
    --cc=kees@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lossin@kernel.org \
    --cc=luto@kernel.org \
    --cc=maddy@linux.ibm.com \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=mpe@ellerman.id.au \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=npiggin@gmail.com \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=peterz@infradead.org \
    --cc=richard@nod.at \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=svens@linux.ibm.com \
    --cc=tglx@kernel.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=tmgross@umich.edu \
    --cc=tsbogend@alpha.franken.de \
    --cc=vincenzo.frascino@arm.com \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox