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: <tip-4bf508621855613ca2ac782f70c3171e0e8bb011@git.kernel.org>
Date:   Wed, 27 Feb 2019 23:13:08 -0800
From:   tip-bot for Bart Van Assche <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     bvanassche@....org, mingo@...nel.org, linux-kernel@...r.kernel.org,
        hpa@...or.com, longman@...hat.com, akpm@...ux-foundation.org,
        tglx@...utronix.de, johannes@...solutions.net,
        torvalds@...ux-foundation.org, paulmck@...ux.vnet.ibm.com,
        will.deacon@....com, peterz@...radead.org
Subject: [tip:locking/core] locking/lockdep: Verify whether lock objects are
 small enough to be used as class keys

Commit-ID:  4bf508621855613ca2ac782f70c3171e0e8bb011
Gitweb:     https://git.kernel.org/tip/4bf508621855613ca2ac782f70c3171e0e8bb011
Author:     Bart Van Assche <bvanassche@....org>
AuthorDate: Thu, 14 Feb 2019 15:00:52 -0800
Committer:  Ingo Molnar <mingo@...nel.org>
CommitDate: Thu, 28 Feb 2019 07:55:46 +0100

locking/lockdep: Verify whether lock objects are small enough to be used as class keys

Signed-off-by: Bart Van Assche <bvanassche@....org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Johannes Berg <johannes@...solutions.net>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Waiman Long <longman@...hat.com>
Cc: Will Deacon <will.deacon@....com>
Cc: johannes.berg@...el.com
Cc: tj@...nel.org
Link: https://lkml.kernel.org/r/20190214230058.196511-18-bvanassche@acm.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
 kernel/locking/lockdep.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 630be9ac6253..84427441824e 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -758,6 +758,17 @@ static bool assign_lock_key(struct lockdep_map *lock)
 {
 	unsigned long can_addr, addr = (unsigned long)lock;
 
+#ifdef __KERNEL__
+	/*
+	 * lockdep_free_key_range() assumes that struct lock_class_key
+	 * objects do not overlap. Since we use the address of lock
+	 * objects as class key for static objects, check whether the
+	 * size of lock_class_key objects does not exceed the size of
+	 * the smallest lock object.
+	 */
+	BUILD_BUG_ON(sizeof(struct lock_class_key) > sizeof(raw_spinlock_t));
+#endif
+
 	if (__is_kernel_percpu_address(addr, &can_addr))
 		lock->key = (void *)can_addr;
 	else if (__is_module_percpu_address(addr, &can_addr))

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ