From: Boqun Feng <boqun.feng@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: ahmed Ehab <bottaawesome633@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: lock classes
Date: Mon, 1 Jul 2024 10:30:25 -0700 [thread overview]
Message-ID: <ZoLnsZ47vJNSuxa5@boqun-archlinux> (raw)
In-Reply-To: <6be3513e-67d8-4ead-b44a-e6dcdedfeaab@paulmck-laptop>
On Mon, Jul 01, 2024 at 09:20:02AM -0700, Paul E. McKenney wrote:
Thanks, Paul.
> On Mon, Jul 01, 2024 at 03:52:44AM +0300, ahmed Ehab wrote:
> > Hello sir,
> > I am working on a bug reported by syzkaller
> > https://syzkaller.appspot.com/bug?extid=d4200fc83fa03a684c6e . I am getting
> > 2 classes with the same key but different address for the name(different
> > name pointer but same content). The problem is that this info seems to be
> > persisted in the vmlinux itself. Is there any place where I can read about
> > how lock classes are persisted or something?
You could start with code that initializes lockdep_map (which is
corresponding to one lock instance), for this case, it's the
init_rwsem(), and the name & key are linked to the lockdep_map in
lockdep_init_map_type(). Eventually, usually at the first time a lock
instance is used, it will register the lock class, where lockdep
allocates a lock class and store the addresses of the key and name into
it.
So the problem here could be the string literals (i.e. the name
"&ei->i_data_sem") got instanced twice.
Regards,
Boqun
>
> Hello, Ahmed,
>
> Adding Boqun and the list on CC in case others have better advice.
>
> One possibility is that there is a lockdep_set_class_and_name() call
> that is separating out locks that would by default be in the same
> class. See the use of this function in the rcu_init_one() function in
> kernel/rcu/tree.c for one example use, in this case to create separate
> lock classes for each level of the rcu_node tree.
>
> There are a number of similar functions, including lockdep_set_class()
> and lockdep_set_class_and_subclass(). These guys might well duplicate
> the name, but I have never used them. Me, I encode the level into
> the name in order to have better lockdep diagnostics, but that is not
> always practical.
>
> Thanx, Paul
prev parent reply other threads:[~2024-07-01 17:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CA+6bSauVVgprKxB3f=Dgo0p5ZN0cyRAYATzGOe6CgsJ=Ai0trA@mail.gmail.com>
2024-07-01 16:20 ` Paul E. McKenney
2024-07-01 17:30 ` 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=ZoLnsZ47vJNSuxa5@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=bottaawesome633@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@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®