Re: [patch V4 09/14] futex: Add robust futex unlock IP range

From: André Almeida

Date: Wed May 27 2026 - 21:03:27 EST


Em 02/04/2026 12:21, Thomas Gleixner escreveu:
There will be a VDSO function to unlock robust futexes in user space. The
unlock sequence is racy vs. clearing the list_pending_op pointer in the
tasks robust list head. To plug this race the kernel needs to know the
instruction window. As the VDSO is per MM the addresses are stored in
mm_struct::futex.

Architectures which implement support for this have to update these
addresses when the VDSO is (re)mapped and indicate the pending op pointer
size which is matching the IP.

Arguably this could be resolved by chasing mm->context->vdso->image, but
that's architecture specific and requires to touch quite some cache
lines. Having it in mm::futex reduces the cache line impact and avoids
having yet another set of architecture specific functionality.

To support multi size robust list applications (gaming) this provides two
ranges when COMPAT is enabled.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxx>

[...]

+void futex_reset_cs_ranges(struct futex_mm_data *fd);
+
+static inline void futex_set_vdso_cs_range(struct futex_mm_data *fd, unsigned int idx,
+ unsigned long vdso, unsigned long start,
+ unsigned long end, bool sz32)
+{
+ fd->unlock.cs_ranges[idx].start_ip = vdso + start;
+ fd->unlock.cs_ranges[idx].len = end - start;
+ fd->unlock.cs_ranges[idx].pop_size32 = sz32;
+}

Can we have the "vdso +" done by the caller? VDSO_SYMBOL() that I used for aarch64 adds the base address as well, see here: https://lore.kernel.org/lkml/f8e83a24-0b04-4c88-9f67-0879875be25c@xxxxxxxx/

Apart from that:
Reviewed-by: André Almeida <andrealmeid@xxxxxxxxxx>