Re: [PATCH] futex: Initialize futex_phash_new during fork().

From: André Almeida
Date: Mon Jun 23 2025 - 12:37:06 EST


Em 23/06/2025 05:34, Sebastian Andrzej Siewior escreveu:
During a hash resize operation the new private hash is stored in
mm_struct::futex_phash_new if the current hash can not be immediately
replaced.

The new hash must not be copied during fork() into the new task. Doing
so will lead to a double-free of the memory by the two tasks.

Initialize the mm_struct::futex_phash_new during fork().

Reported-by: Calvin Owens <calvin@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/aFBQ8CBKmRzEqIfS@xxxxxxxxxxxxx/
Tested-by: Calvin Owens <calvin@xxxxxxxxxx>
Fixes: bd54df5ea7cad ("futex: Allow to resize the private local hash")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>

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