================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:645 [inline] BUG: KASAN: slab-use-after-free in string+0x54/0x12c lib/vsprintf.c:728 Read at addr fbff000006372b41 by task udevd/8216 Pointer tag: [fb], memory tag: [fe] CPU: 1 PID: 8216 Comm: udevd Not tainted 6.8.0-rc5-syzkaller-00381-g70ff1fe626a1 #0 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x94/0xec arch/arm64/kernel/stacktrace.c:291 show_stack+0x18/0x24 arch/arm64/kernel/stacktrace.c:298 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x48/0x60 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0x108/0x618 mm/kasan/report.c:488 kasan_report+0x88/0xac mm/kasan/report.c:601 report_tag_fault arch/arm64/mm/fault.c:334 [inline] do_tag_recovery arch/arm64/mm/fault.c:346 [inline] __do_kernel_fault+0x17c/0x1e8 arch/arm64/mm/fault.c:393 do_bad_area arch/arm64/mm/fault.c:493 [inline] do_tag_check_fault+0x78/0x8c arch/arm64/mm/fault.c:772 do_mem_abort+0x44/0x94 arch/arm64/mm/fault.c:848 el1_abort+0x40/0x60 arch/arm64/kernel/entry-common.c:398 el1h_64_sync_handler+0xd8/0xe4 arch/arm64/kernel/entry-common.c:458 el1h_64_sync+0x64/0x68 arch/arm64/kernel/entry.S:593 string_nocheck lib/vsprintf.c:645 [inline] string+0x54/0x12c lib/vsprintf.c:728 vsnprintf+0x238/0x6dc lib/vsprintf.c:2824 add_uevent_var+0x8c/0x128 lib/kobject_uevent.c:665 dev_uevent+0x70/0x1e4 drivers/base/core.c:2590 uevent_show+0x8c/0x114 drivers/base/core.c:2661 dev_attr_show+0x20/0x6c drivers/base/core.c:2364 sysfs_kf_seq_show+0x8c/0x104 fs/sysfs/file.c:59 kernfs_seq_show+0x2c/0x38 fs/kernfs/file.c:205 seq_read_iter+0x164/0x47c fs/seq_file.c:230 kernfs_fop_read_iter+0x150/0x1bc fs/kernfs/file.c:279 call_read_iter include/linux/fs.h:2081 [inline] new_sync_read fs/read_write.c:395 [inline] vfs_read+0x260/0x304 fs/read_write.c:476 ksys_read+0x70/0x104 fs/read_write.c:619 __do_sys_read fs/read_write.c:629 [inline] __se_sys_read fs/read_write.c:627 [inline] __arm64_sys_read+0x1c/0x28 fs/read_write.c:627 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x48/0x114 arch/arm64/kernel/syscall.c:51 el0_svc_common.constprop.0+0x40/0xe0 arch/arm64/kernel/syscall.c:136 do_el0_svc+0x1c/0x28 arch/arm64/kernel/syscall.c:155 el0_svc+0x34/0xd8 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x19c/0x1a0 arch/arm64/kernel/entry.S:598 Allocated by task 8208: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:47 save_stack_info+0x40/0x158 mm/kasan/tags.c:106 kasan_save_alloc_info+0x14/0x20 mm/kasan/tags.c:142 poison_kmalloc_redzone mm/kasan/common.c:372 [inline] poison_kmalloc_redzone mm/kasan/common.c:345 [inline] __kasan_kmalloc+0xb4/0xb8 mm/kasan/common.c:389 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x150/0x2e4 mm/slub.c:4012 kmalloc include/linux/slab.h:590 [inline] raw_ioctl_init+0x10c/0x2e8 drivers/usb/gadget/legacy/raw_gadget.c:509 raw_ioctl+0x4dc/0xcac 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] __arm64_sys_ioctl+0xac/0xf0 fs/ioctl.c:857 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x48/0x114 arch/arm64/kernel/syscall.c:51 el0_svc_common.constprop.0+0x40/0xe0 arch/arm64/kernel/syscall.c:136 do_el0_svc+0x1c/0x28 arch/arm64/kernel/syscall.c:155 el0_svc+0x34/0xd8 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x19c/0x1a0 arch/arm64/kernel/entry.S:598 Freed by task 8206: kasan_save_stack+0x3c/0x64 mm/kasan/common.c:47 save_stack_info+0x40/0x158 mm/kasan/tags.c:106 kasan_save_free_info+0x18/0x24 mm/kasan/tags.c:147 poison_slab_object+0x164/0x1ac mm/kasan/common.c:241 __kasan_slab_free+0x30/0x48 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0xd0/0x278 mm/slub.c:4409 dev_free+0x30/0x120 drivers/usb/gadget/legacy/raw_gadget.c:211 kref_put include/linux/kref.h:65 [inline] raw_release+0xb0/0x188 drivers/usb/gadget/legacy/raw_gadget.c:473 __fput+0x78/0x2c4 fs/file_table.c:376 __fput_sync+0x50/0x5c fs/file_table.c:461 __do_sys_close fs/open.c:1554 [inline] __se_sys_close fs/open.c:1539 [inline] __arm64_sys_close+0x38/0x7c fs/open.c:1539 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x48/0x114 arch/arm64/kernel/syscall.c:51 el0_svc_common.constprop.0+0x40/0xe0 arch/arm64/kernel/syscall.c:136 do_el0_svc+0x1c/0x28 arch/arm64/kernel/syscall.c:155 el0_svc+0x34/0xd8 arch/arm64/kernel/entry-common.c:678 el0t_64_sync_handler+0x100/0x12c arch/arm64/kernel/entry-common.c:696 el0t_64_sync+0x19c/0x1a0 arch/arm64/kernel/entry.S:598 The buggy address belongs to the object at ffff000006372b40 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 1 bytes inside of 32-byte region [ffff000006372b40, ffff000006372b60) The buggy address belongs to the physical page: page:00000000cb3d7930 refcount:1 mapcount:0 mapping:0000000000000000 index:0xf8ff000006372ea0 pfn:0x46372 flags: 0x1ffc00000000800(slab|node=0|zone=0|lastcpupid=0x7ff|kasantag=0x0) page_type: 0xffffffff() raw: 01ffc00000000800 fdff000002c01300 dead000000000100 dead000000000122 raw: f8ff000006372ea0 000000008080007c 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff000006372900: f9 f9 fb fb fd fd fa fa fe fe f6 f6 f9 f9 fd fd ffff000006372a00: f8 f8 f9 f9 fc fc f3 f3 fe fe fd fd fe fe f6 f6 >ffff000006372b00: fb fb fe fe fe fe f4 f4 fb fb f1 f1 f7 f7 f9 f9 ^ ffff000006372c00: f8 f8 fc fc fe fe fa fa fc fc f9 f9 f1 f1 f1 f1 ffff000006372d00: fc fc fd fd f7 f7 f8 f8 f8 f8 f1 f1 f8 f8 fb fb ==================================================================