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: <20260123111523.GO171111@noisy.programming.kicks-ass.net>
Date: Fri, 23 Jan 2026 12:15:23 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Bart Van Assche <bvanassche@....org>
Cc: elver@...gle.com, linux-kernel@...r.kernel.org, bigeasy@...utronix.de,
	mingo@...nel.org, tglx@...utronix.de, will@...nel.org,
	boqun.feng@...il.com, longman@...hat.com, hch@....de,
	rostedt@...dmis.org, llvm@...ts.linux.dev
Subject: Re: [RFC][PATCH 0/4] locking: Add/convert context analysis bits

On Thu, Jan 22, 2026 at 08:28:44AM -0800, Bart Van Assche wrote:

> then the following output appears:
> 
>   CALL    scripts/checksyscalls.sh
>   DESCEND objtool
>   INSTALL libsubcmd_headers
>   CC      kernel/locking/mutex.o
> In file included from kernel/locking/mutex.c:22:
> In file included from ./include/linux/ww_mutex.h:21:
> ./include/linux/rtmutex.h:44:25: error: reading variable 'owner' requires
>       holding raw_spinlock '&rt_mutex_base::wait_lock'
>       [-Werror,-Wthread-safety-analysis]
>    44 |         return READ_ONCE(lock->owner) != NULL;
>       |                                ^
> ./include/linux/rtmutex.h:52:56: error: reading variable 'owner' requires
>       holding raw_spinlock '&rt_mutex_base::wait_lock'
>       [-Werror,-Wthread-safety-analysis]
>    52 |         unsigned long owner = (unsigned long)
> READ_ONCE(lock->owner);
>       |                                                               ^
> 2 errors generated.
> 

Indeed; I shall fold the below into the rtmutex patch. Thanks!

---
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -41,7 +41,7 @@ struct rt_mutex_base {
  */
 static inline bool rt_mutex_base_is_locked(struct rt_mutex_base *lock)
 {
-	return READ_ONCE(lock->owner) != NULL;
+	return data_race(READ_ONCE(lock->owner) != NULL);
 }
 
 #ifdef CONFIG_RT_MUTEXES
@@ -49,7 +49,7 @@ static inline bool rt_mutex_base_is_lock
 
 static inline struct task_struct *rt_mutex_owner(struct rt_mutex_base *lock)
 {
-	unsigned long owner = (unsigned long) READ_ONCE(lock->owner);
+	unsigned long owner = (unsigned long) data_race(READ_ONCE(lock->owner));
 
 	return (struct task_struct *) (owner & ~RT_MUTEX_HAS_WAITERS);
 }
--- a/scripts/context-analysis-suppression.txt
+++ b/scripts/context-analysis-suppression.txt
@@ -24,6 +24,7 @@ src:*include/linux/mutex*.h=emit
 src:*include/linux/rcupdate.h=emit
 src:*include/linux/refcount.h=emit
 src:*include/linux/rhashtable.h=emit
+src:*include/linux/rtmutex*.h=emit
 src:*include/linux/rwlock*.h=emit
 src:*include/linux/rwsem.h=emit
 src:*include/linux/sched*=emit

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ