Re: [patch 8/8] x86/vdso: Implement __vdso_futex_robust_try_unlock()

From: Thomas Gleixner

Date: Tue Mar 17 2026 - 05:57:23 EST


On Tue, Mar 17 2026 at 08:25, Thomas Weißschuh wrote:
> On Mon, Mar 16, 2026 at 06:13:34PM +0100, Thomas Gleixner wrote:
>> +/*
>> + * Compat enabled kernels have to take the size bit into account to support the
>> + * mixed size use case of gaming emulators. Contrary to the kernel robust unlock
>> + * mechanism all of this does not test for the 32-bit modifier in 32-bit VDSOs
>> + * and in compat disabled kernels. User space can keep the pieces.
>> + */
>> +#if defined(CONFIG_X86_64) && !defined(BUILD_VDSO32_64)
>
> #ifndef __x86_64__ ?

#ifdef :)

Just had to double check and convince myself that __x86_64__ is set when
building for the X86_X32 ABI. Seems to work.

>> +uint32_t __vdso_futex_robust_try_unlock(uint32_t *lock, uint32_t tid, void *pop)
>
> While uint32_t is originally a userspace type, in the kernel it also pulls in
> other internal types which are problematic in the vDSO. __u32 from
> uapi/linux/types.h avoid this issue.

Sure.

>> --- a/arch/x86/entry/vdso/vdso64/vdsox32.lds.S
>> +++ b/arch/x86/entry/vdso/vdso64/vdsox32.lds.S
>> @@ -22,6 +22,12 @@ VERSION {
>> __vdso_getcpu;
>> __vdso_time;
>> __vdso_clock_getres;
>> +#ifdef CONFIG_FUTEX_ROBUST_UNLOCK
>> + __vdso_futex_robust_try_unlock;
>
>> + __vdso_futex_robust_try_unlock_cs_start;
>> + __vdso_futex_robust_try_unlock_cs_success;
>> + __vdso_futex_robust_try_unlock_cs_end;
>
> These three symbols are not meant to be used from outside the vDSO
> implementation, so they don't need to be exported by the linkerscripts.

You are right in principle and I had it differently in the first place
until I realized that exposing them is useful for debugging and
validation purposes.

As I pointed out in the cover letter you can use GDB to actually verify
the fixup magic. That makes it obviously possible to write a user space
selftest without requiring to decode the internals of the VDSO.

Due to my pretty limited userspace DSO knowledge that was the best I
came up with. If you have a better idea, please let me know.

Thanks,

tglx