Subject: kern/37189: Panic in lockdebug_lookup - uninitialized lock
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <scotte@warped.com>
List: netbsd-bugs
Date: 10/23/2007 23:50:00
>Number:         37189
>Category:       kern
>Synopsis:       amd64/-current panic in lockdebug_lookup with "uninitialized lock"
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 23 23:50:00 +0000 2007
>Originator:     Scott Ellis
>Release:        NetBSD 4.99.34
>Organization:
	
>Environment:
	
	
System: NetBSD intrepid 4.99.34 NetBSD 4.99.34 (INTREPID.NEWBOX.DEBUG) #4: Mon Oct 22 16:59:57 PDT 2007 scotte@intrepid:/nbu/source/netbsd/src/obj.amd64/nbu/source/netbsd/src/sys/arch/amd64/compile/INTREPID.NEWBOX.DEBUG amd64
Architecture: x86_64
Machine: amd64
>Description:
	
I can repeatably cause a system panic (or spontaneous reboot, or hard lockup
w/o the ability to break into DDB) on my amd64/-current system when uploading
large numbers of pictures to Gallery 1.6.

This has been occuring on two different systems (one UP on an Athlon64,
another MP on an E6600).

With a LOCKDEBUG-enabled kernel, the panic is:

panic: lockdebug_lookup: uninitialized lock (1, id=-559038737)
Stopped in pid 18709.1 (jpegtopnm) at   netbsd:breakpoint+0x1:  ret
db{0}> bt
breakpoint() at netbsd:breakpoint+0x1
panic() at netbsd:panic+0x1bd
lockdebug_lookup() at netbsd:lockdebug_lookup+0x48
lockdebug_wantlock() at netbsd:lockdebug_wantlock+0x3c
mutex_vector_enter() at netbsd:mutex_vector_enter+0x8b
fdfree() at netbsd:fdfree+0xc3
exit1() at netbsd:exit1+0x2ce
exit1() at netbsd:exit1
syscall_plain() at netbsd:syscall_plain+0x270
uvm_fault(0xffff80006b92d790, 0x0, 1) -> e
kernel: page fault trap, code=0
Faulted in DDB; continuing...
db{0}>

The process list is:
db{0}> ps
 PID           PPID     PGRP        UID S   FLAGS LWPS          COMMAND    WAIT
 1491         21620      291       1002 2  0x4000    1        pnmtojpeg    pipe
 3939         21620      291       1002 2  0x4000    1         pnmscale
>18709        21620      291       1002 3  0x4000    1        jpegtopnm
 21620          468      291       1002 2  0x4000    1               sh    wait
 23735         9478    23735        100 2  0x4100    1           systat   ttyin
 2757           530      530       1007 2  0x4100    1       imap-login  kqread
 16850          530      530        101 2  0x4101    1             imap  kqread
 14623          530      530        100 2  0x4101    1             imap  kqread
 17373          530      530       1007 2  0x4100    1       imap-login  kqread
 809          27336      809        100 2  0x4100    1     screen-4.0.3   pause
 27336        19627    27336        100 2  0x4000    1              zsh   pause
 19627        15364    15364        100 2   0x100    1             sshd  select
 15364          575    15364          0 2  0x4000    1             sshd   netio
 1960           530      530       1007 2  0x4100    1       imap-login  kqread
 28592          530      530       1007 2  0x4100    1       imap-login  kqread
 5325           530      530        100 2  0x4101    1             imap  kqread
 6197           530      530        100 2  0x4101    1             imap  kqread
 2127           530      530       1007 2  0x4100    1       imap-login  kqread
 4880          1573     1573       1006 2   0x100    1             perl  select
 25852         1573     1573       1006 2   0x100    1             perl  select
 1573             1     1573          0 2       0    1             perl  select
 24688          530      530       1007 2  0x4100    1       imap-login  kqread
 4268         21944     4268          0 2  0x4000    1              zsh   ttyin
 21944         6679    21944          0 2  0x4000    1              csh   pause
 10694         6679    10694        100 2  0x4000    1              zsh   ttyin
 7128          6679     7128        100 2  0x4000    1              zsh   ttyin
 6924          9208     6924          0 2  0x4000    1              zsh   ttyin
 9208          6679     9208          0 2  0x4000    1              csh   pause
 9478          6679     9478        100 2  0x4000    1              zsh   pause
 6679             1     6679        100 2   0x100    1     screen-4.0.3  select
 8851           530      530       1007 2  0x4100    1       imap-login  kqread
 697              1      697          0 2       0    1            selcd nanoslp
 669              1      669          0 2  0x4000    1            getty   ttyin
 316              1      316          0 2       0    1             cron nanoslp
 690              1      690          0 2       0    1            inetd  kqread
 575              1      575          0 2       0    1             sshd  select
 689              1      689          0 2       0    1           powerd  kqread
 270              1      270         15 2   0x100    1             ntpd   pause
 98              96       98          0 2       0    1              lpd nanoslp
 96               1       96          0 2       0    1              lpd  select
 573            530      530          0 2  0x4000    1     dovecot-auth  kqread
 530              1      530          0 2       0    1          dovecot  kqread
 489              1      489          0 2     0x1    2            clamd       *
 473            486      486          0 2   0x101    1             smbd   pause
 490              1      490          0 2     0x1    1             nmbd  select
 486              1      486          0 2   0x101    1             smbd  select
 479            292        2          0 2  0x4000    1           logger    pipe
 464            292        2          0 2  0x4000    1              sed    pipe
 492            292        2       1008 2  0x4100    2           mysqld       *
 478            291      291       1002 2   0x101   28            httpd       *
 468            291      291       1002 2   0x101   28            httpd       *
 469            291      291       1002 2   0x100    1            httpd  netcon
 292              1        2          0 2  0x4000    1               sh    wait
 291              1      291          0 2     0x1    1            httpd  select
 280              1      280       1005 2   0x100    1      exim-4.68-2  select
 263              1      263          0 2     0x1    1        saslauthd  netcon
 247              1      247          0 2       0    1            dhcpd  select
 156              1      156          0 2       0    1          rpcbind  select
 141              1      141         14 2   0x100    5            named       *
 143            136      136         18 2   0x100    1           pflogd     bpf
 136              1      136          0 2       0    1           pflogd   netio
 107              1      107          0 2       0    1          syslogd  kqread
 86               1       86          0 2       0    1         dhclient  select
 1                0        1          0 2  0x4001    1             init    wait
 0               -1        0          0 2 0x20002   29           system       *
db{0}>

>How-To-Repeat:
	
Install Gallery 1.x, and upload a few hundred megs of pictures. :-)

>Fix:
	
Not known.  I'm more than willing to debug further, if somebody tells me
what I should do and provide.

>Unformatted: