Re: [PATCH] futex: Avoid reusing outdated pi_state.

From: Sebastian Andrzej Siewior
Date: Tue Jan 16 2024 - 09:46:43 EST


On 2024-01-16 14:08:12 [+0100], To Jiri Slaby wrote:
> --- a/kernel/futex/requeue.c
> +++ b/kernel/futex/requeue.c
> @@ -873,7 +873,7 @@ int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
> if (res)
> ret = (res < 0) ? res : 0;
>
> - futex_unqueue_pi(&q);
> + futex_unqueue_pi(&q, true);

This obviously needs the same change as futex_lock_pi() unless it is
okay to avoid the argument and remove it if it hasn't been removed. I
forgot that the requeue path has also signals & timeouts and so is
subject to the same problem.

Assuming we go that direction…

> spin_unlock(q.lock_ptr);
>
> if (ret == -EINTR) {

Sebastian