Subject: Re: BUG: looking up invalid subclass: 8

From: Jakub Kicinski <[email-masked]>
Date: Tue, 17 Oct 2023 17:09:00 -0700

On Tue, 17 Oct 2023 16:41:41 -0700 (PDT) Eric Wheeler wrote:
> I found a similar backtrace that was fixed in
> 3510c7aa069aa83a2de6dab2b41401a198317bdc .  It was for ALSA, but had the
> same BUG of "looking up invalid subclass: 8" and the fix was trivial,
> noting that MAX_HOPS shouldn't be bigger than MAX_LOCKDEP_SUBCLASSES.
> 
> Is there a simple fix for this in netlink, too?
> 
> ]# ./scripts/decode_stacktrace.sh vmlinux `pwd` < stackdump.txt 
> [  113.347055] BUG: looking up invalid subclass: 8
> [  113.357387] turning off the locking correctness validator.
> [  113.364842] Hardware name: Supermicro Super Server/H11SSL-i, BIOS 2.4 12/27/2021
> [  113.373614] Call Trace:
> [  113.381874]  <TASK>
> [  113.382556] dump_stack_lvl (lib/dump_stack.c:108) 
> [  113.388816] look_up_lock_class (kernel/locking/lockdep.c:941) 
> [  113.399562] register_lock_class (kernel/locking/lockdep.c:1284 (discriminator 13)) 
> [  113.400238] ? srso_return_thunk (arch/x86/lib/retpoline.S:308) 
> [  113.403627] __lock_acquire (kernel/locking/lockdep.c:5014) 
> [  113.414652] lock_acquire.part.0 (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5755) 
> [  113.428619] ? srso_return_thunk (arch/x86/lib/retpoline.S:308) 
> [  113.435463] ? lock_acquire (./include/trace/events/lock.h:24 kernel/locking/lockdep.c:5724) 
> [  113.440620] _raw_spin_lock_nested (kernel/locking/spinlock.c:379) 
> [  113.462749] ? __nla_validate_parse (lib/nlattr.c:606) 
> [  113.471052] genl_family_rcv_msg_doit.isra.0 (net/netlink/genetlink.c:970) 
> [  113.471651] genl_family_rcv_msg (net/netlink/genetlink.c:1050) 

Thanks for sharing the decoded stack trace, can you share the full
non-decoded one? Is there the name of the command that's calling
this somewhere?

There's no lock where this is pointing at, just an indirect call.
So I wonder where the lock is. Perhaps retpoline is confusing 
the stack trace :(