================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:644 [inline] BUG: KASAN: slab-use-after-free in string+0x218/0x2b0 lib/vsprintf.c:726 Read of size 1 at addr ffff88807d745cc1 by task udevd/4470 CPU: 1 PID: 4470 Comm: udevd Not tainted 6.5.0-rc5-syzkaller-00021-ga027b2eca0b7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0x163/0x540 mm/kasan/report.c:475 kasan_report+0x175/0x1b0 mm/kasan/report.c:588 string_nocheck lib/vsprintf.c:644 [inline] string+0x218/0x2b0 lib/vsprintf.c:726 vsnprintf+0x10fc/0x1d80 lib/vsprintf.c:2817 add_uevent_var+0x1c4/0x440 lib/kobject_uevent.c:665 dev_uevent+0x3ec/0x8f0 drivers/base/core.c:2575 uevent_show+0x19a/0x310 drivers/base/core.c:2646 dev_attr_show+0x54/0xc0 drivers/base/core.c:2349 sysfs_kf_seq_show+0x331/0x4b0 fs/sysfs/file.c:59 seq_read_iter+0x43e/0xd10 fs/seq_file.c:230 call_read_iter include/linux/fs.h:1871 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x795/0xb00 fs/read_write.c:470 ksys_read+0x1a0/0x2c0 fs/read_write.c:613 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fbe32d16b6a Code: 00 3d 00 00 41 00 75 0d 50 48 8d 3d 2d 08 0a 00 e8 ea 7d 01 00 31 c0 e9 07 ff ff ff 64 8b 04 25 18 00 00 00 85 c0 75 1b 0f 05 <48> 3d 00 f0 ff ff 76 6c 48 8b 15 8f a2 0d 00 f7 d8 64 89 02 48 83 RSP: 002b:00007ffd733f82c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 0000559487237520 RCX: 00007fbe32d16b6a RDX: 0000000000001000 RSI: 000055948723e400 RDI: 000000000000000c RBP: 0000559487237520 R08: 000000000000000c R09: 0000000000000002 R10: 000000000000010f R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000003fff R14: 00007ffd733f87a8 R15: 000000000000000a Allocated by task 31046: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:582 [inline] raw_ioctl_init drivers/usb/gadget/legacy/raw_gadget.c:462 [inline] raw_ioctl+0x1aad/0x3cd0 drivers/usb/gadget/legacy/raw_gadget.c:1252 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xf8/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 31044: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1792 [inline] slab_free_freelist_hook mm/slub.c:1818 [inline] slab_free mm/slub.c:3801 [inline] __kmem_cache_free+0x25f/0x3b0 mm/slub.c:3814 dev_free drivers/usb/gadget/legacy/raw_gadget.c:210 [inline] kref_put+0xb5/0x7c0 include/linux/kref.h:65 raw_release+0x138/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:426 __fput+0x3f8/0x950 fs/file_table.c:384 task_work_run+0x24a/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xad/0xc0 mm/kasan/generic.c:492 kvfree_call_rcu+0xf8/0x790 kernel/rcu/tree.c:3368 dropmon_net_event+0x192/0x2a0 net/core/drop_monitor.c:1595 notifier_call_chain+0x18c/0x3a0 kernel/notifier.c:93 call_netdevice_notifiers_info net/core/dev.c:1962 [inline] call_netdevice_notifiers_extack net/core/dev.c:2000 [inline] call_netdevice_notifiers net/core/dev.c:2014 [inline] unregister_netdevice_many_notify+0xddb/0x1890 net/core/dev.c:10850 unregister_netdevice_many net/core/dev.c:10906 [inline] unregister_netdevice_queue+0x2ee/0x360 net/core/dev.c:10786 unregister_netdevice include/linux/netdevice.h:3112 [inline] __tun_detach+0x6b4/0x15a0 drivers/net/tun.c:684 tun_detach drivers/net/tun.c:700 [inline] tun_chr_close+0x108/0x1b0 drivers/net/tun.c:3491 __fput+0x3f8/0x950 fs/file_table.c:384 task_work_run+0x24a/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88807d745cc0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 1 bytes inside of freed 32-byte region [ffff88807d745cc0, ffff88807d745ce0) The buggy address belongs to the physical page: page:ffffea0001f5d140 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88807d745000 pfn:0x7d745 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000200 ffff888012841500 ffffea0001ec6f90 ffffea0001871610 raw: ffff88807d745000 000000000040003f 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 5054, tgid 5054 (syz-executor.3), ts 169444204287, free_ts 169365627743 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x31e8/0x3370 mm/page_alloc.c:3221 __alloc_pages+0x255/0x670 mm/page_alloc.c:4477 alloc_slab_page+0x6a/0x160 mm/slub.c:1862 allocate_slab mm/slub.c:2009 [inline] new_slab+0x84/0x2f0 mm/slub.c:2062 ___slab_alloc+0xade/0x1100 mm/slub.c:3215 __slab_alloc mm/slub.c:3314 [inline] __slab_alloc_node mm/slub.c:3367 [inline] slab_alloc_node mm/slub.c:3460 [inline] __kmem_cache_alloc_node+0x1af/0x270 mm/slub.c:3509 kmalloc_trace+0x2a/0xe0 mm/slab_common.c:1076 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:703 [inline] smack_sk_alloc_security+0xee/0x250 security/smack/smack_lsm.c:2315 security_sk_alloc+0x71/0xa0 security/security.c:4372 sk_prot_alloc+0xfa/0x210 net/core/sock.c:2091 sk_alloc+0x38/0x370 net/core/sock.c:2141 unix_create1+0xb4/0x800 unix_create+0x14e/0x200 net/unix/af_unix.c:1050 __sock_create+0x464/0x8d0 net/socket.c:1536 sock_create net/socket.c:1587 [inline] __sys_socket_create net/socket.c:1624 [inline] __sys_socket+0x13a/0x3a0 net/socket.c:1652 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2348 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2443 discard_slab mm/slub.c:2108 [inline] __unfreeze_partials+0x1dc/0x220 mm/slub.c:2647 put_cpu_partial+0x116/0x180 mm/slub.c:2723 __slab_free+0x2b6/0x390 mm/slub.c:3671 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook+0x6c/0x3b0 mm/slab.h:762 slab_alloc_node mm/slub.c:3470 [inline] __kmem_cache_alloc_node+0x141/0x270 mm/slub.c:3509 kmalloc_trace+0x2a/0xe0 mm/slab_common.c:1076 kmalloc include/linux/slab.h:582 [inline] netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:643 [inline] netdevice_event+0x37d/0x950 drivers/infiniband/core/roce_gid_mgmt.c:802 notifier_call_chain+0x18c/0x3a0 kernel/notifier.c:93 __netdev_upper_dev_link+0x57d/0x750 net/core/dev.c:7641 netdev_upper_dev_link+0x9e/0xe0 net/core/dev.c:7682 ipvlan_link_new+0x5d6/0xa30 drivers/net/ipvlan/ipvlan_main.c:618 Memory state around the buggy address: ffff88807d745b80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff88807d745c00: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc >ffff88807d745c80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff88807d745d00: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc ffff88807d745d80: fa fb fb fb fc fc fc fc 00 00 00 00 fc fc fc fc ==================================================================