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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 15 May 2021 15:02:17 -0400
From:   Waiman Long <llong@...hat.com>
To:     qiang.zhang@...driver.com, peterz@...radead.org, mingo@...hat.com,
        will@...nel.org, boqun.feng@...il.com
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH] locking/mutex: clear MUTEX_FLAGS if wait_list is empty
 due to signal

On 5/14/21 10:30 PM, qiang.zhang@...driver.com wrote:
> From: Zqiang <qiang.zhang@...driver.com>
>
> Clear MUTEX_FLAGS when call mutex_lock_interruptible()
> interrupted by a signal and the lock->wait_list is empty.
>
> Signed-off-by: Zqiang <qiang.zhang@...driver.com>
> ---
>   kernel/locking/mutex.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
> index cb6b112ce155..4ac354ca092b 100644
> --- a/kernel/locking/mutex.c
> +++ b/kernel/locking/mutex.c
> @@ -1081,6 +1081,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
>   err:
>   	__set_current_state(TASK_RUNNING);
>   	mutex_remove_waiter(lock, &waiter, current);
> +	if (likely(list_empty(&lock->wait_list)))
> +		__mutex_clear_flag(lock, MUTEX_FLAGS);
>   err_early_kill:
>   	spin_unlock(&lock->wait_lock);
>   	debug_mutex_free_waiter(&waiter);

I can see that the error path is missing the flag clearing code. As 
Peter had said, you have to be more clear of what problem you are trying 
to fix. Do you have any reproducer? How often do you see this kind of 
problem?

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ