Bug 129311

Summary: [usb] [panic] Instant crash with an USB card reader
Product: Base System Reporter: stephleg
Component: usbAssignee: freebsd-usb (Nobody) <usb>
Status: Open ---    
Severity: Affects Only Me    
Priority: Normal    
Version: 7.1-PRERELEASE   
Hardware: Any   
OS: Any   

Description stephleg 2008-11-30 21:00:06 UTC
Hello,

I recently purchased an USB adapter to read SD cards. On my first try, i made a mistake and put the SD card on the wrong side. This instantantly crashed my FreeBSD system. Here is the KDB output : 


There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...

..
Unread portion of the kernel message buffer:
panic: kmem_malloc(1848643584): kmem_map too small: 43110400 total allocated
cpuid = 0
Uptime: 7h51m49s
Physical memory: 1002 MB
Dumping 183 MB: 168 152 136 120 104 88 72 56 40 24 8
..
Loaded symbols for /boot/kernel/drm.ko
#0  doadump () at pcpu.h:196
196		__asm __volatile("movl %%fs:0,%0" : "=r" (td));
(kgdb) list
191	static __inline struct thread *
192	__curthread(void)
193	{
194		struct thread *td;
195	
196		__asm __volatile("movl %%fs:0,%0" : "=r" (td));
197		return (td);
198	}
199	#define	curthread		(__curthread())
200	
(kgdb) backtrace
#0  doadump () at pcpu.h:196
#1  0xc0754a8f in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:418
#2  0xc0754d54 in panic (fmt=Variable "fmt" is not available.
) at /usr/src/sys/kern/kern_shutdown.c:574
#3  0xc0965432 in kmem_malloc (map=0xc147108c, size=1848643584, flags=2) at /usr/src/sys/vm/vm_kern.c:312
#4  0xc095c29a in page_alloc (zone=0x0, bytes=1848643584, pflag=0xe4276b4f "\002", wait=2) at /usr/src/sys/vm/uma_core.c:959
#5  0xc095ec0b in uma_large_malloc (size=1848643584, wait=2) at /usr/src/sys/vm/uma_core.c:2713
#6  0xc0745aa4 in malloc (size=1848643584, mtp=0xc0b324a0, flags=2) at /usr/src/sys/kern/kern_malloc.c:393
#7  0xc0700b2c in g_read_data (cp=0xc6644c80, offset=Unhandled dwarf expression opcode 0x93
) at geom.h:300
#8  0xc06fb6a8 in g_bsd_try (gp=Variable "gp" is not available.
) at /usr/src/sys/geom/geom_bsd.c:211
#9  0xc06fbbf7 in g_bsd_taste (mp=0xc0b321e0, pp=0xc5a23580, flags=0) at /usr/src/sys/geom/geom_bsd.c:549
#10 0xc0703401 in g_new_provider_event (arg=0xc5a23580, flag=0) at /usr/src/sys/geom/geom_subr.c:543
#11 0xc07000bf in g_run_events () at /usr/src/sys/geom/geom_event.c:211
#12 0xc0701317 in g_event_procbody () at /usr/src/sys/geom/geom_kern.c:141
#13 0xc0732d11 in fork_exit (callout=0xc07012ac <g_event_procbody>, arg=0x0, frame=0xe4276d38) at /usr/src/sys/kern/kern_fork.c:804
#14 0xc09d31d0 in fork_trampoline () at /usr/src/sys/i386/i386/exception.s:264


Of course, this crash should never happen as i'm supposed to put the SD card on the right side :-) But i prefer to send this PR in case this could be avoided.

By the way, when the SD card is put on the right side, it works perfectly well.

Regards,
St├ęphane Legrand.

Fix: 

Put the SD card on the right side! :-)
How-To-Repeat: Plug the USB card reader with a SD card put on the wrong side.
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:03 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped