syzbot


KASAN: use-after-free Read in string
Status: fixed on 2019/06/14 18:22
Reported-by: syzbot+f648cfb7e0b52bf7ae32@syzkaller.appspotmail.com
Fix commit: c03a0fd0b609 kobject: Don't trigger kobject_uevent(KOBJ_REMOVE) twice.
First crash: 1365d, last: 1122d
duplicates (1):
Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
KASAN: use-after-free Read in add_uevent_var C done 3 1118d 1118d 0/22 closed as dup on 2019/05/05 08:45
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in string 1 1127d 1127d 0/1 auto-closed as invalid on 2019/10/23 10:48
linux-4.19 KASAN: use-after-free Read in string 2 1126d 1134d 0/1 auto-closed as invalid on 2019/10/24 04:08

Sample crash report:
RDX: 0000000000000001 RSI: 0000000000005502 RDI: 0000000000000004
RBP: 00000000006cf018 R08: 0000000000000001 R09: 0000000000000038
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000006
R13: ffffffffffffffff R14: 0000000000000000 R15: 0000000000000000
==================================================================
BUG: KASAN: use-after-free in string+0x2c6/0x2d0 lib/vsprintf.c:604
Read of size 1 at addr ffff8801d79c5080 by task syz-executor215/4685

CPU: 1 PID: 4685 Comm: syz-executor215 Not tainted 4.19.0-rc1+ #215
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+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x30d mm/kasan/report.c:412
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 string+0x2c6/0x2d0 lib/vsprintf.c:604
 vsnprintf+0x48f/0x1b60 lib/vsprintf.c:2293
 add_uevent_var+0x140/0x2f0 lib/kobject_uevent.c:659
 input_dev_uevent+0x15d/0x860 drivers/input/input.c:1594
 dev_uevent+0x340/0x7e0 drivers/base/core.c:1008
 kobject_uevent_env+0x45b/0x1110 lib/kobject_uevent.c:547
 kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:636
 kobject_cleanup lib/kobject.c:649 [inline]
 kobject_release lib/kobject.c:691 [inline]
 kref_put include/linux/kref.h:70 [inline]
 kobject_put+0x1fb/0x280 lib/kobject.c:708
 put_device+0x20/0x30 drivers/base/core.c:2024
 input_put_device include/linux/input.h:349 [inline]
 evdev_free+0x4f/0x70 drivers/input/evdev.c:369
 device_release+0x7e/0x210 drivers/base/core.c:891
 kobject_cleanup lib/kobject.c:662 [inline]
 kobject_release lib/kobject.c:691 [inline]
 kref_put include/linux/kref.h:70 [inline]
 kobject_put+0x194/0x280 lib/kobject.c:708
 cdev_default_release+0x3e/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:70 [inline]
 kobject_put+0x194/0x280 lib/kobject.c:708
 cdev_put.part.0+0x36/0x50 fs/char_dev.c:368
 cdev_put+0x1f/0x30 fs/char_dev.c:366
 __fput+0x8ae/0xa40 fs/file_table.c:281
 ____fput+0x15/0x20 fs/file_table.c:309
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1ae4/0x26e0 kernel/exit.c:867
 do_group_exit+0x177/0x440 kernel/exit.c:970
 __do_sys_exit_group kernel/exit.c:981 [inline]
 __se_sys_exit_group kernel/exit.c:979 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:979
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443a68
Code: Bad RIP value.
RSP: 002b:00007fff70261298 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000443a68
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004c39c8 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d5180 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 4685:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc mm/slab.c:3718 [inline]
 __kmalloc_track_caller+0x14a/0x720 mm/slab.c:3733
 kstrndup+0x5f/0xe0 mm/util.c:98
 uinput_setup_device_legacy drivers/input/misc/uinput.c:549 [inline]
 uinput_write+0x2fb/0x1120 drivers/input/misc/uinput.c:621
 __vfs_write+0x117/0x9d0 fs/read_write.c:485
 vfs_write+0x1fc/0x560 fs/read_write.c:549
 ksys_write+0x101/0x260 fs/read_write.c:598
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write fs/read_write.c:607 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:607
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4685:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x210 mm/slab.c:3813
 uinput_destroy_device+0xf8/0x250 drivers/input/misc/uinput.c:310
 uinput_ioctl_handler.isra.10+0x1439/0x2540 drivers/input/misc/uinput.c:880
 uinput_ioctl+0x4c/0x60 drivers/input/misc/uinput.c:1047
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
 __do_sys_ioctl fs/ioctl.c:709 [inline]
 __se_sys_ioctl fs/ioctl.c:707 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801d79c5080
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff8801d79c5080, ffff8801d79c50a0)
The buggy address belongs to the page:
page:ffffea00075e7140 count:1 mapcount:0 mapping:ffff8801dac001c0 index:0xffff8801d79c5fc1
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea00075e0908 ffffea00075e7408 ffff8801dac001c0
raw: ffff8801d79c5fc1 ffff8801d79c5000 000000010000003f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d79c4f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801d79c5000: 00 00 fc fc fc fc fc fc 00 00 00 fc fc fc fc fc
>ffff8801d79c5080: fb fb fb fb fc fc fc fc 07 fc fc fc fc fc fc fc
                   ^
 ffff8801d79c5100: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8801d79c5180: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (247):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2018/08/30 22:34 upstream 58c3f14f86c9 938220fd .config log report syz C
ci-upstream-kasan-gce 2019/05/01 12:18 upstream f2bc9c908dfe 618456b4 .config log report
ci-upstream-kasan-gce-smack-root 2019/04/28 11:49 upstream 037904a22bf8 b617407b .config log report
ci-upstream-kasan-gce-root 2019/04/27 20:47 upstream baf76f0c58ae b617407b .config log report
ci-upstream-kasan-gce-smack-root 2019/04/27 03:18 upstream d0473f978e61 b617407b .config log report
ci-upstream-kasan-gce 2019/04/26 20:56 upstream d0473f978e61 b617407b .config log report
ci-upstream-kasan-gce-smack-root 2019/04/24 04:50 upstream 7142eaa58b49 4d3d6a50 .config log report
ci-upstream-kasan-gce 2019/04/22 16:50 upstream 085b7755808a 0a77c33c .config log report
ci-upstream-kasan-gce 2019/04/22 11:54 upstream 085b7755808a 0a77c33c .config log report
ci-upstream-kasan-gce-selinux-root 2019/04/22 01:10 upstream 085b7755808a b0e8efcb .config log report
ci-upstream-kasan-gce 2019/04/21 22:25 upstream 085b7755808a b0e8efcb .config log report
ci-upstream-kasan-gce-smack-root 2019/04/20 14:22 upstream 371dd432ab39 b0e8efcb .config log report
ci-upstream-kasan-gce 2019/04/20 02:46 upstream 3ecafda911f4 b0e8efcb .config log report
ci-upstream-kasan-gce-root 2019/04/18 15:39 upstream e53f31bffe1d b0e8efcb .config log report
ci-upstream-kasan-gce-smack-root 2019/04/17 11:42 upstream 444fe9913539 b0e8efcb .config log report
ci-upstream-kasan-gce 2019/04/16 07:15 upstream 5512320c9f6f 505ab413 .config log report
ci-upstream-kasan-gce-root 2019/04/15 19:42 upstream dc4060a5dc25 505ab413 .config log report
ci-upstream-kasan-gce-smack-root 2019/04/15 05:29 upstream dc4060a5dc25 505ab413 .config log report
ci-upstream-kasan-gce-smack-root 2019/04/14 17:08 upstream 4443f8e6ac77 505ab413 .config log report
ci-upstream-kasan-gce-selinux-root 2019/04/14 10:36 upstream 4443f8e6ac77 c402d8f1 .config log report
ci-upstream-kasan-gce-root 2019/04/12 19:10 upstream 8ee15f324866 8916f5e1 .config log report
ci-upstream-kasan-gce-selinux-root 2019/04/10 13:44 upstream 0ee7fb36f988 65b612b7 .config log report
ci-upstream-kasan-gce 2019/04/08 02:19 upstream 3b0468914708 c34fde03 .config log report
ci-upstream-kasan-gce 2019/03/27 11:20 upstream 65ae689329c5 55684ce1 .config log report
ci-upstream-kasan-gce-smack-root 2019/03/25 15:41 upstream 8c2ffd917477 2c86e0a5 .config log report
ci-upstream-kasan-gce 2019/03/24 17:55 upstream 1bdd3dbfff7a acbc5b7d .config log report
ci-upstream-kasan-gce-smack-root 2019/03/24 04:38 upstream a5ed1e96cafd a2cef203 .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/23 17:13 upstream a5ed1e96cafd a2cef203 .config log report
ci-upstream-kasan-gce 2019/03/21 21:36 upstream 54c490164523 dce6e62f .config log report
ci-upstream-kasan-gce 2019/03/19 04:36 upstream 9e98c678c2d6 46264c32 .config log report
ci-upstream-kasan-gce-smack-root 2019/03/15 17:28 upstream f261c4e529da bab43553 .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/15 14:35 upstream f261c4e529da bab43553 .config log report
ci-upstream-kasan-gce 2019/03/14 11:27 upstream fa3d493f7a57 d09a902e .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/12 03:13 upstream a089e4fed5c5 12365b99 .config log report
ci-upstream-kasan-gce 2019/03/10 16:23 upstream 6cdc577a18a6 12365b99 .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/09 18:25 upstream 38e7571c07be 12365b99 .config log report
ci-upstream-kasan-gce-smack-root 2019/03/09 11:00 upstream 3601fe43e816 12365b99 .config log report
ci-upstream-kasan-gce 2019/03/08 16:24 upstream 610cd4eadec4 12365b99 .config log report
ci-upstream-kasan-gce 2019/03/08 13:18 upstream 610cd4eadec4 12365b99 .config log report
ci-upstream-kasan-gce-root 2018/08/30 20:47 upstream 58c3f14f86c9 938220fd .config log report
ci-upstream-kasan-gce-386 2019/04/30 13:31 upstream 83a50840e72a 20f16bef .config log report
ci-upstream-kasan-gce-386 2019/04/27 02:00 upstream d0473f978e61 b617407b .config log report
ci-upstream-kasan-gce-386 2019/03/16 19:30 upstream 9c7dc824d9a4 bab43553 .config log report
ci-upstream-kasan-gce-386 2019/03/15 18:39 upstream f261c4e529da bab43553 .config log report
ci-upstream-kasan-gce-386 2019/03/10 20:44 upstream 065b6c4c913d 12365b99 .config log report
ci-upstream-kasan-gce-386 2019/03/10 14:30 upstream 6cdc577a18a6 12365b99 .config log report
ci-upstream-kasan-gce-386 2019/03/08 03:35 upstream 1fc1cd8399ab 4b69c3cb .config log report
ci-upstream-kasan-gce-386 2019/03/05 11:12 upstream cd2a3bf02625 bb91cf81 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/19 23:00 linux-next 75e6a83b189c e4549234 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/19 16:58 linux-next 75e6a83b189c e4549234 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/15 22:07 linux-next cf08baa29613 bab43553 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/12 05:32 linux-next cf08baa29613 12365b99 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/04 22:06 linux-next 5d57915a1c8b 7c693b52 .config log report