================================================================== 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:942 [inline] BUG: KASAN: slab-use-after-free in usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:939 Write of size 4 at addr ffff888018ffb110 by task udevd/5134 CPU: 1 PID: 5134 Comm: udevd Not tainted 6.5.0-rc2-next-20230718-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/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:942 [inline] usb_anchor_suspend_wakeups+0x28/0x40 drivers/usb/core/urb.c:939 __usb_hcd_giveback_urb+0x217/0x5c0 drivers/usb/core/hcd.c:1658 usb_hcd_giveback_urb+0x389/0x430 drivers/usb/core/hcd.c:1754 dummy_timer+0x1415/0x35f0 drivers/usb/gadget/udc/dummy_hcd.c:1987 call_timer_fn+0x1a0/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:1109 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645 RIP: 0010:kasan_check_range+0x12/0x190 mm/kasan/generic.c:186 Code: 14 df ff ff 89 43 08 5b 5d 41 5c c3 66 66 2e 0f 1f 84 00 00 00 00 00 90 66 0f 1f 00 48 85 f6 0f 84 48 01 00 00 48 89 f8 41 54 <44> 0f b6 c2 48 01 f0 55 53 0f 82 c6 00 00 00 48 b8 ff ff ff ff ff RSP: 0018:ffffc90003eff9e0 EFLAGS: 00000202 RAX: ffff888028057c58 RBX: ffff888028057c58 RCX: ffffffff81f06d36 RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff888028057c58 RBP: ffff888028057be8 R08: 0000000000000004 R09: 000000000000000b R10: 000000000000000b R11: 0000000000000000 R12: ffffc90003effca0 R13: ffff888028057c58 R14: ffff888077fa8036 R15: 0000000000000003 read_word_at_a_time+0x16/0x20 include/asm-generic/rwonce.h:85 dentry_string_cmp fs/dcache.c:226 [inline] dentry_cmp fs/dcache.c:278 [inline] d_same_name+0x16b/0x2d0 fs/dcache.c:2265 __d_lookup+0x1f5/0x4c0 fs/dcache.c:2494 lookup_fast+0x177/0x520 fs/namei.c:1648 walk_component+0x5b/0x5a0 fs/namei.c:1994 link_path_walk.part.0.constprop.0+0x71f/0xce0 fs/namei.c:2325 link_path_walk fs/namei.c:2249 [inline] path_lookupat+0x93/0x770 fs/namei.c:2478 filename_lookup+0x1e7/0x5b0 fs/namei.c:2508 user_path_at_empty+0x42/0x60 fs/namei.c:2907 do_readlinkat+0xdd/0x2f0 fs/stat.c:477 __do_sys_readlink fs/stat.c:510 [inline] __se_sys_readlink fs/stat.c:507 [inline] __x64_sys_readlink+0x78/0xb0 fs/stat.c:507 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:0x7fea17b17d47 Code: 73 01 c3 48 8b 0d e1 90 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 59 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d b1 90 0d 00 f7 d8 64 89 01 48 RSP: 002b:00007ffda0b23328 EFLAGS: 00000246 ORIG_RAX: 0000000000000059 RAX: ffffffffffffffda RBX: 00007ffda0b23338 RCX: 00007fea17b17d47 RDX: 0000000000000400 RSI: 00007ffda0b23338 RDI: 00007ffda0b23818 RBP: 0000000000000400 R08: 00007ffda0b2405c R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffda0b23818 R13: 00007ffda0b23788 R14: 00005650b392a910 R15: 00007ffda0b24929 Allocated by task 6157: 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:48 chrdev_open+0x277/0x700 fs/char_dev.c:414 do_dentry_open+0x88b/0x1780 fs/open.c:925 do_open fs/namei.c:3636 [inline] path_openat+0x19af/0x29c0 fs/namei.c:3793 do_filp_open+0x1de/0x430 fs/namei.c:3820 do_sys_openat2+0x176/0x1e0 fs/open.c:1418 do_sys_open fs/open.c:1433 [inline] __do_sys_openat fs/open.c:1449 [inline] __se_sys_openat fs/open.c:1444 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1444 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 6157: 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+0x15e/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [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+0x3fd/0xac0 fs/file_table.c:384 task_work_run+0x14d/0x240 kernel/task_work.c:179 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+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 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 ffff888018ffb000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 272 bytes inside of freed 1024-byte region [ffff888018ffb000, ffff888018ffb400) The buggy address belongs to the physical page: page:ffffea000063fe00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x18ff8 head:ffffea000063fe00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 ksm flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012841dc0 ffffea000083b600 dead000000000003 raw: 0000000000000000 0000000080100010 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4750, tgid 4750 (dhcpcd), ts 58919952451, free_ts 58804398670 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1569 prep_new_page mm/page_alloc.c:1576 [inline] get_page_from_freelist+0x10d7/0x31b0 mm/page_alloc.c:3256 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4512 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2279 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x24e/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8bc/0x1570 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+0x137/0x350 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1023 [inline] __kmalloc+0x4f/0x100 mm/slab_common.c:1037 kmalloc include/linux/slab.h:603 [inline] load_elf_phdrs+0x103/0x210 fs/binfmt_elf.c:486 load_elf_binary+0x1fe/0x4f10 fs/binfmt_elf.c:860 search_binary_handler fs/exec.c:1738 [inline] exec_binprm fs/exec.c:1780 [inline] bprm_execve fs/exec.c:1855 [inline] bprm_execve+0x80a/0x1a50 fs/exec.c:1811 do_execveat_common.isra.0+0x5d3/0x740 fs/exec.c:1963 do_execve fs/exec.c:2037 [inline] __do_sys_execve fs/exec.c:2113 [inline] __se_sys_execve fs/exec.c:2108 [inline] __x64_sys_execve+0x8c/0xb0 fs/exec.c:2108 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1160 [inline] free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2383 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2478 __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+0x18b/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3478 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc+0x172/0x3b0 mm/slub.c:3502 vm_area_dup+0x21/0x2f0 kernel/fork.c:500 __split_vma+0x1a8/0x830 mm/mmap.c:2340 do_vmi_align_munmap+0x2bd/0x1720 mm/mmap.c:2460 do_vmi_munmap+0x20e/0x450 mm/mmap.c:2620 mmap_region+0x194/0x2640 mm/mmap.c:2670 do_mmap+0x884/0xee0 mm/mmap.c:1359 vm_mmap_pgoff+0x1a6/0x3b0 mm/util.c:543 ksys_mmap_pgoff+0x422/0x5b0 mm/mmap.c:1405 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 Memory state around the buggy address: ffff888018ffb000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888018ffb080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888018ffb100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888018ffb180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888018ffb200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 3 bytes skipped: 0: ff 89 43 08 5b 5d decl 0x5d5b0843(%rcx) 6: 41 5c pop %r12 8: c3 ret 9: 66 66 2e 0f 1f 84 00 data16 cs nopw 0x0(%rax,%rax,1) 10: 00 00 00 00 14: 90 nop 15: 66 0f 1f 00 nopw (%rax) 19: 48 85 f6 test %rsi,%rsi 1c: 0f 84 48 01 00 00 je 0x16a 22: 48 89 f8 mov %rdi,%rax 25: 41 54 push %r12 * 27: 44 0f b6 c2 movzbl %dl,%r8d <-- trapping instruction 2b: 48 01 f0 add %rsi,%rax 2e: 55 push %rbp 2f: 53 push %rbx 30: 0f 82 c6 00 00 00 jb 0xfc 36: 48 rex.W 37: b8 ff ff ff ff mov $0xffffffff,%eax 3c: ff .byte 0xff