==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic_inc include/linux/atomic/atomic-instrumented.h:181 [inline]
BUG: KASAN: use-after-free in usb_anchor_suspend_wakeups+0x24/0x40 drivers/usb/core/urb.c:940
Write of size 4 at addr ffff888077afa110 by task udevd/3821
CPU: 1 PID: 3821 Comm: udevd Not tainted 5.15.163-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
print_address_description+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
atomic_inc include/linux/atomic/atomic-instrumented.h:181 [inline]
usb_anchor_suspend_wakeups+0x24/0x40 drivers/usb/core/urb.c:940
__usb_hcd_giveback_urb+0x25d/0x530 drivers/usb/core/hcd.c:1661
dummy_timer+0x8ad/0x3200 drivers/usb/gadget/udc/dummy_hcd.c:1987
call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451
expire_timers kernel/time/timer.c:1496 [inline]
__run_timers+0x67c/0x890 kernel/time/timer.c:1767
run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780
handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
__do_softirq kernel/softirq.c:592 [inline]
invoke_softirq kernel/softirq.c:432 [inline]
__irq_exit_rcu+0x157/0x240 kernel/softirq.c:641
irq_exit_rcu+0x5/0x20 kernel/softirq.c:653
sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1096
asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:preempt_count_add+0x30/0x180 kernel/sched/core.c:5485
Code: fb 48 c7 c0 c0 6f 3f 91 48 c1 e8 03 49 bf 00 00 00 00 00 fc ff df 42 0f b6 04 38 84 c0 0f 85 e2 00 00 00 83 3d 90 06 e8 0f 00 <75> 07 65 8b 05 8f 06 ab 7e 65 01 1d 88 06 ab 7e 48 c7 c0 c0 6f 3f
RSP: 0018:ffffc90003257028 EFLAGS: 00000246
RAX: 0000000000000004 RBX: 0000000000000001 RCX: ffffffff913f6f03
RDX: dffffc0000000000 RSI: ffffffff81ca0e9a RDI: 0000000000000001
RBP: ffffc90003257138 R08: 0000000000000000 R09: ffffc900032571f0
R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc90003257280
R13: ffffffff816df750 R14: ffffffff81ca0e9a R15: dffffc0000000000
unwind_next_frame+0xbb/0x1fa0 arch/x86/kernel/unwind_orc.c:433
arch_stack_walk+0x10d/0x140 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0x113/0x1c0 kernel/stacktrace.c:122
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+0xba/0xf0 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:264 [inline]
__kmalloc+0x168/0x300 mm/slub.c:4407
kmalloc include/linux/slab.h:596 [inline]
kzalloc include/linux/slab.h:721 [inline]
tomoyo_encode2 security/tomoyo/realpath.c:45 [inline]
tomoyo_encode+0x26b/0x530 security/tomoyo/realpath.c:80
tomoyo_realpath_from_path+0x5a2/0x5e0 security/tomoyo/realpath.c:288
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_check_open_permission+0x22c/0x490 security/tomoyo/file.c:771
security_file_open+0x5f/0xa0 security/security.c:1668
do_dentry_open+0x315/0xfb0 fs/open.c:813
do_open fs/namei.c:3608 [inline]
path_openat+0x2705/0x2f20 fs/namei.c:3742
do_filp_open+0x21c/0x460 fs/namei.c:3769
do_sys_openat2+0x13b/0x4f0 fs/open.c:1253
do_sys_open fs/open.c:1269 [inline]
__do_sys_openat fs/open.c:1285 [inline]
__se_sys_openat fs/open.c:1280 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1280
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f0202a909a4
Code: 24 20 48 8d 44 24 30 48 89 44 24 28 64 8b 04 25 18 00 00 00 85 c0 75 2c 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 76 60 48 8b 15 55 a4 0d 00 f7 d8 64 89 02 48 83
RSP: 002b:00007fffbed5b460 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000000000000008 RCX: 00007f0202a909a4
RDX: 0000000000080000 RSI: 00007fffbed5b598 RDI: 00000000ffffff9c
RBP: 00007fffbed5b598 R08: 0000000000000008 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000080000
R13: 0000556203a8bb42 R14: 0000000000000001 R15: 00007fffbed602d9
Allocated by task 5511:
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+0xba/0xf0 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:264 [inline]
kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
usbtmc_open+0x8f/0x880 drivers/usb/class/usbtmc.c:175
usb_open+0x21a/0x2f0 drivers/usb/core/file.c:48
chrdev_open+0x54a/0x630 fs/char_dev.c:414
do_dentry_open+0x807/0xfb0 fs/open.c:826
do_open fs/namei.c:3608 [inline]
path_openat+0x2705/0x2f20 fs/namei.c:3742
do_filp_open+0x21c/0x460 fs/namei.c:3769
do_sys_openat2+0x13b/0x4f0 fs/open.c:1253
do_sys_open fs/open.c:1269 [inline]
__do_sys_openat fs/open.c:1285 [inline]
__se_sys_openat fs/open.c:1280 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1280
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Freed by task 5511:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kfree+0xf1/0x270 mm/slub.c:4559
usbtmc_release+0x24b/0x280 drivers/usb/class/usbtmc.c:261
__fput+0x3fe/0x8e0 fs/file_table.c:280
task_work_run+0x129/0x1a0 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0
The buggy address belongs to the object at ffff888077afa000
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 272 bytes inside of
1024-byte region [ffff888077afa000, ffff888077afa400)
The buggy address belongs to the page:
page:ffffea0001debe00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888077afd800 pfn:0x77af8
head:ffffea0001debe00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffff888011c40888 ffffea0000672608 ffff888011c41dc0
raw: ffff888077afd800 000000000010000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x152a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 1000, ts 51731018613, free_ts 51709230581
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5423
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
__kmalloc+0x1c9/0x300 mm/slub.c:4403
kmalloc include/linux/slab.h:596 [inline]
kzalloc include/linux/slab.h:721 [inline]
ieee802_11_parse_elems_crc+0xb3/0x1130 net/mac80211/util.c:1478
ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2238 [inline]
ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1609 [inline]
ieee80211_ibss_rx_queued_mgmt+0x380/0x2af0 net/mac80211/ibss.c:1643
ieee80211_iface_process_skb net/mac80211/iface.c:1441 [inline]
ieee80211_iface_work+0x78f/0xcc0 net/mac80211/iface.c:1495
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
free_slab mm/slub.c:2015 [inline]
discard_slab mm/slub.c:2021 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
do_slab_free mm/slub.c:3487 [inline]
___cache_free+0xe3/0x100 mm/slub.c:3506
qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
__d_alloc+0x2a/0x700 fs/dcache.c:1749
d_alloc fs/dcache.c:1828 [inline]
d_alloc_parallel+0xca/0x1390 fs/dcache.c:2582
__lookup_slow+0x111/0x3d0 fs/namei.c:1648
lookup_slow+0x53/0x70 fs/namei.c:1680
walk_component+0x48c/0x610 fs/namei.c:1976
link_path_walk+0x642/0xd90
Memory state around the buggy address:
ffff888077afa000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888077afa080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888077afa100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888077afa180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888077afa200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: fb sti
1: 48 c7 c0 c0 6f 3f 91 mov $0xffffffff913f6fc0,%rax
8: 48 c1 e8 03 shr $0x3,%rax
c: 49 bf 00 00 00 00 00 movabs $0xdffffc0000000000,%r15
13: fc ff df
16: 42 0f b6 04 38 movzbl (%rax,%r15,1),%eax
1b: 84 c0 test %al,%al
1d: 0f 85 e2 00 00 00 jne 0x105
23: 83 3d 90 06 e8 0f 00 cmpl $0x0,0xfe80690(%rip) # 0xfe806ba
* 2a: 75 07 jne 0x33 <-- trapping instruction
2c: 65 8b 05 8f 06 ab 7e mov %gs:0x7eab068f(%rip),%eax # 0x7eab06c2
33: 65 01 1d 88 06 ab 7e add %ebx,%gs:0x7eab0688(%rip) # 0x7eab06c2
3a: 48 rex.W
3b: c7 .byte 0xc7
3c: c0 c0 6f rol $0x6f,%al
3f: 3f (bad)