[PATCH v5 12/24] vdso: Add the vdsocheck tool

Peter Zijlstra peterz at infradead.org
Tue Sep 8 00:37:07 PDT 2026


On Tue, Sep 08, 2026 at 09:35:46AM +0200, Thomas Weißschuh wrote:
> On Tue, Sep 08, 2026 at 09:19:11AM +0200, Peter Zijlstra wrote:
> > On Tue, Sep 08, 2026 at 08:33:46AM +0200, Thomas Weißschuh wrote:
> > > 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 at 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(+)
> > 
> > Urgh, does this mean I have to have rust installed just to build a
> > kernel now?
> 
> No.
> 
> If you don't have rust installed the build will instead use the existing shell
> script for a less thorough check. We only need one build machine at some point
> to have rust installed to report issues and this check to be useful.

Ah, *phew*. Thanks!



More information about the linux-riscv mailing list