Re: lock classes
From: Paul E. McKenney
Date: Mon Jul 01 2024 - 12:20:22 EST
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?
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