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]
Date:	Wed, 03 Sep 2014 10:50:01 -0400
From:	Peter Hurley <peter@...leysoftware.com>
To:	Peter Zijlstra <peterz@...radead.org>
CC:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jiri Slaby <jslaby@...e.cz>,
	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
	linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 13/26] locking: Add non-fatal spin lock assert

On 09/03/2014 10:40 AM, Peter Zijlstra wrote:
> On Wed, Sep 03, 2014 at 07:20:04AM -0400, Peter Hurley wrote:
>> Hi Peter,
>>
>> On 09/03/2014 05:27 AM, Peter Zijlstra wrote:
>>> On Tue, Sep 02, 2014 at 05:39:22PM -0400, Peter Hurley wrote:
>>>> Provide method for non-essential or non-critical code to warn of
>>>> invariant errors.
>>>>
>>>> CC: Ingo Molnar <mingo@...nel.org>
>>>> CC: Peter Zijlstra <peterz@...radead.org>
>>>> CC: Thomas Gleixner <tglx@...utronix.de>
>>>> Signed-off-by: Peter Hurley <peter@...leysoftware.com>
>>>> ---
>>>>  include/linux/spinlock.h         | 1 +
>>>>  include/linux/spinlock_api_smp.h | 1 +
>>>>  include/linux/spinlock_api_up.h  | 1 +
>>>>  3 files changed, 3 insertions(+)
>>>>
>>>> diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
>>>> index 3f2867f..8a9aaf1 100644
>>>> --- a/include/linux/spinlock.h
>>>> +++ b/include/linux/spinlock.h
>>>> @@ -394,6 +394,7 @@ static inline int spin_can_lock(spinlock_t *lock)
>>>>  }
>>>>  
>>>>  #define assert_spin_locked(lock)	assert_raw_spin_locked(&(lock)->rlock)
>>>> +#define warn_not_spin_locked(lock)	warn_not_raw_spin_locked(&(lock)->rlock)
>>>>  
>>>>  /*
>>>>   * Pull the atomic_t declaration:
>>>> diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
>>>> index 42dfab8..0ddd499 100644
>>>> --- a/include/linux/spinlock_api_smp.h
>>>> +++ b/include/linux/spinlock_api_smp.h
>>>> @@ -18,6 +18,7 @@
>>>>  int in_lock_functions(unsigned long addr);
>>>>  
>>>>  #define assert_raw_spin_locked(x)	BUG_ON(!raw_spin_is_locked(x))
>>>> +#define warn_not_raw_spin_locked(x)	WARN_ON_ONCE(!raw_spin_is_locked(x))
>>>
>>> No we should remove assert_spin_locked() not add to it. Use
>>> lockdep_assert_held() instead.
>>
>> I probably should have been more descriptive in the changelog: this
>> is not for a test configuration, but rather, an assertion in an
>> exported api.
> 
> So ?

So a lockdep-only assert is unlikely to draw attention to existing bugs,
especially in established drivers.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ