[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174655392027.406.8515086852883668250.tip-bot2@tip-bot2>
Date: Tue, 06 May 2025 17:52:00 -0000
From: "tip-bot2 for Waiman Long" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Waiman Long <longman@...hat.com>, Boqun Feng <boqun.feng@...il.com>,
Ingo Molnar <mingo@...nel.org>, Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>, Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Peter Zijlstra <peterz@...radead.org>, Will Deacon <will@...nel.org>,
llvm@...ts.linux.dev, x86@...nel.org, linux-kernel@...r.kernel.org
Subject:
[tip: locking/core] locking/lockdep: Prevent abuse of lockdep subclass
The following commit has been merged into the locking/core branch of tip:
Commit-ID: 6a1a219f535a437eb12a06d8cef2518e58654beb
Gitweb: https://git.kernel.org/tip/6a1a219f535a437eb12a06d8cef2518e58654beb
Author: Waiman Long <longman@...hat.com>
AuthorDate: Mon, 05 May 2025 21:20:48 -07:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Tue, 06 May 2025 18:34:35 +02:00
locking/lockdep: Prevent abuse of lockdep subclass
To catch the code trying to use a subclass value >= MAX_LOCKDEP_SUBCLASSES (8),
add a DEBUG_LOCKS_WARN_ON() statement to notify the users that such a
large value is not allowed.
[ boqun: Reword the commit log with a more objective tone ]
Signed-off-by: Waiman Long <longman@...hat.com>
Signed-off-by: Boqun Feng <boqun.feng@...il.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Bill Wendling <morbo@...gle.com>
Cc: Justin Stitt <justinstitt@...gle.com>
Cc: Nathan Chancellor <nathan@...nel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Will Deacon <will@...nel.org>
Cc: llvm@...ts.linux.dev
Link: https://lore.kernel.org/r/20250506042049.50060-3-boqun.feng@gmail.com
---
kernel/locking/lockdep.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 546e928..050dbe9 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -5101,6 +5101,9 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
lockevent_inc(lockdep_nocheck);
}
+ if (DEBUG_LOCKS_WARN_ON(subclass >= MAX_LOCKDEP_SUBCLASSES))
+ return 0;
+
if (subclass < NR_LOCKDEP_CACHING_CLASSES)
class = lock->class_cache[subclass];
/*
Powered by blists - more mailing lists