Dan Nelson
2005-Apr-23 10:28 UTC
panic: mutex tty owned at ../../../kern/kern_event.c:1487
Got the following on a 2004-04-21 -stable kernel: panic messages: --- panic: mutex tty owned at ../../../kern/kern_event.c:1487 cpuid = 0 KDB: stack backtrace: kdb_backtrace(c07c93fb,0,c07aed2c,e97b799c,c3d05780) at kdb_backtrace+0x2e panic(c07aed2c,c07a955e,c07acb39,5cf,c383c800) at panic+0x139 _mtx_assert(c383c910,2,c07acb39,5cf,c383c800) at _mtx_assert+0xf3 knote(c383c880,0,0) at knote+0x3d ttwakeup(c383c800,c383c800,c4cc3e8c,1,c07aeb7a) at ttwakeup+0x89 ttyinput(d,c383c800,0,0,4d) at ttyinput+0x8d4 ttypend(c383c800,c383c800,e97b7a80,c05e9b80,c383c800) at ttypend+0x6c ttnread(c383c800,c2803374,c327d700,e97b7aa4,c0596b3c) at ttnread+0x1b filt_ttyread(c2803374,0,c07acb39,5dd,c383c800) at filt_ttyread+0x20 knote(c383c880,0,0) at knote+0xcc ttwakeup(c383c800,c07b377e,32e,32d,c05aa530) at ttwakeup+0x89 ttioctl(c383c800,802c7415,c39864c0,3,c3d05780) at ttioctl+0xc6b ttyioctl(c2bce300,802c7415,c39864c0,3,c3d05780) at ttyioctl+0x65 ptyioctl(c2bce300,802c7415,c39864c0,3,c3d05780) at ptyioctl+0x2a8 spec_ioctl(e97b7c00,e97b7cac,c06233e4,e97b7c00,0) at spec_ioctl+0x17c spec_vnoperate(e97b7c00,0,c07b6fe6,30d,c080d640) at spec_vnoperate+0x18 vn_ioctl(c3968198,802c7415,c39864c0,c3a00a00,c3d05780) at vn_ioctl+0x204 ioctl(c3d05780,e97b7d14,c,431,3) at ioctl+0x448 syscall(2f,2f,2f,1,1) at syscall+0x2a0 Xint0x80_syscall() at Xint0x80_syscall+0x1f --- syscall (54, FreeBSD ELF32, ioctl), eip = 0x2828533f, esp = 0xbfaed66c, ebp = 0xbfaed6c8 --- boot() called on cpu#0 Uptime: 2d1h39m7s Dumping 1023 MB Compressing 64>22 128>46 192>71 256>95 320>119 384>143 448>167 512>191 576>215 640>233 704>249 768>264 832>273 896>296 960>320 Compressed to 346 MB Dumpsize = 363098112 Dump starting at 442239488 64 128 192 256 320 384 448 512 576 640 704 768 832 896 960 --- #0 doadump () at pcpu.h:159 159 pcpu.h: No such file or directory. in pcpu.h doadump () at pcpu.h:159 159 in pcpu.h #0 doadump () at pcpu.h:159 #1 0xc05b44aa in boot (howto=260) at ../../../kern/kern_shutdown.c:410 #2 0xc05b4884 in panic (fmt=0xc07aed2c "mutex %s owned at %s:%d") at ../../../kern/kern_shutdown.c:566 #3 0xc05aac23 in _mtx_assert (m=0xc383c910, what=0, file=0xc07acb39 "../../../kern/kern_event.c", line=1487) at ../../../kern/kern_mutex.c:753 #4 0xc0596aad in knote (list=0xc383c880, hint=0, islocked=0) at ../../../kern/kern_event.c:1487 #5 0xc05eb699 in ttwakeup (tp=0xc383c800) at ../../../kern/tty.c:2374 #6 0xc05e83b4 in ttyinput (c=13, tp=0xc383c800) at ../../../kern/tty.c:601 #7 0xc05ea23c in ttypend (tp=0xc383c800) at ../../../kern/tty.c:1658 #8 0xc05e9c5b in ttnread (tp=0xc383c800) at ../../../kern/tty.c:1352 #9 0xc05e9b80 in filt_ttyread (kn=0xc2803374, hint=0) at ../../../kern/tty.c:1313 #10 0xc0596b3c in knote (list=0xc383c880, hint=0, islocked=0) at ../../../kern/kern_event.c:1504 #11 0xc05eb699 in ttwakeup (tp=0xc383c800) at ../../../kern/tty.c:2374 #12 0xc05e937b in ttioctl (tp=0xc383c800, cmd=2150396949, data=0xc39864c0, flag=3) at ../../../kern/tty.c:1064 #13 0xc05ec6f5 in ttyioctl (dev=0x0, cmd=2150396949, data=0xc39864c0 "\006\t", flag=3, td=0x0) at ../../../kern/tty.c:2917 #14 0xc05ef0f8 in ptyioctl (dev=0xc2bce300, cmd=2150396949, data=0xc39864c0 "\006\t", flag=0, td=0x0) at ../../../kern/tty_pty.c:623 #15 0xc056da0c in spec_ioctl (ap=0xe97b7c00) at ../../../fs/specfs/spec_vnops.c:357 #16 0xc056d038 in spec_vnoperate (ap=0x0) at ../../../fs/specfs/spec_vnops.c:118 #17 0xc06233e4 in vn_ioctl (fp=0xc3968198, com=2150396949, data=0xc39864c0, active_cred=0xc3a00a00, td=0xc3d05780) at vnode_if.h:503 #18 0xc05dbae8 in ioctl (td=0xc3d05780, uap=0xe97b7d14) at file.h:257 #19 0xc07535e0 in syscall (frame={tf_fs = 47, tf_es = 47, tf_ds = 47, tf_edi = 1, tf_esi = 1, tf_ebp = -1079060792, tf_isp = -377782924, tf_ebx = 674260420, tf_edx = 140677888, tf_ecx = -2144570347, tf_eax = 54, tf_trapno = 12, tf_err = 2, tf_eip = 673731391, tf_cs = 31, tf_eflags = 582, tf_esp = -1079060884, tf_ss = 47}) at ../../../i386/i386/trap.c:1001 #20 0xc073e38f in Xint0x80_syscall () at ../../../i386/i386/exception.s:201 #21 0x0000002f in ?? () [garbage] #48 0xc3585900 in ?? () #49 0xc05c6f90 in sched_switch (td=0x1, newtd=0x283065c4, flags=---Can't read userspace from dump, or kernel process--- ) at ../../../kern/sched_4bsd.c:881 gdbcom:2: Error in sourced command file: Previous frame inner to this frame (corrupt stack?) (kgdb) -- Dan Nelson dnelson@allantgroup.com
John-Mark Gurney
2005-Apr-23 15:05 UTC
panic: mutex tty owned at ../../../kern/kern_event.c:1487
Dan Nelson wrote this message on Sat, Apr 23, 2005 at 12:28 -0500:> Got the following on a 2004-04-21 -stable kernel: > > panic messages: > --- > panic: mutex tty owned at ../../../kern/kern_event.c:1487 > cpuid = 0[...]> #0 doadump () at pcpu.h:159 > #1 0xc05b44aa in boot (howto=260) at ../../../kern/kern_shutdown.c:410 > #2 0xc05b4884 in panic (fmt=0xc07aed2c "mutex %s owned at %s:%d") at ../../../kern/kern_shutdown.c:566 > #3 0xc05aac23 in _mtx_assert (m=0xc383c910, what=0, file=0xc07acb39 "../../../kern/kern_event.c", line=1487) at ../../../kern/kern_mutex.c:753 > #4 0xc0596aad in knote (list=0xc383c880, hint=0, islocked=0) at ../../../kern/kern_event.c:1487 > #5 0xc05eb699 in ttwakeup (tp=0xc383c800) at ../../../kern/tty.c:2374 > #6 0xc05e83b4 in ttyinput (c=13, tp=0xc383c800) at ../../../kern/tty.c:601 > #7 0xc05ea23c in ttypend (tp=0xc383c800) at ../../../kern/tty.c:1658 > #8 0xc05e9c5b in ttnread (tp=0xc383c800) at ../../../kern/tty.c:1352 > #9 0xc05e9b80 in filt_ttyread (kn=0xc2803374, hint=0) at ../../../kern/tty.c:1313 > #10 0xc0596b3c in knote (list=0xc383c880, hint=0, islocked=0) at ../../../kern/kern_event.c:1504 > #11 0xc05eb699 in ttwakeup (tp=0xc383c800) at ../../../kern/tty.c:2374 > #12 0xc05e937b in ttioctl (tp=0xc383c800, cmd=2150396949, data=0xc39864c0, flag=3) at ../../../kern/tty.c:1064 > #13 0xc05ec6f5 in ttyioctl (dev=0x0, cmd=2150396949, data=0xc39864c0 "\006\t", flag=3, td=0x0) at ../../../kern/tty.c:2917 > #14 0xc05ef0f8 in ptyioctl (dev=0xc2bce300, cmd=2150396949, data=0xc39864c0 "\006\t", flag=0, td=0x0) at ../../../kern/tty_pty.c:623 > #15 0xc056da0c in spec_ioctl (ap=0xe97b7c00) at ../../../fs/specfs/spec_vnops.c:357 > #16 0xc056d038 in spec_vnoperate (ap=0x0) at ../../../fs/specfs/spec_vnops.c:118 > #17 0xc06233e4 in vn_ioctl (fp=0xc3968198, com=2150396949, data=0xc39864c0, active_cred=0xc3a00a00, td=0xc3d05780) at vnode_if.h:503 > #18 0xc05dbae8 in ioctl (td=0xc3d05780, uap=0xe97b7d14) at file.h:257 > #19 0xc07535e0 in syscall (frame={tf_fs = 47, tf_es = 47, tf_ds = 47, tf_edi = 1, tf_esi = 1, tf_ebp = -1079060792, tf_isp = -377782924, tf_ebx = 674260420, tf_edx = 140677888, tf_ecx = -2144570347, tf_eax = 54, tf_trapno = 12, tf_err = 2, tf_eip = 673731391, tf_cs = 31, tf_eflags = 582, tf_esp = -1079060884, tf_ss = 47}) at ../../../i386/i386/trap.c:1001 > #20 0xc073e38f in Xint0x80_syscall () at ../../../i386/i386/exception.s:201 > #21 0x0000002f in ?? () > [garbage] > #48 0xc3585900 in ?? () > #49 0xc05c6f90 in sched_switch (td=0x1, newtd=0x283065c4, flags=---Can't read userspace from dump, or kernel process--- > > ) at ../../../kern/sched_4bsd.c:881 > gdbcom:2: Error in sourced command file: > Previous frame inner to this frame (corrupt stack?)ok, how wonderful... we've recursed in the tty code... someone needs to fix filt_ttyread so that it doesn't process characters... filt_ttyread should be completely with out side effects, and simply return the current state of the tty descriptor... (filt_ttyread gets called from places where going off and doing lots of work is not good)... in the back trace below, it tried to process characters, which then tried to notify kqueue again, and lock the tty lock, which doesn't work... One easy fix is to fix ttnread to not call ttypend on calls from filt_ttyread via a flag... I can whip up a patch if you want to try it (and can easily reproduce)... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."