From: Boqun Feng <boqun.feng@gmail.com>
To: Waiman Long <longman@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will.deacon@arm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] locking/lockdep: Prevent abuse of lockdep subclass
Date: Sun, 4 May 2025 11:03:30 -0700 [thread overview]
Message-ID: <aBer8jsN9T9r_bI0@Mac.home> (raw)
In-Reply-To: <20250409143751.2010391-1-longman@redhat.com>
On Wed, Apr 09, 2025 at 10:37:51AM -0400, Waiman Long wrote:
> As I have seen 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.
>
> Signed-off-by: Waiman Long <longman@redhat.com>
Queued for 6.16, thanks!
Regards,
Boqun
> ---
> kernel/locking/lockdep.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 58d78a33ac65..3fb79d8fecdf 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];
> /*
> --
> 2.48.1
>
prev parent reply other threads:[~2025-05-04 18:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-09 14:37 Waiman Long
2025-05-04 18:03 ` Boqun Feng [this message]
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=aBer8jsN9T9r_bI0@Mac.home \
--to=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.com \
/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®