Re: kernel BUG at mm/usercopy.c when using usbip

From: Shuah Khan
Date: Thu Jan 12 2023 - 10:21:53 EST


On 1/12/23 01:40, Sosthène Guédon wrote:
Hi!

I have stumbled upon a bug that is triggered reliably by using usbip.

We are using usbip to test our firmware. usbip attach works, but once `opgpcard-tools` interacts with the firmware through pcscd, a kernel bug happens.
Then usbip stops working, and `lsusb` as well as other tools interacting with usb devices hang.
The symptoms are similar to https://bugzilla.kernel.org/show_bug.cgi?id=215487 but the kernel bug is not the same (see attached dmesg logs).

The bug can be reproduced on arch (Linux archlinux 6.1.4-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 07 Jan 2023 15:10:07 +0000 x86_64 GNU/Linux
) and debian (Linux nitropc 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux), though the reproduction is not minimal.

To reproduce the bug on Arch Linux, with the packages rust, pcsclite, and openpgp-card-tools installed:

- Compile and run the usbip runner from this PR: https://github.com/Nitrokey/nitrokey-3-firmware/pull/149 (`cd nitrokey-3-firmware/runners/usbip && cargo run --features alpha`)
- Run `usbip attach -r localhost -b 1-1`
- Run `pcscd`
- Run `opgpcard status`

The bug should happen.


Thank you for reporting the problem. I will take a look and
get back to you with possible fix. Will you be able to test
fixes?

thanks,
-- Shuah