[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
For the other folks that see this, it does seem to help to use the reset button slower, for what its worth. Possibly offers a better disconnect/reconnect timing. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
This still seems to be happening on 5.8. Different board yet again, but same situation. Crashes every 1/X times when resetting the board. I don't have logs of the actual crash (ZFS root maybe?), but it locks up right after the "failed to set dtr/rts" like the others reported here, with similar logs up to that point. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
[Expired for linux (Ubuntu) because there has been no activity for 60 days.] ** Changed in: linux (Ubuntu) Status: Incomplete => Expired -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
I brought this up on the linux-usb email list and was told it was more likely to be an issue in the filesystem code. In addition, that code (and the USB code) don't expect an MSC USB device to behave badly, and there's no guarantee that if it does, Linux will not crash. In this case, the filesystem changes abruptly out from under the filesystem code. linux-usb thread: https://marc.info/?l=linux-usb=159387610928589=2 I suppose you can close this now. I wish Linux were more robust about this, but it appears to be a "won't fix" from their point of view. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
Thank you. Attaching lspci-v output in preparation for reporting to the linux-usb mailing list. lsusb -v output is already attached to the first port. ** Attachment added: "lspci-v.txt" https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+attachment/5389646/+files/lspci-v.txt -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
Please raise the issue to linux-usb mailing list. Possible use-after- free bug here. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
I'm wrong, I got this to happen on 4.10, which is quite old, so I'm not sure if it's worth going back much further in time. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
I was able to reproduce the problem after a few tries with the 5.7.0-050700-generic kernel. I then started trying older kernels. It appears the problem started somewhere between 4.10.0 an 4.18.0. But sometimes it takes several tries to reproduce, so I'll continue some ad- hoc bisecting to see if I can narrow it down. For posterity, here is how I'm reproducing. It may take several tries, but it seems to happen about 1/3 of the time. I don't expect you to need to follow all of this for now: Using CircuitPython 5.3.0 on Adafruit Metro M0 board. Connect to REPL and do: >>> import storage >>> storage.erase_filesystem() can cause an immediate kernel crash, or it might be delayed by several seconds. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
Since the system is upgraded from 16.04, have you tried any older kernel? This could be a regression. Also, please test latest mainline kernel: https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.7 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
Thanks for the reply. TinyUSB runs on the microcontroller board; it is the USB stack implementation used by the software on the board. So it doesn't touch the kernel, by definition. It is behaving in some way that is unexpected to the Linux driver, and causing bad behavior on the part of the driver. It is possible this is a timing or kernel driver state machine. These crashes occur when I reset the board. So the USB device is forcibly disconnected, and then immediately tries to re-enumerate. This is much faster than the usual unplug/replug time you might see, if say, you unplugged a replugged a USB keyboard or USB flash drive. Would a USB trace be helpful to you? I can use a Beagle and get a trace file. Is this the right place to continue discussing this bug, or should it be in some Linux kernel bug system? Thanks. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
Disconnect: [76704.227672] cdc_acm 1-1.4:1.0: failed to set dtr/rts [76704.936301] usb 1-1.4: USB disconnect, device number 11 Reprobe: [76707.579590] usb 1-1.4: new full-speed USB device number 12 using ehci-pci Then: [76707.692717] general protection fault: [#1] SMP PTI Could be use after free, or stack corruption. Probably some resources aren't freed in USB stack. Does TinyUSB touch anything inside kernel? ** Changed in: linux (Ubuntu) Status: Confirmed => Incomplete -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1871143 Title: Kernel crash during USB device enumeration or mounting To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
Another crash, with a different backtrace. with a different board, but related USB implementation. Since the report above, the underlying USB implementation on the boards has changed somewhat, but the circumstances of the crash are similar: [40859.232293] usb 1-1.3: USB disconnect, device number 34 [40859.250102] FAT-fs (sdc): unable to read boot sector to mark fs as dirty [40862.270362] usb 1-1.3: new full-speed USB device number 35 using ehci-pci [40862.387543] usb 1-1.3: New USB device found, idVendor=239a, idProduct=8014, bcdDevice= 1.00 [40862.387546] usb 1-1.3: New USB device strings: Mfr=2, Product=3, SerialNumber=1 [40862.387548] usb 1-1.3: Product: Metro M0 Express [40862.387550] usb 1-1.3: Manufacturer: Adafruit Industries LLC [40862.387552] usb 1-1.3: SerialNumber: DFAE9D970323D4050213E2932141E0FF [40862.388969] cdc_acm 1-1.3:1.0: ttyACM0: USB ACM device [40862.392200] usb-storage 1-1.3:1.2: USB Mass Storage device detected [40862.392599] scsi host6: usb-storage 1-1.3:1.2 [40862.397276] input: Adafruit Industries LLC Metro M0 Express Keyboard as /devices/pci:00/:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.3/0003:239A:8014.0016/input/input97 [40862.454787] input: Adafruit Industries LLC Metro M0 Express Mouse as /devices/pci:00/:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.3/0003:239A:8014.0016/input/input98 [40862.455133] input: Adafruit Industries LLC Metro M0 Express Consumer Control as /devices/pci:00/:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.3/0003:239A:8014.0016/input/input99 [40862.455322] input: Adafruit Industries LLC Metro M0 Express as /devices/pci:00/:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.3/0003:239A:8014.0016/input/input100 [40862.455689] hid-generic 0003:239A:8014.0016: input,hidraw3: USB HID v1.11 Keyboard [Adafruit Industries LLC Metro M0 Express] on usb-:00:1a.0-1.3/input3 [40863.416330] scsi host6: scsi scan: INQUIRY result too short (5), using 36 [40863.416338] scsi 6:0:0:0: Direct-Access Adafruit Metro M0 Express 1.0 PQ: 0 ANSI: 2 [40863.416732] sd 6:0:0:0: Attached scsi generic sg3 type 0 [40863.418307] sd 6:0:0:0: [sdc] 4089 512-byte logical blocks: (2.09 MB/2.00 MiB) [40863.419611] sd 6:0:0:0: [sdc] Write Protect is off [40863.419615] sd 6:0:0:0: [sdc] Mode Sense: 03 00 00 00 [40863.420650] sd 6:0:0:0: [sdc] No Caching mode page found [40863.420656] sd 6:0:0:0: [sdc] Assuming drive cache: write through [40863.464434] sdc: sdc1 [40863.472071] sd 6:0:0:0: [sdc] Attached SCSI removable disk [40864.285807] FAT-fs (sdc1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck. [40866.329111] cdc_acm 1-1.3:1.0: failed to set dtr/rts [40866.349335] general protection fault: [#1] SMP PTI [40866.349339] CPU: 3 PID: 134345 Comm: systemd-udevd Kdump: loaded Not tainted 5.4.0-28-generic #32-Ubuntu [40866.349340] Hardware name: Dell Inc. OptiPlex 7010/0WR7PY, BIOS A29 06/28/2018 [40866.349346] RIP: 0010:kmem_cache_alloc_trace+0x88/0x230 [40866.349348] Code: 65 49 8b 50 08 65 4c 03 05 fd 95 36 60 4d 8b 38 4d 85 ff 0f 84 80 01 00 00 41 8b 59 20 49 8b 39 48 8d 4a 01 4c 89 f8 4c 01 fb <48> 33 1b 49 33 99 70 01 00 00 65 48 0f c7 0f 0f 94 c0 84 c0 74 bd [40866.349349] RSP: 0018:a5f589357bf0 EFLAGS: 00010206 [40866.349350] RAX: 02f74afdcaf6e6c0 RBX: 02f74afdcaf6e6c0 RCX: 001b8e41 [40866.349351] RDX: 001b8e40 RSI: 0dc0 RDI: 0002f100 [40866.349352] RBP: a5f589357c20 R08: 935a0e1af100 R09: 935a0c403180 [40866.349353] R10: 0001 R11: 0006 R12: 0dc0 [40866.349354] R13: 0098 R14: 935a0c403180 R15: 02f74afdcaf6e6c0 [40866.349355] FS: 7f4619b2e880() GS:935a0e18() knlGS: [40866.349356] CS: 0010 DS: ES: CR0: 80050033 [40866.349357] CR2: 55c433bfa8b0 CR3: 000111b80005 CR4: 001606e0 [40866.349358] Call Trace: [40866.349363] ? kernfs_fop_open+0xc2/0x3b0 [40866.349366] kernfs_fop_open+0xc2/0x3b0 [40866.349368] ? kernfs_fop_read+0x1b0/0x1b0 [40866.349372] do_dentry_open+0x143/0x3a0 [40866.349373] vfs_open+0x2d/0x30 [40866.349376] do_last+0x194/0x900 [40866.349392] path_openat+0x8d/0x290 [40866.349394] do_filp_open+0x91/0x100 [40866.349397] ? __alloc_fd+0x46/0x150 [40866.349398] do_sys_open+0x17e/0x290 [40866.349400] __x64_sys_openat+0x20/0x30 [40866.349402] do_syscall_64+0x57/0x190 [40866.349405] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [40866.349407] RIP: 0033:0x7f461a0a3d1b [40866.349409] Code: 25 00 00 41 00 3d 00 00 41 00 74 4b 64 8b 04 25 18 00 00 00 85 c0 75 67 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 91 00 00 00 48 8b 4c 24 28 64 48 33 0c 25 [40866.349410] RSP: 002b:7ffd5b8a6190 EFLAGS: 0246 ORIG_RAX: 0101 [40866.349411] RAX: ffda RBX: 55c433b7e9b0 RCX: 7f461a0a3d1b [40866.349412] RDX: 0008 RSI: 7ffd5b8a6300 RDI: ff9c [40866.349413] RBP: 7ffd5b8a6300 R08:
[Bug 1871143] Re: Kernel crash during USB device enumeration or mounting
Key part of dmesg is: [76704.227672] cdc_acm 1-1.4:1.0: failed to set dtr/rts [76704.936301] usb 1-1.4: USB disconnect, device number 11 [76704.951638] blk_update_request: I/O error, dev sdc, sector 1110 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76704.951644] Buffer I/O error on dev sdc1, logical block 1109, lost async page write [76704.951647] Buffer I/O error on dev sdc1, logical block 1110, lost async page write [76704.951656] blk_update_request: I/O error, dev sdc, sector 1128 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76704.951658] Buffer I/O error on dev sdc1, logical block 1127, lost async page write [76704.951661] Buffer I/O error on dev sdc1, logical block 1128, lost async page write [76704.951679] blk_update_request: I/O error, dev sdc, sector 1150 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76704.951682] Buffer I/O error on dev sdc1, logical block 1149, lost async page write [76704.951684] Buffer I/O error on dev sdc1, logical block 1150, lost async page write [76704.951689] blk_update_request: I/O error, dev sdc, sector 1174 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76704.951691] Buffer I/O error on dev sdc1, logical block 1173, lost async page write [76704.951693] Buffer I/O error on dev sdc1, logical block 1174, lost async page write [76704.951717] blk_update_request: I/O error, dev sdc, sector 1194 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76704.951718] Buffer I/O error on dev sdc1, logical block 1193, lost async page write [76704.951719] Buffer I/O error on dev sdc1, logical block 1194, lost async page write [76704.951722] blk_update_request: I/O error, dev sdc, sector 1212 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76704.951734] blk_update_request: I/O error, dev sdc, sector 1232 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76704.951739] blk_update_request: I/O error, dev sdc, sector 1252 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76704.951748] blk_update_request: I/O error, dev sdc, sector 1272 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76704.951751] blk_update_request: I/O error, dev sdc, sector 1290 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0 [76707.579590] usb 1-1.4: new full-speed USB device number 12 using ehci-pci [76707.691410] usb 1-1.4: New USB device found, idVendor=239a, idProduct=8014, bcdDevice= 1.00 [76707.691413] usb 1-1.4: New USB device strings: Mfr=2, Product=3, SerialNumber=1 [76707.691415] usb 1-1.4: Product: Metro M0 Express [76707.691417] usb 1-1.4: Manufacturer: Adafruit Industries LLC [76707.691418] usb 1-1.4: SerialNumber: DFAE9D970323D4050213E2932141E0FF [76707.692717] general protection fault: [#1] SMP PTI [76707.692723] CPU: 3 PID: 75883 Comm: kworker/3:1 Kdump: loaded Not tainted 5.4.0-21-generic #25-Ubuntu [76707.692725] Hardware name: Dell Inc. OptiPlex 7010/0WR7PY, BIOS A29 06/28/2018 [76707.692732] Workqueue: usb_hub_wq hub_event [76707.692738] RIP: 0010:__kmalloc+0xa5/0x270 [76707.692741] Code: 65 49 8b 50 08 65 4c 03 05 40 a0 76 4d 4d 8b 38 4d 85 ff 0f 84 93 01 00 00 41 8b 59 20 49 8b 39 48 8d 4a 01 4c 89 f8 4c 01 fb <48> 33 1b 49 33 99 70 01 00 00 65 48 0f c7 0f 0f 94 c0 84 c0 74 bd [76707.692743] RSP: 0018:a85b4316f6c0 EFLAGS: 00010286 [76707.692745] RAX: af73d556 RBX: af73d556 RCX: 00140e86 [76707.692747] RDX: 00140e85 RSI: 0cc0 RDI: 0002f100 [76707.692749] RBP: a85b4316f6f0 R08: 8ef6ce1af100 R09: 8ef6cc403180 [76707.692751] R10: 0cc0 R11: 01320122 R12: 0cc0 [76707.692752] R13: 00b8 R14: 8ef6cc403180 R15: af73d556 [76707.692755] FS: () GS:8ef6ce18() knlGS: [76707.692757] CS: 0010 DS: ES: CR0: 80050033 [76707.692758] CR2: 7fd69c2ee000 CR3: 000210f8e006 CR4: 001606e0 [76707.692760] Call Trace: [76707.692767] ? usb_alloc_urb+0x29/0x60 [76707.692772] usb_alloc_urb+0x29/0x60 [76707.692779] acm_probe+0x6da/0xdb0 [cdc_acm] [76707.692786] usb_probe_interface+0xed/0x290 [76707.692792] really_probe+0x2b3/0x3e0 [76707.692796] driver_probe_device+0xbc/0x100 [76707.692799] __device_attach_driver+0x71/0xd0 [76707.692803] ? driver_allows_async_probing+0x50/0x50 [76707.692807] bus_for_each_drv+0x84/0xd0 [76707.692810] __device_attach+0xe1/0x160 [76707.692814] device_initial_probe+0x13/0x20 [76707.692817] bus_probe_device+0x8f/0xa0 [76707.692820] device_add+0x3c7/0x6b0 [76707.692825] ? _cond_resched+0x19/0x30 [76707.692828] usb_set_configuration+0x433/0x7d0 [76707.692833] ? kernfs_activate+0x77/0x80 [76707.692836] generic_probe+0x43/0x60 [76707.692839] usb_probe_device+0x31/0x70 [76707.692842] really_probe+0x2b3/0x3e0 [76707.692846] driver_probe_device+0xbc/0x100 [76707.692849] __device_attach_driver+0x71/0xd0 [76707.692853] ? driver_allows_async_probing+0x50/0x50 [76707.692856] bus_for_each_drv+0x84/0xd0 [76707.692860]