Re: [PATCH] futex: fix hb lock mismatch in futex_wait_requeue_pi() and CLONE_VFORK hash init

From: André Almeida

Date: Mon Sep 21 2026 - 18:49:37 EST


Hi Hui Peng,

Em 19/09/2026 19:17, Hui Peng escreveu:
Fix two issues in futex and fork initialization:

1. In futex_wait_requeue_pi(), if futex_wait_queue() returns with

I see an outdated comment with futex_wait_queue(), but I don't think this function exists anymore.

q.lock_ptr updated tohb2's lock after a requeue timeout or signal
race, unlocking the original hb1 lock instead of q.lock_ptr leaves
hb2 locked and unlocks an unheld spinlock. Always unlock via
q.lock_ptr.
2. In copy_mm() (kernel/fork.c), initialize mm->futex_phash properly
when cloning so private futex hash state is consistent across
CLONE_VFORK.


This part was already addressed:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b61b6f95d6722ddbbbd09e689fa41b55fd36f9a5

Fixes: e5c6828493b5 ("futex: Split out requeue")
Assisted-by: LLM

Please always double check in the current mainline code if the robots ideas are up to date.

Signed-off-by: Hui Peng <benquike@xxxxxxxxx>