Re: [PATCH v5 12/24] vdso: Add the vdsocheck tool
From: H. Peter Anvin
Date: Wed Sep 09 2026 - 15:34:26 EST
On September 8, 2026 12:19:11 AM PDT, Peter Zijlstra <peterz@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx>
>> ---
>> 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?
It was going to happen, and now we'll have to suffer the instability of rust...