On Sun, Mar 14, 2021 at 10:02:23PM -0700, Davidlohr Bueso wrote:
> The pi_mutex->wait_lock is irq safe and needs to enable local
> interrupts upon unlocking, matching it's corresponding
> raw_spin_lock_irq().
> 
> Fixes: c74aef2d06a9f (futex: Fix pi_state->owner serialization)
> Signed-off-by: Davidlohr Bueso <dbu...@suse.de>
> ---
>  kernel/futex.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/futex.c b/kernel/futex.c
> index 475055715371..ded7af2ba87f 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -885,7 +885,7 @@ static void exit_pi_state_list(struct task_struct *curr)
>                */
>               if (head->next != next) {
>                       /* retain curr->pi_lock for the loop invariant */
> -                     raw_spin_unlock(&pi_state->pi_mutex.wait_lock);
> +                     raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
>                       spin_unlock(&hb->lock);
>                       put_pi_state(pi_state);
>                       continue;

This seems broken, afaict we own:

  &hb->lock
  &pi_state->pi_mutex.wait_lock
  &curr->pi_lock

And we're only releasing:

  &hb->lock
  &pi_state->pi_mutex.wait_lock

Which leaves us holding:

  &curr->pi_lock

which is also an IRQ safe lock, so enabling IRQs would be BAD.

Or am I reading this wrong?

Reply via email to