Subject: Re: kern/36669: NetBSD 4.0_BETA2 crashes with "panic: lockmgr: locking against myself"
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Matthias Scheler <tron@zhadum.org.uk>
List: netbsd-bugs
Date: 07/22/2007 11:35:03
The following reply was made to PR kern/36669; it has been noted by GNATS.

From: Matthias Scheler <tron@zhadum.org.uk>
To: Antti Kantee <pooka@cs.hut.fi>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/36669: NetBSD 4.0_BETA2 crashes with "panic: lockmgr: locking against myself"
Date: Sun, 22 Jul 2007 12:31:20 +0100

 On Sun, Jul 22, 2007 at 01:24:52PM +0300, Antti Kantee wrote:
 > > #15 0xc033239e in getcwd_common (lvp=0xcd933198, rvp=0xccaf1cc4, 
 > >     bpp=0xd419ea88, bufp=0xc28b9400 "", limit=512, flags=0, l=0xcdb6253c)
 > >     at /usr/src/sys/kern/vfs_getcwd.c:375
 > 
 > print bp
 
 #15 0xc033239e in getcwd_common (lvp=0xcd933198, rvp=0xccaf1cc4, 
     bpp=0xd419ea88, bufp=0xc28b9400 "", limit=512, flags=0, l=0xcdb6253c)
     at /usr/src/sys/kern/vfs_getcwd.c:375
 375             vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY);
 (gdb) print bp
 $1 = 0x0
 
 > > #16 0xc022511d in procfs_readlink (v=0xd419eabc)
 > >     at /usr/src/sys/miscfs/procfs/procfs_vnops.c:1469
 > 
 > print *vxp
 
 (gdb) print *vxp
 $2 = {v_uobj = {vmobjlock = {lock_data = 0}, pgops = 0xc051a58c, memq = {
       tqh_first = 0x0, tqh_last = 0xcd9331a0}, uo_npages = 0, uo_refs = 3}, 
   v_size = 0, v_flag = 0, v_numoutput = 0, v_writecount = 0, v_holdcnt = 0, 
   v_mount = 0xc273b000, v_op = 0xc28f9e00, v_freelist = {tqe_next = 0x0, 
     tqe_prev = 0x0}, v_mntvnodes = {tqe_next = 0xcd9330ec, 
     tqe_prev = 0xcd933284}, v_cleanblkhd = {lh_first = 0x0}, v_dirtyblkhd = {
     lh_first = 0x0}, v_synclist_slot = 0, v_synclist = {tqe_next = 0x0, 
     tqe_prev = 0x0}, v_dnclist = {lh_first = 0x0}, v_nclist = {
     lh_first = 0x0}, v_un = {vu_mountedhere = 0x0, vu_socket = 0x0, 
     vu_specinfo = 0x0, vu_fifoinfo = 0x0, vu_ractx = 0x0}, v_lease = 0x0, 
   v_type = VDIR, v_tag = VT_PROCFS, v_lock = {lk_interlock = {lock_data = 0}, 
     lk_flags = 1024, lk_sharecount = 0, lk_exclusivecount = 1, 
     lk_recurselevel = 0, lk_waitcount = 0, lk_wmesg = 0xc04ca8d4 "vnlock", 
     lk_un = {lk_un_sleep = {lk_sleep_lockholder = 294, lk_sleep_locklwp = 1, 
         lk_sleep_prio = 20, lk_sleep_timo = 0, lk_newlock = 0x0}, 
       lk_un_spin = {lk_spin_cpu = 294}}}, v_vnlock = 0xcd93320c, 
   v_data = 0xc2ebcf40, v_klist = {slh_first = 0x0}}
 
 > > #18 0xc03344c2 in namei (ndp=0xd419ebd8) at /usr/src/sys/kern/vfs_lookup.c:396
 > > #19 0xc033afb6 in sys___stat30 (l=0xcdb6253c, v=0xd419ec48, retval=0xd419ec68)
 > >     at /usr/src/sys/kern/vfs_syscalls.c:2424
 > 
 > And ktruss the process so I'd see what in the world it's trying to stat.
 
 I can only do that with "/proc" not mounted:
 
   6101      1 ktruss   emul(netbsd)
   6101      1 ktruss   fcntl(0x4, 0x3, 0)          = 1
   6101      1 ktruss   fcntl(0x4, 0x4, 0x1)        = 0
   6101      1 ktruss   execve("/home/tron/bin-NetBSD-i386/grm", 0xbfbfe804, 0xbfbfe814) Err#2 ENOENT
   6101      1 ktruss   execve("/home/tron/bin/grm", 0xbfbfe804, 0xbfbfe814) Err#2 ENOENT
   6101      1 ktruss   execve("/usr/local/bin/grm", 0xbfbfe804, 0xbfbfe814) Err#2 ENOENT
   6101      1 ktruss   execve("/bin/grm", 0xbfbfe804, 0xbfbfe814) Err#2 ENOENT
   6101      1 ktruss   execve("/usr/bin/grm", 0xbfbfe804, 0xbfbfe814) Err#2 ENOENT
   6101      1 grm      emul(netbsd)
   6101      1 grm      execve("/usr/pkg/bin/grm", 0xbfbfe804, 0xbfbfe814) JUSTRETURN
   6101      1 grm      mmap(0, 0x8000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 0xbbbcb000
   6101      1 grm      open("/etc/ld.so.conf", 0, 0) = 3
   6101      1 grm      __fstat30(0x3, 0xbfbfe720)  = 0
   6101      1 grm      mmap(0, 0x37, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbbbca000
   6101      1 grm      close(0x3)                  = 0
   6101      1 grm      munmap(0xbbbca000, 0x37)    = 0
   6101      1 grm      open("/usr/pkg/lib/libintl.so.0", 0, 0) Err#2 ENOENT
   6101      1 grm      open("/usr/lib/libintl.so.0", 0, 0) = 3
   6101      1 grm      __fstat30(0x3, 0xbfbfe020)  = 0
   6101      1 grm      mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbbbca000
   6101      1 grm      munmap(0xbbbca000, 0x1000)  = 0
   6101      1 grm      mmap(0, 0x8000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbbbc3000
   6101      1 grm      mmap(0xbbbc9000, 0x2000, 0x3, 0x12, 0x3, 0, 0x6000, 0) = 0xbbbc9000
   6101      1 grm      mmap(0xbbbcb000, 0, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbbbcb000
   6101      1 grm      close(0x3)                  = 0
   6101      1 grm      open("/usr/pkg/lib/libc.so.12", 0, 0xbfbfe020) Err#2 ENOENT
   6101      1 grm      open("/usr/lib/libc.so.12", 0, 0xbfbfe020) = 3
   6101      1 grm      __fstat30(0x3, 0xbfbfe020)  = 0
   6101      1 grm      mmap(0, 0x1000, 0x1, 0x1, 0x3, 0, 0, 0) = 0xbbbc2000
   6101      1 grm      munmap(0xbbbc2000, 0x1000)  = 0
   6101      1 grm      mmap(0, 0xf2000, 0x5, 0x2, 0x3, 0, 0, 0) = 0xbbad1000
   6101      1 grm      mmap(0xbbbac000, 0x7000, 0x3, 0x12, 0x3, 0, 0xda000, 0) = 0xbbbac000
   6101      1 grm      mmap(0xbbbb3000, 0x10000, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 0xbbbb3000
   6101      1 grm      close(0x3)                  = 0
   6101      1 grm      mprotect(0xbbbc3000, 0x6000, 0x7) = 0
   6101      1 grm      mprotect(0xbbbc3000, 0x6000, 0x5) = 0
   6101      1 grm      mprotect(0xbbad1000, 0xdb000, 0x7) = 0
   6101      1 grm      mprotect(0xbbad1000, 0xdb000, 0x5) = 0
   6101      1 grm      __sysctl(0xbfbfe734, 0x2, 0xbbbbad20, 0xbfbfe73c, 0, 0) = 0
   6101      1 grm      issetugid()                 = 0
   6101      1 grm      open("/usr/share/locale/de_DE.ISO8859-15/LC_CTYPE", 0, 0x1b6) = 3
   6101      1 grm      __fstat30(0x3, 0xbfbfc400)  = 0
   6101      1 grm      __fstat30(0x3, 0xbfbfc1c8)  = 0
   6101      1 grm      __sysctl(0xbfbfc150, 0x2, 0xbfbfc15c, 0xbfbfc160, 0, 0) = 0
   6101      1 grm      readlink("/etc/malloc.conf", 0xbfbfc1a8, 0x3f) Err#2 ENOENT
   6101      1 grm      mmap(0, 0x1000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 0xbbad0000
   6101      1 grm      break(0x8062968)            = 0
   6101      1 grm      break(0x8063968)            = 0
   6101      1 grm      break(0x8064000)            = 0
   6101      1 grm      break(0x8066000)            = 0
   6101      1 grm      lseek(0x3, 0, 0, 0, 0x1)    = 0
   6101      1 grm      lseek(0x3, 0, 0, 0, 0)      = 0
   6101      1 grm      read(0x3, 0x8064000, 0x2000) = 3242
        "RuneCT10NONE\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
   6101      1 grm      break(0x8067000)            = 0
   6101      1 grm      break(0x8068000)            = 0
   6101      1 grm      close(0x3)                  = 0
   6101      1 grm      break(0x8069000)            = 0
   6101      1 grm      break(0x806a000)            = 0
   6101      1 grm      ioctl(0, TIOCGETA, 0xbfbfe6b0) = 0
        "\0\^C\0\0\^C\0\0\0\0[\0\0\M-O\^E\0 \^D\M^?\0\b\^W\^U\^R\0\^C\^\\^Z\^Y"
   6101      1 grm      __lstat30("/", 0xbfbfe680)  = 0
   6101      1 grm      break(0x806b000)            = 0
   6101      1 grm      break(0x806c000)            = 0
   6101      1 grm      break(0x806d000)            = 0
   6101      1 grm      break(0x806e000)            = 0
   6101      1 grm      __lstat30("/tmp/gaga", 0xbfbfe628) = 0
   6101      1 grm      geteuid()                   = 1001
   6101      1 grm      __sigprocmask14(0, 0, 0x806a0b4) = 0
   6101      1 grm      open("/tmp/gaga", 0x8104, 0) = 3
   6101      1 grm      __fstat30(0x3, 0xbfbfe628)  = 0
   6101      1 grm      open("/proc/self/fd", 0, 0xbbbfadb0) Err#2 ENOENT
   6101      1 grm      open(".", 0, 0)             = 5
   6101      1 grm      fchdir(0x3)                 = 0
   6101      1 grm      open(".", 0x4, 0)           = 7
   6101      1 grm      fcntl(0x7, 0x2, 0x1)        = 0
   6101      1 grm      __fstat30(0x7, 0xbfbfd8e0)  = 0
   6101      1 grm      break(0x806f000)            = 0
   6101      1 grm      __sysctl(0xbfbfd858, 0x2, 0xbbbc1da0, 0xbfbfd860, 0, 0) = 0
   6101      1 grm      fstatvfs1(0x7, 0xbfbfd944, 0x2) = 0
   6101      1 grm      break(0x8070000)            = 0
   6101      1 grm      fchdir(0x5)                 = 0
   6101      1 grm      close(0x5)                  = 0
   6101      1 grm      close(0x3)                  = 0
   6101      1 grm      lseek(0x7, 0, 0, 0, 0x1)    = 0
   6101      1 grm      __getdents30(0x7, 0x806f000, 0x1000) = 56
        "\M-wq\0\0\0\0\0\0\^P\0\^A\0\^D.\0\0\^B\0\0\0\0\0\0\0\^P\0\^B\0\^D..\0"
   6101      1 grm      open(".", 0, 0)             = 3
   6101      1 grm      fchdir(0x7)                 = 0
   6101      1 grm      unlink("data")              = 0
   6101      1 grm      fchdir(0x3)                 = 0
   6101      1 grm      close(0x3)                  = 0
   6101      1 grm      lseek(0x7, 0, 0, 0, 0x1)    = 2
   6101      1 grm      __getdents30(0x7, 0x806f000, 0x1000) = 0
        ""
   6101      1 grm      fcntl(0x7, 0x1, 0x806f020)  = 1
   6101      1 grm      close(0x7)                  = 0
   6101      1 grm      rmdir("/tmp/gaga")          = 0
   6101      1 grm      close(0x1)                  = 0
   6101      1 grm      close(0x2)                  = 0
   6101      1 grm      exit(0)
 
 I guess it is the "/proc/self/fd" which causes the problem.
 
 	Kind regards
 
 -- 
 Matthias Scheler                                  http://zhadum.org.uk/