lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YE9dM6PB9ZpC8AfY@hirez.programming.kicks-ass.net>
Date:   Mon, 15 Mar 2021 14:12:19 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Davidlohr Bueso <dave@...olabs.net>
Cc:     tglx@...utronix.de, mingo@...hat.com, dvhart@...radead.org,
        linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH 1/2] futex: Fix irq mismatch in exit_pi_state_list()

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 <dbueso@...e.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?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ