syzbot


KASAN: use-after-free Write in usb_anchor_suspend_wakeups

Status: upstream: reported C repro on 2025/01/09 05:11
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+640b1bd29b84d8d3dfcb@syzkaller.appspotmail.com
First crash: 13d, last: 13d
Bug presence (1)
Date Name Commit Repro Result
2025/01/10 upstream (ToT) 2144da25584e C [report] KASAN: slab-use-after-free Write in usb_anchor_suspend_wakeups
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Write in usb_anchor_suspend_wakeups origin:upstream missing-backport C inconclusive 1 105d 609d 0/3 auto-obsoleted due to no activity on 2025/01/17 06:55
upstream KASAN: slab-use-after-free Write in usb_anchor_suspend_wakeups usb C done unreliable 14 443d 631d 0/28 auto-obsoleted due to no activity on 2024/02/14 08:18
upstream KASAN: slab-use-after-free Write in usb_anchor_suspend_wakeups (2) usb C error 9 17h48m 295d 0/28 upstream: reported C repro on 2024/04/01 16:50

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
BUG: KASAN: use-after-free in atomic_inc include/linux/atomic/atomic-instrumented.h:190 [inline]
BUG: KASAN: use-after-free in usb_anchor_suspend_wakeups+0x2c/0x74 drivers/usb/core/urb.c:942
Write of size 4 at addr ffff0000d0d07910 by task syz-executor364/6434

CPU: 0 PID: 6434 Comm: syz-executor364 Not tainted 6.1.123-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:427
 kasan_report+0xd4/0x130 mm/kasan/report.c:531
 kasan_check_range+0x264/0x2a4 mm/kasan/generic.c:189
 __kasan_check_write+0x2c/0x3c mm/kasan/shadow.c:37
 instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
 atomic_inc include/linux/atomic/atomic-instrumented.h:190 [inline]
 usb_anchor_suspend_wakeups+0x2c/0x74 drivers/usb/core/urb.c:942
 __usb_hcd_giveback_urb+0x1f4/0x504 drivers/usb/core/hcd.c:1662
 usb_hcd_giveback_urb+0x108/0x3f8 drivers/usb/core/hcd.c:1758
 dummy_timer+0x6a4/0x2770 drivers/usb/gadget/udc/dummy_hcd.c:1994
 __run_hrtimer kernel/time/hrtimer.c:1689 [inline]
 __hrtimer_run_queues+0x4b0/0xdc0 kernel/time/hrtimer.c:1753
 hrtimer_run_softirq+0x158/0x21c kernel/time/hrtimer.c:1770
 handle_softirqs+0x318/0xd58 kernel/softirq.c:571
 __do_softirq+0x14/0x20 kernel/softirq.c:605
 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:80
 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:893
 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:85
 invoke_softirq kernel/softirq.c:452 [inline]
 __irq_exit_rcu+0x264/0x4d4 kernel/softirq.c:654
 irq_exit_rcu+0x14/0x84 kernel/softirq.c:666
 __el1_irq arch/arm64/kernel/entry-common.c:472 [inline]
 el1_interrupt+0x38/0x68 arch/arm64/kernel/entry-common.c:486
 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:491
 el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:581
 arch_local_irq_restore arch/arm64/include/asm/irqflags.h:122 [inline]
 ___slab_alloc+0x2a0/0xee0 mm/slub.c:3113
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x2c8/0x388 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc+0xc4/0x1c4 mm/slab_common.c:949
 kmalloc include/linux/slab.h:568 [inline]
 tomoyo_realpath_from_path+0xc8/0x4cc security/tomoyo/realpath.c:251
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x1dc/0x3f4 security/tomoyo/file.c:771
 tomoyo_file_open+0x130/0x19c security/tomoyo/tomoyo.c:320
 security_file_open+0x6c/0xb0 security/security.c:1681
 do_dentry_open+0x2a0/0xfa0 fs/open.c:869
 vfs_open+0x7c/0x90 fs/open.c:1013
 do_open fs/namei.c:3626 [inline]
 path_openat+0x1e14/0x2548 fs/namei.c:3783
 do_filp_open+0x1bc/0x3cc fs/namei.c:3810
 do_sys_openat2+0x128/0x3e0 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1345
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Allocated by task 6502:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace+0x7c/0x94 mm/slab_common.c:1031
 kmalloc include/linux/slab.h:563 [inline]
 kzalloc include/linux/slab.h:699 [inline]
 usbtmc_open+0xb0/0x750 drivers/usb/class/usbtmc.c:175
 usb_open+0x1c4/0x2c4 drivers/usb/core/file.c:48
 chrdev_open+0x3e8/0x4fc fs/char_dev.c:414
 do_dentry_open+0x734/0xfa0 fs/open.c:882
 vfs_open+0x7c/0x90 fs/open.c:1013
 do_open fs/namei.c:3626 [inline]
 path_openat+0x1e14/0x2548 fs/namei.c:3783
 do_filp_open+0x1bc/0x3cc fs/namei.c:3810
 do_sys_openat2+0x128/0x3e0 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1345
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 6502:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
 kfree+0xcc/0x1b8 mm/slab_common.c:988
 usbtmc_release+0x238/0x298 drivers/usb/class/usbtmc.c:261
 __fput+0x1c8/0x7c8 fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:203
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2080/0x2cb8 arch/arm64/kernel/signal.c:1132
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000d0d07800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 272 bytes inside of
 1024-byte region [ffff0000d0d07800, ffff0000d0d07c00)

The buggy address belongs to the physical page:
page:0000000098290873 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x110d00
head:0000000098290873 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 0000000000000000 dead000000000001 ffff0000c0002780
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000d0d07800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d0d07880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000d0d07900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff0000d0d07980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000d0d07a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Unable to handle kernel paging request at virtual address dfff800000000012
KASAN: null-ptr-deref in range [0x0000000000000090-0x0000000000000097]
Mem abort info:
  ESR = 0x0000000096000006
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x06: level 2 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000006
  CM = 0, WnR = 0
[dfff800000000012] address between user and kernel address ranges
Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 6434 Comm: syz-executor364 Tainted: G    B              6.1.123-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : dev_driver_string drivers/base/core.c:2356 [inline]
pc : __dev_printk+0x7c/0x1a0 drivers/base/core.c:4956
lr : __dev_printk+0x2c/0x1a0 drivers/base/core.c:4953
sp : ffff800008007730
x29: ffff800008007730 x28: ffff0000d19a8430 x27: 1fffe0001a1a0f00
x26: dfff800000000000 x25: 0000000000000033 x24: dfff800000000000
x23: ffff700001000ef8 x22: 0000000000000097 x21: ffff800013378541
x20: 000000000000002f x19: ffff8000080077e0 x18: ffff0000d19a8448
x17: 0000000000000000 x16: ffff80001227aec0 x15: 0000000000000000
x14: 00000000ffffff98 x13: ffff0000d63d8000 x12: 0000000000000004
x11: 0000000000ff0100 x10: 0000000000000000 x9 : 0000000000000001
x8 : 0000000000000012 x7 : 0000000000000000 x6 : ffff8000084f39d8
x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000020
x2 : ffff8000080077e0 x1 : 000000000000002f x0 : ffff800013378540
Call trace:
 dev_driver_string drivers/base/core.c:2356 [inline]
 __dev_printk+0x7c/0x1a0 drivers/base/core.c:4956
 _dev_err+0x104/0x150 drivers/base/core.c:4998
 usbtmc_read_bulk_cb+0x21c/0x38c drivers/usb/class/usbtmc.c:781
 __usb_hcd_giveback_urb+0x2e0/0x504 drivers/usb/core/hcd.c:1675
 usb_hcd_giveback_urb+0x108/0x3f8 drivers/usb/core/hcd.c:1758
 dummy_timer+0x6a4/0x2770 drivers/usb/gadget/udc/dummy_hcd.c:1994
 __run_hrtimer kernel/time/hrtimer.c:1689 [inline]
 __hrtimer_run_queues+0x4b0/0xdc0 kernel/time/hrtimer.c:1753
 hrtimer_run_softirq+0x158/0x21c kernel/time/hrtimer.c:1770
 handle_softirqs+0x318/0xd58 kernel/softirq.c:571
 __do_softirq+0x14/0x20 kernel/softirq.c:605
 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:80
 call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:893
 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:85
 invoke_softirq kernel/softirq.c:452 [inline]
 __irq_exit_rcu+0x264/0x4d4 kernel/softirq.c:654
 irq_exit_rcu+0x14/0x84 kernel/softirq.c:666
 __el1_irq arch/arm64/kernel/entry-common.c:472 [inline]
 el1_interrupt+0x38/0x68 arch/arm64/kernel/entry-common.c:486
 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:491
 el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:581
 arch_local_irq_restore arch/arm64/include/asm/irqflags.h:122 [inline]
 ___slab_alloc+0x2a0/0xee0 mm/slub.c:3113
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x2c8/0x388 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc+0xc4/0x1c4 mm/slab_common.c:949
 kmalloc include/linux/slab.h:568 [inline]
 tomoyo_realpath_from_path+0xc8/0x4cc security/tomoyo/realpath.c:251
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_check_open_permission+0x1dc/0x3f4 security/tomoyo/file.c:771
 tomoyo_file_open+0x130/0x19c security/tomoyo/tomoyo.c:320
 security_file_open+0x6c/0xb0 security/security.c:1681
 do_dentry_open+0x2a0/0xfa0 fs/open.c:869
 vfs_open+0x7c/0x90 fs/open.c:1013
 do_open fs/namei.c:3626 [inline]
 path_openat+0x1e14/0x2548 fs/namei.c:3783
 do_filp_open+0x1bc/0x3cc fs/namei.c:3810
 do_sys_openat2+0x128/0x3e0 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __arm64_sys_openat+0x1f0/0x240 fs/open.c:1345
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2bc arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
 do_el0_svc+0x58/0x13c arch/arm64/kernel/syscall.c:204
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
Code: 5400094a 9101a296 394002b9 d343fec8 (38786908) 
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
   0:	5400094a 	b.ge	0x128  // b.tcont
   4:	9101a296 	add	x22, x20, #0x68
   8:	394002b9 	ldrb	w25, [x21]
   c:	d343fec8 	lsr	x8, x22, #3
* 10:	38786908 	ldrb	w8, [x8, x24] <-- trapping instruction

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/09 05:10 linux-6.1.y 7dc732d24ff7 f3558dbf .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Write in usb_anchor_suspend_wakeups
* Struck through repros no longer work on HEAD.