All of lore.kernel.org
 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 04/11] arm64: vdso: Enable the vdsocheck tool
Date: Tue, 24 Nov 2026 13:53:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-231258@kernel.org> (raw)
In-Reply-To: <20261123-vdso-absolute-reloc-v6-4-161e218dd217@linutronix.de>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] arm64: vdso: missing EM_ARM relocations in
  allowed_relocations_for_machine()
- [Low] arm64: vdso32: missing $(vdsocheck) prerequisite for vdso.so.raw
  target
- [Low] vdso: vdsocheck: missing R_AARCH64_JUMP26 in
  allowed_relocations_for_machine()
- [Low] vdso: vdsocheck: rejection of R_*_NONE relocations in
  validate_linked_dso()
--

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

arm64: vdso: Enable the vdsocheck tool

This commit enables the vdsocheck tool on arm64 by selecting VDSO_CHECK,
updating the arm64 vDSO Makefile link rule, and adding allowed AArch64 object
file relocations to vdsocheck.

> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index b5a51b0ef9440..1caaf4737f027 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

[Severity: Medium]
Does selecting VDSO_CHECK break arm64 builds when CONFIG_COMPAT_VDSO and
CONFIG_RUST_IS_AVAILABLE are enabled?

Selecting VDSO_CHECK activates cmd_vdso_check in lib/vdso/Makefile.include for
arch/arm64/kernel/vdso32/ as well.  That directory compiles vgettimeofday.c
with -fPIC -march=armv8-a (and -mthumb by default under
CONFIG_THUMB2_COMPAT_VDSO).  When __arch_get_vdso_u_time_data() materializes
the address of vdso_u_time_data with Clang, or when the compiler emits
intra-object branches, vgettimeofday.o contains PC-relative ARMv8-A and
Thumb-2 relocations such as R_ARM_THM_MOVW_PREL_NC (49), R_ARM_THM_MOVT_PREL
(50), R_ARM_MOVW_PREL_NC (45), R_ARM_MOVT_PREL (46), R_ARM_THM_CALL (10),
R_ARM_THM_JUMP24 (30), R_ARM_CALL (28), and R_ARM_JUMP24 (29).

In lib/vdso/check/vdsocheck.rs, allowed_relocations_for_machine() only allows
R_ARM_NONE (0), R_ARM_REL32 (3), and R_ARM_PREL31 (42) for bindings::EM_ARM,
so vdsocheck rejects arch/arm64/kernel/vdso32/vgettimeofday.o with
ValidationError::InvalidRelocation.

> diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile
> index 7dec05dd33b70..9fac0e54097dc 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)

[Severity: Low]
Should $(obj)/vdso.so.raw in arch/arm64/kernel/vdso32/Makefile also list
$(vdsocheck) as a prerequisite?

arch/arm64/kernel/vdso32/Makefile runs $(cmd_vdso_check) via
$(call if_changed,vdsold_and_vdso_check), and cmd_vdsold already filters $^ to
%.lds and %.o, but without $(vdsocheck) in the target prerequisites Kbuild
will not re-run the check on the compat vDSO when vdsocheck is rebuilt.

[ ... ]

> diff --git a/lib/vdso/check/vdsocheck.rs b/lib/vdso/check/vdsocheck.rs
> index e28ee59a900dd..0d5ceaca34d7c 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(),

[Severity: Low]
Should the bindings::EM_AARCH64 list also allow 282 (R_AARCH64_JUMP26)?

R_AARCH64_CALL26 (283) covers 26-bit PC-relative BL calls, while tail-call
optimization or unconditional branches between functions in an object file
emit B instructions with R_AARCH64_JUMP26 (282), which would otherwise fail
validation with ValidationError::InvalidRelocation.

[Severity: Low]
Can validate_linked_dso() reject valid linked vDSOs when the linker emits
R_*_NONE dynamic relocations?

lib/vdso/Makefile.include notes that some GNU ld ports emit unneeded R_*_NONE
relocations and filters them out with grep -v _NONE when vdsocheck is not
used.  When vdsocheck is enabled, validate_linked_dso() rejects any
elf::Section::Rel or elf::Section::Rela section outright without ignoring
R_*_NONE entries.

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

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

Thread overview: 35+ 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 ` 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-24 13:52   ` sashiko-bot
2026-11-24 14:45     ` 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 03/11] ARM: vdso: " Thomas Weißschuh
2026-11-23 13:50   ` 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-23 13:50   ` Thomas Weißschuh
2026-11-24 13:53   ` sashiko-bot [this message]
2026-11-23 13:50 ` [PATCH v6 05/11] powerpc/vdso: " Thomas Weißschuh
2026-11-23 13:50   ` Thomas Weißschuh
2026-11-24 13:53   ` sashiko-bot
2026-11-25 19:19   ` Shivang Upadhyay
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   ` Thomas Weißschuh
2026-11-23 13:50 ` [PATCH v6 07/11] LoongArch: vDSO: " Thomas Weißschuh
2026-11-23 13:50   ` 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:50   ` Thomas Weißschuh
2026-11-23 13:51 ` [PATCH v6 09/11] MIPS: vdso: " Thomas Weißschuh
2026-11-23 13:51   ` 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   ` Thomas Weißschuh
2026-11-23 13:51 ` [PATCH v6 11/11] vDSO: Automatically enable VDSO_CHECK Thomas Weißschuh
2026-11-23 13:51   ` Thomas Weißschuh
2026-11-24 13:53   ` sashiko-bot
2026-11-24 13:53 ` [PATCH v6 00/11] vdso: Reject absolute relocations during build sashiko-bot

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-231258@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.