================================================================== BUG: KASAN: use-after-free in string+0x208/0x230 lib/vsprintf.c:606 Read of size 1 at addr ffff8880a82d7280 by task syz-executor.4/30790 CPU: 1 PID: 30790 Comm: syz-executor.4 Not tainted 5.1.0-rc5+ #77 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317 __asan_report_load1_noabort+0x14/0x20 mm/kasan/generic_report.c:129 string+0x208/0x230 lib/vsprintf.c:606 vsnprintf+0xbfc/0x1af0 lib/vsprintf.c:2396 add_uevent_var+0x14d/0x310 lib/kobject_uevent.c:661 input_dev_uevent+0x163/0x890 drivers/input/input.c:1594 dev_uevent+0x312/0x580 drivers/base/core.c:1180 kobject_uevent_env+0x487/0x1030 lib/kobject_uevent.c:549 kobject_uevent+0x20/0x26 lib/kobject_uevent.c:638 kobject_cleanup lib/kobject.c:649 [inline] kobject_release lib/kobject.c:691 [inline] kref_put include/linux/kref.h:67 [inline] kobject_put.cold+0x177/0x2ec lib/kobject.c:708 put_device+0x20/0x30 drivers/base/core.c:2205 input_put_device include/linux/input.h:349 [inline] evdev_free+0x51/0x70 drivers/input/evdev.c:369 device_release+0x7d/0x210 drivers/base/core.c:1064 kobject_cleanup lib/kobject.c:662 [inline] kobject_release lib/kobject.c:691 [inline] kref_put include/linux/kref.h:67 [inline] kobject_put.cold+0x28f/0x2ec lib/kobject.c:708 cdev_default_release+0x41/0x50 fs/char_dev.c:607 kobject_cleanup lib/kobject.c:662 [inline] kobject_release lib/kobject.c:691 [inline] kref_put include/linux/kref.h:67 [inline] kobject_put.cold+0x28f/0x2ec lib/kobject.c:708 cdev_put.part.0+0x39/0x50 fs/char_dev.c:368 cdev_put+0x20/0x30 fs/char_dev.c:366 __fput+0x6df/0x8d0 fs/file_table.c:281 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x14a/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:166 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline] syscall_return_slowpath arch/x86/entry/common.c:268 [inline] do_syscall_64+0x52d/0x610 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4129e1 Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 e4 1a 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:0000000000a4fbd0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000005 RCX: 00000000004129e1 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004 RBP: 000000000073c900 R08: 000000009ab4d1ab R09: 000000009ab4d1af R10: 0000000000a4fca0 R11: 0000000000000293 R12: 0000000000000001 R13: 000000000073c900 R14: 00000000001c8385 R15: 000000000073bf0c Allocated by task 30791: save_stack+0x45/0xd0 mm/kasan/common.c:75 set_track mm/kasan/common.c:87 [inline] __kasan_kmalloc mm/kasan/common.c:497 [inline] __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:511 __do_kmalloc mm/slab.c:3727 [inline] __kmalloc_track_caller+0x158/0x740 mm/slab.c:3742 kstrndup+0x5f/0xf0 mm/util.c:96 uinput_dev_setup+0x1d4/0x310 drivers/input/misc/uinput.c:475 uinput_ioctl_handler.isra.0+0x12b8/0x1cc0 drivers/input/misc/uinput.c:886 uinput_ioctl+0x4a/0x60 drivers/input/misc/uinput.c:1049 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd6e/0x1390 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 30791: save_stack+0x45/0xd0 mm/kasan/common.c:75 set_track mm/kasan/common.c:87 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459 kasan_slab_free+0xe/0x10 mm/kasan/common.c:467 __cache_free mm/slab.c:3499 [inline] kfree+0xcf/0x230 mm/slab.c:3822 uinput_destroy_device+0xf8/0x250 drivers/input/misc/uinput.c:311 uinput_ioctl_handler.isra.0+0x886/0x1cc0 drivers/input/misc/uinput.c:882 uinput_ioctl+0x4a/0x60 drivers/input/misc/uinput.c:1049 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd6e/0x1390 fs/ioctl.c:696 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880a82d7280 which belongs to the cache kmalloc-32 of size 32 The buggy address is located 0 bytes inside of 32-byte region [ffff8880a82d7280, ffff8880a82d72a0) The buggy address belongs to the page: page:ffffea0002a0b5c0 count:1 mapcount:0 mapping:ffff88812c3f01c0 index:0xffff8880a82d7fc1 flags: 0x1fffc0000000200(slab) raw: 01fffc0000000200 ffffea0002391508 ffffea00028d7d48 ffff88812c3f01c0 raw: ffff8880a82d7fc1 ffff8880a82d7000 0000000100000034 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a82d7180: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc ffff8880a82d7200: 00 00 fc fc fc fc fc fc fb fb fb fb fc fc fc fc >ffff8880a82d7280: fb fb fb fb fc fc fc fc 00 07 fc fc fc fc fc fc ^ ffff8880a82d7300: fb fb fb fb fc fc fc fc 00 00 fc fc fc fc fc fc ffff8880a82d7380: 00 00 fc fc fc fc fc fc fb fb fb fb fc fc fc fc ==================================================================