mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Waiman Long" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Waiman Long <longman@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>, Ingo Molnar <mingo@kernel.org>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Will Deacon <will@kernel.org>,
	llvm@lists.linux.dev, x86@kernel.org,
	linux-kernel@vger.kernel.org
Subject: [tip: locking/core] locking/lockdep: Prevent abuse of lockdep subclass
Date: Tue, 06 May 2025 17:52:00 -0000	[thread overview]
Message-ID: <174655392027.406.8515086852883668250.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250506042049.50060-3-boqun.feng@gmail.com>

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@redhat.com>
AuthorDate:    Mon, 05 May 2025 21:20:48 -07:00
Committer:     Ingo Molnar <mingo@kernel.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@redhat.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Bill Wendling <morbo@google.com>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Cc: llvm@lists.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];
 	/*

  reply	other threads:[~2025-05-06 17:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06  4:20 [GIT PULL] [PATCH 0/3] LOCKDEP changes for v6.16 Boqun Feng
2025-05-06  4:20 ` [PATCH 1/3] lockdep: Move hlock_equal() to the respective ifdeffery Boqun Feng
2025-05-06 17:52   ` [tip: locking/core] locking/lockdep: Move hlock_equal() to the respective #ifdeffery tip-bot2 for Andy Shevchenko
2025-05-06  4:20 ` [PATCH 2/3] locking/lockdep: Prevent abuse of lockdep subclass Boqun Feng
2025-05-06 17:52   ` tip-bot2 for Waiman Long [this message]
2025-05-06  4:20 ` [PATCH 3/3] locking/lockdep: Add # of dynamic keys stat to /proc/lockdep_stats Boqun Feng
2025-05-06 17:51   ` [tip: locking/core] locking/lockdep: Add number of dynamic keys " tip-bot2 for Waiman Long
2025-05-06 17:23 ` [GIT PULL] [PATCH 0/3] LOCKDEP changes for v6.16 Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=174655392027.406.8515086852883668250.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=boqun.feng@gmail.com \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=longman@redhat.com \
    --cc=mingo@kernel.org \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®