================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline] BUG: KASAN: slab-use-after-free in atomic_inc include/linux/atomic/atomic-instrumented.h:435 [inline] BUG: KASAN: slab-use-after-free in usb_anchor_suspend_wakeups drivers/usb/core/urb.c:927 [inline] BUG: KASAN: slab-use-after-free in usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:924 Write of size 4 at addr ffff88806816d110 by task rm/10307 CPU: 0 PID: 10307 Comm: rm Not tainted 6.6.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 check_region_inline mm/kasan/generic.c:181 [inline] kasan_check_range+0xef/0x190 mm/kasan/generic.c:187 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_inc include/linux/atomic/atomic-instrumented.h:435 [inline] usb_anchor_suspend_wakeups drivers/usb/core/urb.c:927 [inline] usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:924 __usb_hcd_giveback_urb+0x217/0x5c0 drivers/usb/core/hcd.c:1637 usb_hcd_giveback_urb+0x389/0x430 drivers/usb/core/hcd.c:1733 dummy_timer+0x1415/0x35f0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x19e/0x580 kernel/time/timer.c:1700 expire_timers kernel/time/timer.c:1751 [inline] __run_timers+0x764/0xb10 kernel/time/timer.c:2022 run_timer_softirq+0x58/0xd0 kernel/time/timer.c:2035 __do_softirq+0x218/0x965 kernel/softirq.c:553 invoke_softirq kernel/softirq.c:427 [inline] __irq_exit_rcu kernel/softirq.c:632 [inline] irq_exit_rcu+0xb7/0x120 kernel/softirq.c:644 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1074 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:mt_slot lib/maple_tree.c:812 [inline] RIP: 0010:mas_slot lib/maple_tree.c:845 [inline] RIP: 0010:mas_validate_limits lib/maple_tree.c:7129 [inline] RIP: 0010:mt_validate+0x18c2/0x3d00 lib/maple_tree.c:7214 Code: a4 24 b0 00 00 00 48 c1 e8 03 42 80 3c 38 00 0f 85 7b 1f 00 00 49 8b 45 00 48 89 04 24 e8 86 a0 10 00 31 ff 89 c6 89 44 24 20 99 7f 58 f7 8b 44 24 20 85 c0 0f 84 f7 fc ff ff e8 18 84 58 f7 RSP: 0018:ffffc9000b4579a0 EFLAGS: 00000246 RAX: 0000000000000001 RBX: 0000000000000006 RCX: 0000000000000000 RDX: ffff8880261e8000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: 000000000000000a R08: 0000000000000004 R09: 000000000000000a R10: 0000000000000006 R11: 00007f3b896c3fff R12: ffff8880143adf40 R13: ffff88801c021480 R14: 0000000000000003 R15: dffffc0000000000 validate_mm+0x9a/0x460 mm/mmap.c:288 mmap_region+0x1bd1/0x28b0 mm/mmap.c:2870 do_mmap+0x893/0xef0 mm/mmap.c:1354 vm_mmap_pgoff+0x1a8/0x3b0 mm/util.c:546 ksys_mmap_pgoff+0x422/0x5b0 mm/mmap.c:1400 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:93 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline] __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:86 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f3b8980ab74 Code: 63 08 44 89 e8 5b 41 5c 41 5d c3 41 89 ca 41 f7 c1 ff 0f 00 00 74 0c c7 05 f5 46 01 00 16 00 00 00 eb 17 b8 09 00 00 00 0f 05 <48> 3d 00 f0 ff ff 76 0c f7 d8 89 05 dc 46 01 00 48 83 c8 ff c3 0f RSP: 002b:00007ffcbbc8a6a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00000fff977914d6 RCX: 00007f3b8980ab74 RDX: 0000000000000001 RSI: 000000000000f888 RDI: 0000000000000000 RBP: 00007ffcbbc8aa80 R08: 0000000000000003 R09: 0000000000000000 R10: 0000000000000802 R11: 0000000000000246 R12: 00007f3b897edac0 R13: 00007ffcbbc8ab08 R14: fffffffffffff000 R15: 0000000000000000 Allocated by task 10280: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] usbtmc_open+0xa6/0x9b0 drivers/usb/class/usbtmc.c:175 usb_open+0x20f/0x2e0 drivers/usb/core/file.c:47 chrdev_open+0x277/0x700 fs/char_dev.c:414 do_dentry_open+0x88b/0x1730 fs/open.c:929 do_open fs/namei.c:3639 [inline] path_openat+0x19af/0x29c0 fs/namei.c:3796 do_filp_open+0x1de/0x430 fs/namei.c:3823 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_openat fs/open.c:1453 [inline] __se_sys_openat fs/open.c:1448 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1448 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 10280: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15b/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822 usbtmc_release+0x285/0x390 drivers/usb/class/usbtmc.c:261 __fput+0x3f7/0xa70 fs/file_table.c:384 task_work_run+0x14d/0x240 kernel/task_work.c:180 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x215/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88806816d000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 272 bytes inside of freed 1024-byte region [ffff88806816d000, ffff88806816d400) The buggy address belongs to the physical page: page:ffffea0001a05a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x68168 head:ffffea0001a05a00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888012c41dc0 ffffea00007efc00 dead000000000002 raw: 0000000000000000 0000000000100010 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 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 5057, tgid 5057 (kworker/0:4), ts 499671794889, free_ts 499234668541 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2297 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x251/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8c7/0x1580 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x131/0x340 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1022 [inline] __kmalloc+0x4f/0x100 mm/slab_common.c:1036 kmalloc include/linux/slab.h:603 [inline] kzalloc include/linux/slab.h:720 [inline] ieee802_11_parse_elems_full+0xc7/0x1380 net/mac80211/util.c:1602 ieee802_11_parse_elems_crc net/mac80211/ieee80211_i.h:2327 [inline] ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2334 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1609 [inline] ieee80211_ibss_rx_queued_mgmt+0xc65/0x2ed0 net/mac80211/ibss.c:1642 ieee80211_iface_process_skb net/mac80211/iface.c:1604 [inline] ieee80211_iface_work+0xa1f/0xd40 net/mac80211/iface.c:1658 cfg80211_wiphy_work+0x24e/0x330 net/wireless/core.c:435 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784 kthread+0x33c/0x440 kernel/kthread.c:388 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405 __unfreeze_partials+0x21d/0x240 mm/slub.c:2655 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3478 [inline] __kmem_cache_alloc_node+0x195/0x340 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1022 [inline] __kmalloc+0x4f/0x100 mm/slab_common.c:1036 kmalloc include/linux/slab.h:603 [inline] tomoyo_add_entry security/tomoyo/common.c:2023 [inline] tomoyo_supervisor+0xcdb/0xea0 security/tomoyo/common.c:2095 tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline] tomoyo_path_number_perm+0x43d/0x580 security/tomoyo/file.c:734 security_file_ioctl+0x72/0xb0 security/security.c:2647 __do_sys_ioctl fs/ioctl.c:865 [inline] __se_sys_ioctl fs/ioctl.c:857 [inline] __x64_sys_ioctl+0xbb/0x210 fs/ioctl.c:857 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88806816d000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806816d080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806816d100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806816d180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806816d200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: a4 movsb %ds:(%rsi),%es:(%rdi) 1: 24 b0 and $0xb0,%al 3: 00 00 add %al,(%rax) 5: 00 48 c1 add %cl,-0x3f(%rax) 8: e8 03 42 80 3c call 0x3c804210 d: 38 00 cmp %al,(%rax) f: 0f 85 7b 1f 00 00 jne 0x1f90 15: 49 8b 45 00 mov 0x0(%r13),%rax 19: 48 89 04 24 mov %rax,(%rsp) 1d: e8 86 a0 10 00 call 0x10a0a8 22: 31 ff xor %edi,%edi 24: 89 c6 mov %eax,%esi 26: 89 44 24 20 mov %eax,0x20(%rsp) * 2a: e8 99 7f 58 f7 call 0xf7587fc8 <-- trapping instruction 2f: 8b 44 24 20 mov 0x20(%rsp),%eax 33: 85 c0 test %eax,%eax 35: 0f 84 f7 fc ff ff je 0xfffffd32 3b: e8 18 84 58 f7 call 0xf7588458