NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/55903: LOCKDEBUG show all locks broken?



>Number:         55903
>Category:       kern
>Synopsis:       LOCKDEBUG show all locks broken?
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan 02 13:35:00 +0000 2021
>Originator:     Martin Husemann
>Release:        NetBSD 9.99.77
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD martins.aprisoft.de 9.99.77 NetBSD 9.99.77 (GENERIC) #41: Fri Dec 25 12:38:49 CET 2020 martin%martins.aprisoft.de@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

In a kernel compiled with LOCKDEBUG the ddb command "show all locks" is
supposed to give an overview of all locks currently in use.

However, the output is broken. Example:

****** LWP 803.803 (ifconfig) @ 0xffff8a9f9c71fb00, l_stat=3

*** Locks held: none

*** Locks wanted:

* Lock 0 (initialized at module_hook_init)
lock address : 0xffffffff81465c40 type     :     sleep/adaptive
initialized  : 0xffffffff80b2efc8
shared holds :                  0 exclusive:                  0
shares wanted:                  0 exclusive:                  0
relevant cpu :                  0 last held:                  0
relevant lwp : 0xffff8a9f9c71fb00 last held: 000000000000000000
last locked  : 000000000000000000 unlocked*: 000000000000000000
owner field  : 000000000000000000 wait/spin:                0/0
Turnstile: no active turnstile for this lock.

That lock is:

(gdb) list *(0xffffffff80b2efc8)
0xffffffff80b2efc8 is in module_hook_init (../../../../kern/kern_module_hook.c:132).
127	void
128	module_hook_init(void)
129	{
130	
131		mutex_init(&module_hook.mtx, MUTEX_DEFAULT, IPL_NONE);
132		cv_init(&module_hook.cv, "mod_hook");
133		module_hook.psz = pserialize_create();
134	}

but the backtrace of the waiting process shows:

db{0}> bt/a ffff8a9f9c71fb00
trace: pid 803 lid 803 at 0xffff9d0151a0ed80
sleepq_block() at netbsd:sleepq_block+0x12c
cv_timedwait_sig() at netbsd:cv_timedwait_sig+0x102
sbwait() at netbsd:sbwait+0x67
soreceive() at netbsd:soreceive+0xbed
dofileread() at netbsd:dofileread+0x79
sys_read() at netbsd:sys_read+0x49
syscall() at netbsd:syscall+0x253
--- syscall (number 3) ---
netbsd:syscall+0x253:

The same lock is listed for all LWPs in sleepq_block(), apparently.
Another example:

****** LWP 601.601 (ntpd) @ 0xffff8a9f9d4cd980, l_stat=3

*** Locks held: none
           
*** Locks wanted:

* Lock 0 (initialized at module_hook_init)
lock address : 0xffffffff81465c40 type     :     sleep/adaptive
initialized  : 0xffffffff80b2efc8
shared holds :                  0 exclusive:                  0
shares wanted:                  0 exclusive:                  0
relevant cpu :                  0 last held:                  0
relevant lwp : 0xffff8a9f9d4cd980 last held: 000000000000000000
last locked  : 000000000000000000 unlocked*: 000000000000000000
owner field  : 000000000000000000 wait/spin:                0/0
Turnstile: no active turnstile for this lock.

with:

db{0}> bt/a 0xffff8a9f9d4cd980
trace: pid 601 lid 601 at 0xffff9d0151a84f50
sleepq_block() at netbsd:sleepq_block+0x12c
sigsuspend1() at netbsd:sigsuspend1+0x23
sys___sigsuspend14() at netbsd:sys___sigsuspend14+0x3d
syscall() at netbsd:syscall+0x253
--- syscall (number 294) ---
netbsd:syscall+0x253:


>How-To-Repeat:
s/a

>Fix:
n/a



Home | Main Index | Thread Index | Old Index