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-next>] [day] [month] [year] [list]
Message-ID: <YGF+hDytO8r9Iv2o@vostro>
Date:   Mon, 29 Mar 2021 00:15:16 -0700
From:   Nikitas Angelinas <nikitas.angelinas@...il.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        Waiman Long <longman@...hat.com>,
        Boqun Feng <boqun.feng@...il.com>,
        Nikitas Angelinas <nikitas.angelinas@...il.com>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] locking/mutex: initialize osq lock in __MUTEX_INITIALIZER()

Since __MUTEX_INITIALIZER() is used on memory that is initialized to 0
anyway this change should not have an effect, but it seems better to
initialize osq explicitly for completeness, as done in other macros and
functions that initialize mutex and rwsem.

Signed-off-by: Nikitas Angelinas <nikitas.angelinas@...il.com>
---
 include/linux/mutex.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 515cff7..bff47f8 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -129,10 +129,18 @@ do {									\
 # define __DEP_MAP_MUTEX_INITIALIZER(lockname)
 #endif
 
+#ifdef CONFIG_MUTEX_SPIN_ON_OWNER
+# define __OSQ_MUTEX_INITIALIZER(lockname)			\
+		, .osq = OSQ_LOCK_UNLOCKED
+#else
+# define __OSQ_MUTEX_INITIALIZER(lockname)
+#endif
+
 #define __MUTEX_INITIALIZER(lockname) \
 		{ .owner = ATOMIC_LONG_INIT(0) \
 		, .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \
 		, .wait_list = LIST_HEAD_INIT(lockname.wait_list) \
+		__OSQ_MUTEX_INITIALIZER(lockname) \
 		__DEBUG_MUTEX_INITIALIZER(lockname) \
 		__DEP_MAP_MUTEX_INITIALIZER(lockname) }
 
-- 
2.10.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ