================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:646 [inline] BUG: KASAN: slab-use-after-free in string+0x394/0x3d0 lib/vsprintf.c:728 Read of size 1 at addr ffff888073e612c0 by task udevd/4521 CPU: 1 PID: 4521 Comm: udevd Not tainted 6.7.0-rc7-syzkaller-00016-gf5837722ffec #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/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 string_nocheck lib/vsprintf.c:646 [inline] string+0x394/0x3d0 lib/vsprintf.c:728 vsnprintf+0xc5f/0x1870 lib/vsprintf.c:2824 add_uevent_var+0x17c/0x3a0 lib/kobject_uevent.c:665 dev_uevent+0x18b/0x760 drivers/base/core.c:2576 uevent_show+0x1bf/0x380 drivers/base/core.c:2647 dev_attr_show+0x4f/0xd0 drivers/base/core.c:2350 sysfs_kf_seq_show+0x23e/0x400 fs/sysfs/file.c:59 seq_read_iter+0x4e5/0x1280 fs/seq_file.c:230 kernfs_fop_read_iter+0x410/0x580 fs/kernfs/file.c:279 call_read_iter include/linux/fs.h:2014 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x4d4/0x8f0 fs/read_write.c:470 ksys_read+0x12f/0x250 fs/read_write.c:613 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7f256b316b6a 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:00007fff795c6948 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000055624b7d0160 RCX: 00007f256b316b6a RDX: 0000000000001000 RSI: 000055624b7d80e0 RDI: 000000000000000c RBP: 000055624b7d0160 R08: 000000000000000c R09: 0000000000100000 R10: 000000000000010f R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000003fff R14: 00007fff795c6e28 R15: 000000000000000a Allocated by task 11966: 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:600 [inline] raw_ioctl_init+0x163/0x840 drivers/usb/gadget/legacy/raw_gadget.c:509 raw_ioctl+0x9d9/0x2b80 drivers/usb/gadget/legacy/raw_gadget.c:1303 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:871 [inline] __se_sys_ioctl fs/ioctl.c:857 [inline] __x64_sys_ioctl+0x18f/0x210 fs/ioctl.c:857 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b Freed by task 11964: 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+0xc0/0x180 mm/slub.c:3822 dev_free+0x9a/0x700 drivers/usb/gadget/legacy/raw_gadget.c:211 kref_put include/linux/kref.h:65 [inline] raw_release+0x184/0x2e0 drivers/usb/gadget/legacy/raw_gadget.c:473 __fput+0x270/0xb70 fs/file_table.c:394 task_work_run+0x14d/0x240 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa8a/0x2ad0 kernel/exit.c:869 do_group_exit+0xd4/0x2a0 kernel/exit.c:1018 get_signal+0x23b5/0x2790 kernel/signal.c:2904 arch_do_signal_or_restart+0x90/0x7f0 arch/x86/kernel/signal.c:309 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x121/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1e/0x60 kernel/entry/common.c:296 do_syscall_64+0x4d/0x110 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x63/0x6b The buggy address belongs to the object at ffff888073e612c0 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of freed 32-byte region [ffff888073e612c0, ffff888073e612e0) The buggy address belongs to the physical page: page:ffffea0001cf9840 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x73e61 ksm flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff888013041500 ffffea0000e20700 dead000000000003 raw: 0000000000000000 0000000000400040 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 0x12820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY), pid 5107, tgid 5107 (syz-executor.3), ts 154847652451, free_ts 154844094309 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d0/0x350 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1544 [inline] get_page_from_freelist+0xa25/0x36d0 mm/page_alloc.c:3312 __alloc_pages+0x22e/0x2420 mm/page_alloc.c:4568 alloc_pages_mpol+0x258/0x5f0 mm/mempolicy.c:2133 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab mm/slub.c:2017 [inline] new_slab+0x283/0x3c0 mm/slub.c:2070 ___slab_alloc+0x979/0x1500 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/0x310 mm/slub.c:3517 kmalloc_trace+0x25/0x60 mm/slab_common.c:1098 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:721 [inline] ref_tracker_alloc+0x17c/0x5a0 lib/ref_tracker.c:203 __netdev_tracker_alloc include/linux/netdevice.h:4107 [inline] netdev_tracker_alloc include/linux/netdevice.h:4119 [inline] netdev_get_by_index+0x7c/0xb0 net/core/dev.c:898 fib6_nh_init+0x792/0x1da0 net/ipv6/route.c:3531 ip6_route_info_create+0x129c/0x1b70 net/ipv6/route.c:3799 addrconf_f6i_alloc+0x38f/0x660 net/ipv6/route.c:4572 fixup_permanent_addr net/ipv6/addrconf.c:3534 [inline] addrconf_permanent_addr net/ipv6/addrconf.c:3573 [inline] addrconf_notify+0x1074/0x1920 net/ipv6/addrconf.c:3645 notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1137 [inline] free_unref_page_prepare+0x4fa/0xaa0 mm/page_alloc.c:2347 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2487 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:294 __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:763 [inline] slab_alloc_node mm/slub.c:3478 [inline] __kmem_cache_alloc_node+0x195/0x310 mm/slub.c:3517 __do_kmalloc_node mm/slab_common.c:1006 [inline] __kmalloc+0x49/0x90 mm/slab_common.c:1020 kmalloc include/linux/slab.h:604 [inline] kzalloc include/linux/slab.h:721 [inline] fib6_info_alloc+0x40/0x100 net/ipv6/ip6_fib.c:155 ip6_route_info_create+0x337/0x1b70 net/ipv6/route.c:3749 ip6_route_add+0x26/0x150 net/ipv6/route.c:3843 addrconf_add_mroute+0x1de/0x350 net/ipv6/addrconf.c:2509 addrconf_add_dev+0x150/0x1c0 net/ipv6/addrconf.c:2527 inet6_addr_add+0x1a8/0xbe0 net/ipv6/addrconf.c:2973 inet6_rtm_newaddr+0x11da/0x1ab0 net/ipv6/addrconf.c:4984 rtnetlink_rcv_msg+0x3c7/0xe00 net/core/rtnetlink.c:6558 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545 Memory state around the buggy address: ffff888073e61180: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc ffff888073e61200: 00 00 00 00 fc fc fc fc 00 00 00 00 fc fc fc fc >ffff888073e61280: 00 00 00 00 fc fc fc fc fa fb fb fb fc fc fc fc ^ ffff888073e61300: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ffff888073e61380: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc ==================================================================