Hello Dear maintainer!
A new bug was found by our modified syzkaller.
Kernel version: v6.9-rc7
Compiler: gcc 11.4.0
Reproducer & Kernel: attachment
=============
usb 2-1: USB disconnect, device number 76
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 0 PID: 54060 Comm: kworker/0:1 Not tainted 6.9.0-rc7 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
Workqueue: usb_hub_wq hub_event
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x116/0x1b0 lib/dump_stack.c:114
assign_lock_key kernel/locking/lockdep.c:976 [inline]
register_lock_class+0xc18/0xfa0 kernel/locking/lockdep.c:1289
__lock_acquire+0x108/0x3bc0 kernel/locking/lockdep.c:5014
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1b0/0x550 kernel/locking/lockdep.c:5719
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
skb_dequeue+0x20/0x180 net/core/skbuff.c:3846
rtl_usb_cleanup drivers/net/wireless/realtek/rtlwifi/usb.c:706 [inline]
rtl_usb_deinit drivers/net/wireless/realtek/rtlwifi/usb.c:721 [inline]
rtl_usb_disconnect+0x4a4/0x850
drivers/net/wireless/realtek/rtlwifi/usb.c:1051
usb_unbind_interface+0x1e8/0x980 drivers/usb/core/driver.c:461
device_remove drivers/base/dd.c:568 [inline]
device_remove+0x122/0x170 drivers/base/dd.c:560
__device_release_driver drivers/base/dd.c:1270 [inline]
device_release_driver_internal+0x443/0x620 drivers/base/dd.c:1293
bus_remove_device+0x22f/0x420 drivers/base/bus.c:574
device_del+0x395/0x9f0 drivers/base/core.c:3909
usb_disable_device+0x360/0x7b0 drivers/usb/core/message.c:1418
usb_disconnect+0x2db/0x930 drivers/usb/core/hub.c:2305
hub_port_connect drivers/usb/core/hub.c:5362 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5662 [inline]
port_event drivers/usb/core/hub.c:5822 [inline]
hub_event+0x1e39/0x4ce0 drivers/usb/core/hub.c:5904
process_one_work+0x97b/0x1a90 kernel/workqueue.c:3267
process_scheduled_works kernel/workqueue.c:3348 [inline]
worker_thread+0x680/0xf00 kernel/workqueue.c:3429
kthread+0x2c7/0x3b0 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>
BUG: unable to handle page fault for address: ffffffffffffffd8
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 82a4067 P4D 82a4067 PUD 82a6067 PMD 0
Oops: 0002 [#1] PREEMPT SMP KASAN NOPTI
CPU: 0 PID: 54060 Comm: kworker/0:1 Not tainted 6.9.0-rc7 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org 04/01/2014
Workqueue: usb_hub_wq hub_event
RIP: 0010:arch_atomic_fetch_add arch/x86/include/asm/atomic.h:97 [inline]
RIP: 0010:raw_atomic_fetch_add_relaxed
include/linux/atomic/atomic-arch-fallback.h:749 [inline]
RIP: 0010:atomic_fetch_add_relaxed
include/linux/atomic/atomic-instrumented.h:253 [inline]
RIP: 0010:__refcount_add include/linux/refcount.h:184 [inline]
RIP: 0010:__refcount_inc include/linux/refcount.h:241 [inline]
RIP: 0010:refcount_inc include/linux/refcount.h:258 [inline]
RIP: 0010:kref_get include/linux/kref.h:45 [inline]
RIP: 0010:usb_get_urb.part.0+0x1c/0x90 drivers/usb/core/urb.c:114
Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 55 48 89 fd 53 bb 01 00 00
00 e8 71 1a 34 fd be 04 00 00 00 48 89 ef e8 34 be 84 fd <f0> 0f c1 5d 00
31 ff 89 de e8 f6 15 34 fd 85 db 74 47 e8 4d 1a 34
RSP: 0018:ffffc90009c9f6d0 EFLAGS: 00010046
RAX: 0000000000000001 RBX: 0000000000000001 RCX: ffffffff841dedbc
RDX: fffffbfffffffffc RSI: 0000000000000004 RDI: ffffffffffffffd8
RBP: ffffffffffffffd8 R08: 0000000000000001 R09: fffffbfffffffffb
R10: ffffffffffffffdb R11: 6f72665f74657220 R12: ffff888142190228
R13: ffffffffffffffd8 R14: ffff888142190288 R15: dffffc0000000000
FS: 0000000000000000(0000) GS:ffff8881f6400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd8 CR3: 0000000118d8e000 CR4: 0000000000750ef0
PKRU: 55555554
Call Trace:
<TASK>
usb_get_urb drivers/usb/core/urb.c:816 [inline]
usb_kill_anchored_urbs+0xa5/0x380 drivers/usb/core/urb.c:819
rtl_usb_cleanup drivers/net/wireless/realtek/rtlwifi/usb.c:713 [inline]
rtl_usb_deinit drivers/net/wireless/realtek/rtlwifi/usb.c:721 [inline]
rtl_usb_disconnect+0x4d7/0x850
drivers/net/wireless/realtek/rtlwifi/usb.c:1051
usb_unbind_interface+0x1e8/0x980 drivers/usb/core/driver.c:461
device_remove drivers/base/dd.c:568 [inline]
device_remove+0x122/0x170 drivers/base/dd.c:560
__device_release_driver drivers/base/dd.c:1270 [inline]
device_release_driver_internal+0x443/0x620 drivers/base/dd.c:1293
bus_remove_device+0x22f/0x420 drivers/base/bus.c:574
device_del+0x395/0x9f0 drivers/base/core.c:3909
usb_disable_device+0x360/0x7b0 drivers/usb/core/message.c:1418
usb_disconnect+0x2db/0x930 drivers/usb/core/hub.c:2305
hub_port_connect drivers/usb/core/hub.c:5362 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5662 [inline]
port_event drivers/usb/core/hub.c:5822 [inline]
hub_event+0x1e39/0x4ce0 drivers/usb/core/hub.c:5904
process_one_work+0x97b/0x1a90 kernel/workqueue.c:3267
process_scheduled_works kernel/workqueue.c:3348 [inline]
worker_thread+0x680/0xf00 kernel/workqueue.c:3429
kthread+0x2c7/0x3b0 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
</TASK>
Modules linked in:
CR2: ffffffffffffffd8
---[ end trace 0000000000000000 ]---
RIP: 0010:arch_atomic_fetch_add arch/x86/include/asm/atomic.h:97 [inline]
RIP: 0010:raw_atomic_fetch_add_relaxed
include/linux/atomic/atomic-arch-fallback.h:749 [inline]
RIP: 0010:atomic_fetch_add_relaxed
include/linux/atomic/atomic-instrumented.h:253 [inline]
RIP: 0010:__refcount_add include/linux/refcount.h:184 [inline]
RIP: 0010:__refcount_inc include/linux/refcount.h:241 [inline]
RIP: 0010:refcount_inc include/linux/refcount.h:258 [inline]
RIP: 0010:kref_get include/linux/kref.h:45 [inline]
RIP: 0010:usb_get_urb.part.0+0x1c/0x90 drivers/usb/core/urb.c:114
Code: 90 90 90 90 90 90 90 90 90 90 90 90 90 90 55 48 89 fd 53 bb 01 00 00
00 e8 71 1a 34 fd be 04 00 00 00 48 89 ef e8 34 be 84 fd <f0> 0f c1 5d 00
31 ff 89 de e8 f6 15 34 fd 85 db 74 47 e8 4d 1a 34
RSP: 0018:ffffc90009c9f6d0 EFLAGS: 00010046
RAX: 0000000000000001 RBX: 0000000000000001 RCX: ffffffff841dedbc
RDX: fffffbfffffffffc RSI: 0000000000000004 RDI: ffffffffffffffd8
RBP: ffffffffffffffd8 R08: 0000000000000001 R09: fffffbfffffffffb
R10: ffffffffffffffdb R11: 6f72665f74657220 R12: ffff888142190228
R13: ffffffffffffffd8 R14: ffff888142190288 R15: dffffc0000000000
FS: 0000000000000000(0000) GS:ffff8881f6400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd8 CR3: 0000000118d8e000 CR4: 0000000000750ef0
PKRU: 55555554
----------------
Code disassembly (best guess):
0: 90 nop
1: 90 nop
2: 90 nop
3: 90 nop
4: 90 nop
5: 90 nop
6: 90 nop
7: 90 nop
8: 90 nop
9: 90 nop
a: 90 nop
b: 90 nop
c: 90 nop
d: 90 nop
e: 55 push %rbp
f: 48 89 fd mov %rdi,%rbp
12: 53 push %rbx
13: bb 01 00 00 00 mov $0x1,%ebx
18: e8 71 1a 34 fd call 0xfd341a8e
1d: be 04 00 00 00 mov $0x4,%esi
22: 48 89 ef mov %rbp,%rdi
25: e8 34 be 84 fd call 0xfd84be5e
* 2a: f0 0f c1 5d 00 lock xadd %ebx,0x0(%rbp) <-- trapping instruction
2f: 31 ff xor %edi,%edi
31: 89 de mov %ebx,%esi
33: e8 f6 15 34 fd call 0xfd34162e
38: 85 db test %ebx,%ebx
3a: 74 47 je 0x83
3c: e8 .byte 0xe8
3d: 4d rex.WRB
3e: 1a .byte 0x1a
3f: 34 .byte 0x34
Shichao Lai <[email protected]> wrote:
> Hello Dear maintainer!
> A new bug was found by our modified syzkaller.
>
> Kernel version: v6.9-rc7
> Compiler: gcc 11.4.0
> Reproducer & Kernel: attachment
>
> =============
> usb 2-1: USB disconnect, device number 76
> INFO: trying to register non-static key.
> The code is fine but needs lockdep annotation, or maybe
> you didn't initialize this object before use?
> turning off the locking correctness validator.
I'm not familiar with syzkaller, which seems like to generate a USB pattern
to trigger driver probe, not a real hardware. If my thought is correct,
attachment could be a fix that causes failed to probe device, and then
not execute USB disconnection.
I used your attached linux-v6.9_usb_config to build a kernel, but failed
to run on a real NB. So is it possible to help test my attached patch?
Or, can I use a " #syz test:" command to trigger robot like [1]?
[1] https://lore.kernel.org/linux-rdma/[email protected]/T/#m2d374949d62b017074545c2f2a1df9251e0bde32
Ping-Ke
Shichao Lai <[email protected]> wrote:
>
> It seems to work correctly! No warnning occurs.
> If you are to add a patch, please add the following tag to the commit:
> Reported-by: Shichao Lai <mailto:[email protected]>
Added, also added Tested-by [1].
[1] https://lore.kernel.org/linux-wireless/[email protected]/T/#u