[v5.15] KASAN: use-after-free Read in usb_anchor_resume_wakeups

5 views
Skip to first unread message

syzbot

unread,
May 31, 2023, 6:46:55 PM5/31/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 0ab06468cbd1 Linux 5.15.114
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14c90cd1280000
kernel config: https://syzkaller.appspot.com/x/.config?x=9a2696a271d0eba
dashboard link: https://syzkaller.appspot.com/bug?extid=3a7c49677981eae35226
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8ff3613d3f6b/disk-0ab06468.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/eebe2d8c6813/vmlinux-0ab06468.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f30284c26197/Image-0ab06468.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3a7c49...@syzkaller.appspotmail.com

xpad 1-1:179.65: xpad_irq_in - usb_submit_urb failed with result -19
xpad 1-1:179.65: xpad_irq_out - usb_submit_urb failed with result -19
==================================================================
BUG: KASAN: use-after-free in register_lock_class+0x610/0x6a4 kernel/locking/lockdep.c:1294
Read of size 1 at addr ffff0000d4b0a091 by task syz-fuzzer/3997

CPU: 1 PID: 3997 Comm: syz-fuzzer Not tainted 5.15.114-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x174/0x1e4 mm/kasan/report.c:451
__asan_report_load1_noabort+0x44/0x50 mm/kasan/report_generic.c:306
register_lock_class+0x610/0x6a4 kernel/locking/lockdep.c:1294
__lock_acquire+0x184/0x7620 kernel/locking/lockdep.c:4890
lock_acquire+0x240/0x77c kernel/locking/lockdep.c:5622
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xc4/0x14c kernel/locking/spinlock.c:162
__wake_up_common_lock kernel/sched/wait.c:137 [inline]
__wake_up+0xe8/0x1a0 kernel/sched/wait.c:157
usb_anchor_resume_wakeups+0xcc/0x12c drivers/usb/core/urb.c:958
__usb_hcd_giveback_urb+0x314/0x518 drivers/usb/core/hcd.c:1673
usb_hcd_giveback_urb+0x108/0x41c drivers/usb/core/hcd.c:1753
dummy_timer+0x66c/0x26cc drivers/usb/gadget/udc/dummy_hcd.c:1987
call_timer_fn+0x19c/0x8f0 kernel/time/timer.c:1421
expire_timers kernel/time/timer.c:1466 [inline]
__run_timers+0x554/0x718 kernel/time/timer.c:1737
run_timer_softirq+0x7c/0x114 kernel/time/timer.c:1750
__do_softirq+0x344/0xe20 kernel/softirq.c:558
do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline]
invoke_softirq kernel/softirq.c:439 [inline]
__irq_exit_rcu+0x28c/0x534 kernel/softirq.c:636
irq_exit+0x14/0x88 kernel/softirq.c:660
handle_domain_irq+0xf4/0x178 kernel/irq/irqdesc.c:710
gic_handle_irq+0x78/0x1c8 drivers/irqchip/irq-gic-v3.c:757
call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:899
do_interrupt_handler+0x74/0x94 arch/arm64/kernel/entry-common.c:267
el1_interrupt+0x30/0x58 arch/arm64/kernel/entry-common.c:442
el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:458
el1h_64_irq+0x78/0x7c arch/arm64/kernel/entry.S:580
arch_local_irq_restore arch/arm64/include/asm/irqflags.h:122 [inline]
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
_raw_spin_unlock_irqrestore+0xbc/0x158 kernel/locking/spinlock.c:194
spin_unlock_irqrestore include/linux/spinlock.h:418 [inline]
__wake_up_common_lock kernel/sched/wait.c:140 [inline]
__wake_up_sync_key+0x124/0x1ac kernel/sched/wait.c:205
pipe_write+0xde0/0x1a4c fs/pipe.c:593
call_write_iter include/linux/fs.h:2103 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0x87c/0xb3c fs/read_write.c:594
ksys_write+0x15c/0x26c fs/read_write.c:647
__do_sys_write fs/read_write.c:659 [inline]
__se_sys_write fs/read_write.c:656 [inline]
__arm64_sys_write+0x7c/0x90 fs/read_write.c:656
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181
el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:596
el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:614
el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584

Allocated by task 4062:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
__kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
kasan_kmalloc include/linux/kasan.h:264 [inline]
kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
xpad_probe+0x350/0x165c drivers/input/joystick/xpad.c:1779
usb_probe_interface+0x500/0x984 drivers/usb/core/driver.c:396
really_probe+0x26c/0xaec drivers/base/dd.c:595
__driver_probe_device+0x194/0x3b4 drivers/base/dd.c:755
driver_probe_device+0x78/0x34c drivers/base/dd.c:785
__device_attach_driver+0x28c/0x4d8 drivers/base/dd.c:907
bus_for_each_drv+0x158/0x1e0 drivers/base/bus.c:427
__device_attach+0x2f0/0x480 drivers/base/dd.c:979
device_initial_probe+0x24/0x34 drivers/base/dd.c:1028
bus_probe_device+0xbc/0x1c8 drivers/base/bus.c:487
device_add+0xae0/0xef4 drivers/base/core.c:3394
usb_set_configuration+0x15e0/0x1b60 drivers/usb/core/message.c:2170
usb_generic_driver_probe+0x8c/0x148 drivers/usb/core/generic.c:238
usb_probe_device+0x120/0x25c drivers/usb/core/driver.c:293
really_probe+0x26c/0xaec drivers/base/dd.c:595
__driver_probe_device+0x194/0x3b4 drivers/base/dd.c:755
driver_probe_device+0x78/0x34c drivers/base/dd.c:785
__device_attach_driver+0x28c/0x4d8 drivers/base/dd.c:907
bus_for_each_drv+0x158/0x1e0 drivers/base/bus.c:427
__device_attach+0x2f0/0x480 drivers/base/dd.c:979
device_initial_probe+0x24/0x34 drivers/base/dd.c:1028
bus_probe_device+0xbc/0x1c8 drivers/base/bus.c:487
device_add+0xae0/0xef4 drivers/base/core.c:3394
usb_new_device+0x8fc/0x1448 drivers/usb/core/hub.c:2568
hub_port_connect drivers/usb/core/hub.c:5358 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5502 [inline]
port_event drivers/usb/core/hub.c:5648 [inline]
hub_event+0x22e4/0x48c4 drivers/usb/core/hub.c:5730
process_one_work+0x790/0x11b8 kernel/workqueue.c:2307
worker_thread+0x910/0x1034 kernel/workqueue.c:2454
kthread+0x37c/0x45c kernel/kthread.c:319
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Freed by task 13:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4c/0x84 mm/kasan/common.c:46
kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360
____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:374
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kfree+0x178/0x410 mm/slub.c:4559
xpad_disconnect+0x2d4/0x3d8 drivers/input/joystick/xpad.c:1927
usb_unbind_interface+0x1a4/0x758 drivers/usb/core/driver.c:458
__device_release_driver drivers/base/dd.c:1229 [inline]
device_release_driver_internal+0x464/0x6ac drivers/base/dd.c:1262
device_release_driver+0x28/0x38 drivers/base/dd.c:1285
bus_remove_device+0x298/0x38c drivers/base/bus.c:529
device_del+0x57c/0x9b4 drivers/base/core.c:3582
usb_disable_device+0x354/0x760 drivers/usb/core/message.c:1419
usb_disconnect+0x290/0x7e8 drivers/usb/core/hub.c:2231
hub_port_connect drivers/usb/core/hub.c:5202 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5502 [inline]
port_event drivers/usb/core/hub.c:5648 [inline]
hub_event+0x167c/0x48c4 drivers/usb/core/hub.c:5730
process_one_work+0x790/0x11b8 kernel/workqueue.c:2307
worker_thread+0x910/0x1034 kernel/workqueue.c:2454
kthread+0x37c/0x45c kernel/kthread.c:319
ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

The buggy address belongs to the object at ffff0000d4b0a000
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 145 bytes inside of
1024-byte region [ffff0000d4b0a000, ffff0000d4b0a400)
The buggy address belongs to the page:
page:000000000c7d5b70 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x114b08
head:000000000c7d5b70 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 0000000f00000001 ffff0000c0002780
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000d4b09f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000d4b0a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000d4b0a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000d4b0a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000d4b0a180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
TCP: request_sock_TCP: Possible SYN flooding on port 2. Sending cookies. Check SNMP counters.
TCP: request_sock_TCP: Possible SYN flooding on port 2. Sending cookies. Check SNMP counters.


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to change bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Sep 8, 2023, 6:47:45 PM9/8/23
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages