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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181009121809.GG6248@arm.com>
Date:   Tue, 9 Oct 2018 13:18:10 +0100
From:   Will Deacon <will.deacon@....com>
To:     Lance Roy <ldr709@...il.com>
Cc:     linux-kernel@...r.kernel.org,
        "Paul E. McKenney" <paulmck@...ux.ibm.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH 12/16] locking/mutex: Replace spin_is_locked() with
 lockdep

On Tue, Oct 02, 2018 at 10:38:58PM -0700, Lance Roy wrote:
> lockdep_assert_held() is better suited to checking locking requirements,
> since it won't get confused when someone else holds the lock. This is
> also a step towards possibly removing spin_is_locked().
> 
> Signed-off-by: Lance Roy <ldr709@...il.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Will Deacon <will.deacon@....com>
> ---
>  kernel/locking/mutex-debug.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c
> index 9aa713629387..771d4ca96dda 100644
> --- a/kernel/locking/mutex-debug.c
> +++ b/kernel/locking/mutex-debug.c
> @@ -36,7 +36,7 @@ void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
>  
>  void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter)
>  {
> -	SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));
> +	lockdep_assert_held(&lock->wait_lock);
>  	DEBUG_LOCKS_WARN_ON(list_empty(&lock->wait_list));
>  	DEBUG_LOCKS_WARN_ON(waiter->magic != waiter);
>  	DEBUG_LOCKS_WARN_ON(list_empty(&waiter->list));
> @@ -51,7 +51,7 @@ void debug_mutex_free_waiter(struct mutex_waiter *waiter)
>  void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
>  			    struct task_struct *task)
>  {
> -	SMP_DEBUG_LOCKS_WARN_ON(!spin_is_locked(&lock->wait_lock));
> +	lockdep_assert_held(&lock->wait_lock);

I think it's a good idea to replace debug usage of spin_is_locked() with
calls to lockdep, but I wonder whether that means that DEBUG_MUTEXES should
select LOCKDEP so that we don't lose coverage?

What do you think?

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ