Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Sep 2003 01:46:12 -0700 (PDT)
From:      Alex Vasylenko <lxv@send2pr.sink.omut.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/56513: panic in ugen w/ moused -p /dev/ugen0 
Message-ID:  <200309060846.h868kCK5095007@mix.omut.org>
Resent-Message-ID: <200309060850.h868o6s2098323@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         56513
>Category:       kern
>Synopsis:       panic in ugen w/ moused -p /dev/ugen0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 06 01:50:05 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Alex Vasylenko
>Release:        FreeBSD 4.8-RELEASE-p4 i386
>Organization:
>Environment:
System: FreeBSD 4.8-RELEASE-p4


	
>Description:
	The panic happened on a 4.8-RELEASE-p4 system with a kernel built with
	"device uhci" and "device ugen" but no "device ums". I connected a USB
	mouse which got attached as ugen0 and started "moused -p /dev/ugen0 -t
	auto" which panicked the system.

	Please note that a kernel built with "device ums" or a loaded KLD ums.ko 
	works just fine.

	I find two things a bit weird: (1) the value of sc after USB_GET_SC 
	(!= ugen_devclass->devices[0]->softc);
	(2) the location of splusb (doesn't it have to be done a bit sooner)?

gdb -k kernel.1 vmcore.1
GNU gdb 4.18 (FreeBSD)
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 2627 in elfstab_build_psymtabs
Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dbxread.c line 933 in fill_symbuf

IdlePTD at phsyical address 0x00411000
initial pcb at physical address 0x003411a0
panicstr: page fault
panic messages:
---
Fatal trap 12: page fault while in kernel mode
fault virtual address	= 0x3
fault code		= supervisor read, page not present
instruction pointer	= 0x8:0xc0242c23
stack pointer	        = 0x10:0xd1b9ed30
frame pointer	        = 0x10:0xd1b9ed40
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 595 (moused)
interrupt mask		= bio 
trap number		= 12
panic: page fault

syncing disks... 18 3 3 3 3 3 3 3 10 
done
Uptime: 5m41s

dumping to dev #da/0x20001, offset 524288
dump 256 255 254 253 252 251 250 249 248 247 246 245 244 243 242 241 240 239 238 237 236 235 234 233 232 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
---
#0  dumpsys () at /usr/src/sys/kern/kern_shutdown.c:487
487		if (dumping++) {
(kgdb) where
#0  dumpsys () at /usr/src/sys/kern/kern_shutdown.c:487
#1  0xc01763ac in boot (howto=256) at /usr/src/sys/kern/kern_shutdown.c:316
#2  0xc01767e0 in poweroff_wait (junk=0xc02f0c6c, howto=-1070659697)
    at /usr/src/sys/kern/kern_shutdown.c:595
#3  0xc029bd8b in trap_fatal (frame=0xd1b9ecf0, eva=3) at /usr/src/sys/i386/i386/trap.c:974
#4  0xc029ba45 in trap_pfault (frame=0xd1b9ecf0, usermode=0, eva=3)
    at /usr/src/sys/i386/i386/trap.c:867
#5  0xc029b61b in trap (frame={tf_fs = -1050935280, tf_es = -776798192, tf_ds = 16, tf_edi = 64, 
      tf_esi = 0, tf_ebp = -776344256, tf_isp = -776344292, tf_ebx = -1050902308, 
      tf_edx = 6816320, tf_ecx = 31, tf_eax = 0, tf_trapno = 12, tf_err = 0, tf_eip = -1071371229, 
      tf_cs = 8, tf_eflags = 66050, tf_esp = -776344184, tf_ss = -1050874752})
    at /usr/src/sys/i386/i386/trap.c:466
#6  0xc0242c23 in ugenpoll (dev=0xc15cec80, events=64, p=0xd1b3ddc0)
    at /usr/src/sys/dev/usb/ugen.c:1345
#7  0xc01b0084 in spec_poll (ap=0xd1b9ed88) at /usr/src/sys/miscfs/specfs/spec_vnops.c:323
#8  0xc01afd65 in spec_vnoperate (ap=0xd1b9ed88) at /usr/src/sys/miscfs/specfs/spec_vnops.c:119
#9  0xc0229b45 in ufs_vnoperatespec (ap=0xd1b9ed88) at /usr/src/sys/ufs/ufs/ufs_vnops.c:2394
#10 0xc01ac58f in vn_poll (fp=0xc1821bc0, events=64, cred=0xc18c1700, p=0xd1b3ddc0)
    at vnode_if.h:458
#11 0xc018634b in selscan (p=0xd1b3ddc0, ibits=0xd1b9ee28, obits=0xd1b9ee1c, nfd=20)
    at /usr/src/sys/sys/file.h:193
#12 0xc01860ae in select (p=0xd1b3ddc0, uap=0xd1b9ef80) at /usr/src/sys/kern/sys_generic.c:746
#13 0xc029bff1 in syscall2 (frame={tf_fs = 47, tf_es = 47, tf_ds = 47, tf_edi = -1077937712, 
      tf_esi = 4, tf_ebp = -1077937984, tf_isp = -776343596, tf_ebx = -1077938112, tf_edx = 0, 
      tf_ecx = 3, tf_eax = 93, tf_trapno = 12, tf_err = 2, tf_eip = 403326216, tf_cs = 31, 
      tf_eflags = 647, tf_esp = -1077938188, tf_ss = 47}) at /usr/src/sys/i386/i386/trap.c:1175
#14 0xc028f3b5 in Xint0x80_syscall ()
#15 0x804c8cd in ?? ()
#16 0x804a298 in ?? ()
#17 0x80496b1 in ?? ()
#18 0x8048de6 in ?? ()
(kgdb) up 6
#6  0xc0242c23 in ugenpoll (dev=0xc15cec80, events=64, p=0xd1b3ddc0)
    at /usr/src/sys/dev/usb/ugen.c:1345
1345		switch (sce->edesc->bmAttributes & UE_XFERTYPE) {
(kgdb) l 1320
1315	}
1316	
1317	int
1318	ugenpoll(dev_t dev, int events, usb_proc_ptr p)
1319	{
1320		struct ugen_softc *sc;
1321		struct ugen_endpoint *sce;
1322		int revents = 0;
1323		int s;
1324	
(kgdb) 
1325		USB_GET_SC(ugen, UGENUNIT(dev), sc);
1326	
1327		if (sc->sc_dying)
1328			return (EIO);
1329	
1330		/* XXX always IN */
1331		sce = &sc->sc_endpoints[UGENENDPOINT(dev)][IN];
1332		if (sce == NULL)
1333			return (EINVAL);
1334	#ifdef DIAGNOSTIC
(kgdb) 
1335		if (!sce->edesc) {
1336			printf("ugenpoll: no edesc\n");
1337			return (EIO);
1338		}
1339		if (!sce->pipeh) {
1340			printf("ugenpoll: no pipe\n");
1341			return (EIO);
1342		}
1343	#endif
1344		s = splusb();
(kgdb) 
1345		switch (sce->edesc->bmAttributes & UE_XFERTYPE) {
1346		case UE_INTERRUPT:
1347			if (events & (POLLIN | POLLRDNORM)) {
1348				if (sce->q.c_cc > 0)
1349					revents |= events & (POLLIN | POLLRDNORM);
1350				else
1351					selrecord(p, &sce->rsel);
1352			}
1353			break;
1354		case UE_ISOCHRONOUS:
(kgdb) p sc
$1 = (struct ugen_softc *) 0x680240
(kgdb) p *sc
Cannot access memory at address 0x680240.
(kgdb) p *dev
$2 = {si_flags = 0, si_udev = 29184, si_hash = {le_next = 0xc15c4200, le_prev = 0xc1661508}, 
  si_hlist = {slh_first = 0xd1a48300}, si_name = "ugen0\000\000\000\000\000\000\000\000\000\000", 
  si_drv1 = 0x0, si_drv2 = 0x0, si_devsw = 0xc031b4a0, si_iosize_max = 65536, __si_u = {
    __si_tty = {__sit_tty = 0x0}, __si_disk = {__sid_disk = 0x0, __sid_mountpoint = 0x0, 
      __sid_bsize_phys = 0, __sid_bsize_best = 0}}}
(kgdb) p/x dev->si_udev
$3 = 0x7200
(kgdb) p ugen_devclass
$4 = 0xc15b7540
(kgdb) p *ugen_devclass
$5 = {link = {tqe_next = 0xc15b73c0, tqe_prev = 0xc15b75c0}, drivers = {tqh_first = 0x0, 
    tqh_last = 0xc15b7548}, name = 0xc15b755c "ugen", devices = 0xc15c5cd0, maxunit = 4}
(kgdb) p sce
$6 = (struct ugen_endpoint *) 0x680240
(kgdb) p *ugen_devclass->devices[0]
$7 = {link = {tqe_next = 0x0, tqe_prev = 0xc15c600c}, parent = 0xc15c6000, children = {
    tqh_first = 0x0, tqh_last = 0xc15ced0c}, ops = 0xc15b7580, driver = 0xc031b504, 
  devclass = 0xc15b7540, unit = 0, nameunit = 0xc15c5cb0 "ugen0", 
  desc = 0xc15c2900 "B16_b_02 USB-PS/2 Optical Mouse, rev 2.00/98.02, addr 2", busy = 0, 
  state = DS_ATTACHED, devflags = 0, flags = 61, order = 0 '\000', pad = 0 '\000', 
  ivars = 0xc0414de4, softc = 0xc15c8000}


>How-To-Repeat:
	On a machine with no ums driver (no ums.ko loaded and no "device ums"
	in a running kernel):
	- attach a USB mouse;
	- issue: 'moused -p /dev/ugen0 -t auto' (assuming the mouse is attached
	as ugen0)
>Fix:

	


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309060846.h868kCK5095007>