]> git.ipfire.org Git - thirdparty/linux.git/commit
futex: Initialize futex_phash_new during fork().
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 23 Jun 2025 08:34:08 +0000 (10:34 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 23 Jun 2025 12:50:37 +0000 (14:50 +0200)
commita24cc6ce1933eade12aa2b9859de0fcd2dac2c06
tree9c537c581261c9995b89e8cd77d4a8eb7c896bc0
parent86731a2a651e58953fc949573895f2fa6d456841
futex: Initialize futex_phash_new during fork().

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().

Closes: https://lore.kernel.org/all/aFBQ8CBKmRzEqIfS@mozart.vkv.me/
Fixes: bd54df5ea7cad ("futex: Allow to resize the private local hash")
Reported-by: Calvin Owens <calvin@wbinvd.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Calvin Owens <calvin@wbinvd.org>
Link: https://lkml.kernel.org/r/20250623083408.jTiJiC6_@linutronix.de
include/linux/futex.h