================================================================== BUG: KASAN: slab-use-after-free in string_nocheck lib/vsprintf.c:646 [inline] BUG: KASAN: slab-use-after-free in string+0x1dc/0x264 lib/vsprintf.c:728 Read of size 1 at addr ffff0000c8c14e80 by task udevd/10772 CPU: 1 PID: 10772 Comm: udevd Tainted: G B 6.8.0-rc5-syzkaller-g59a96b711109 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0x178/0x518 mm/kasan/report.c:488 kasan_report+0xd8/0x138 mm/kasan/report.c:601 __asan_report_load1_noabort+0x20/0x2c mm/kasan/report_generic.c:378 string_nocheck lib/vsprintf.c:646 [inline] string+0x1dc/0x264 lib/vsprintf.c:728 vsnprintf+0xe9c/0x1a8c lib/vsprintf.c:2824 add_uevent_var+0x190/0x3c0 lib/kobject_uevent.c:665 dev_uevent+0x348/0x790 drivers/base/core.c:2590 uevent_show+0x1a4/0x320 drivers/base/core.c:2661 dev_attr_show+0x60/0xcc drivers/base/core.c:2364 sysfs_kf_seq_show+0x2d0/0x43c fs/sysfs/file.c:59 kernfs_seq_show+0x150/0x1fc fs/kernfs/file.c:205 seq_read_iter+0x3e0/0xc44 fs/seq_file.c:230 kernfs_fop_read_iter+0x144/0x5c8 fs/kernfs/file.c:279 call_read_iter include/linux/fs.h:2079 [inline] new_sync_read fs/read_write.c:395 [inline] vfs_read+0x78c/0x954 fs/read_write.c:476 ksys_read+0x15c/0x26c 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+0x7c/0x90 fs/read_write.c:627 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Allocated by task 10844: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_alloc_info+0x70/0x84 mm/kasan/generic.c:626 poison_kmalloc_redzone mm/kasan/common.c:372 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:389 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x26c/0x49c mm/slub.c:4012 kmalloc include/linux/slab.h:590 [inline] raw_ioctl_init drivers/usb/gadget/legacy/raw_gadget.c:509 [inline] raw_ioctl+0x16e4/0x33bc 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+0x14c/0x1c8 fs/ioctl.c:857 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Freed by task 10844: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_free_info+0x5c/0x74 mm/kasan/generic.c:640 poison_slab_object+0x124/0x18c mm/kasan/common.c:241 __kasan_slab_free+0x3c/0x78 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+0x144/0x3cc mm/slub.c:4409 dev_free drivers/usb/gadget/legacy/raw_gadget.c:211 [inline] kref_put+0xb8/0x6d0 include/linux/kref.h:65 raw_release+0x12c/0x1bc drivers/usb/gadget/legacy/raw_gadget.c:473 __fput+0x30c/0x738 fs/file_table.c:376 ____fput+0x20/0x30 fs/file_table.c:404 task_work_run+0x230/0x2e0 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x618/0x1f64 kernel/exit.c:871 do_group_exit+0x194/0x22c kernel/exit.c:1020 get_signal+0x1500/0x15ec kernel/signal.c:2893 do_signal+0x23c/0x3b44 arch/arm64/kernel/signal.c:1249 do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:713 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 The buggy address belongs to the object at ffff0000c8c14e80 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of freed 32-byte region [ffff0000c8c14e80, ffff0000c8c14ea0) The buggy address belongs to the physical page: page:00000000239fb179 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x108c14 flags: 0x5ffc00000000800(slab|node=0|zone=2|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 05ffc00000000800 ffff0000c0001500 fffffdffc329d2c0 dead000000000004 raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000c8c14d80: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc ffff0000c8c14e00: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc >ffff0000c8c14e80: fa fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff0000c8c14f00: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc ffff0000c8c14f80: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================