Re: [PATCH] futex: Initialize mm_struct::futex_ref on mm_init()

From: Borislav Petkov
Date: Sat Aug 30 2025 - 18:26:17 EST


On Sat, Aug 30, 2025 at 11:38:06PM +0200, Sebastian Andrzej Siewior wrote:
> mm_struct::futex_ref needs to be set to NULL during mm_init() to ensure
> that it is not copied during fork(). Reusing the previous pointer can
> lead to use-after-free which can trigger
>
> | WARNING: kernel/futex/core.c:1604 at futex_ref_rcu+0xe1/0xf0, CPU#2: swapper/2/0
>
> Initialize mm_struct::futex_ref on mm_init().
>
> Fixes: 1b708b38414d3 ("futex: Move futex_hash_free() back to __mmput()")

So this one is queued in locking/urgent and I guess I can fold this new one into
it so that that commit is whole and fixed.

And then leave it in that branch for one more week for some more testing...

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette