syzbot


KASAN: use-after-free Write in release_tty

Status: fixed on 2020/04/28 10:48
Reported-by: syzbot+ca54dfe7ee8497f34d01@syzkaller.appspotmail.com
Fix commit: 54584f79579b vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console
First crash: 1815d, last: 1698d
Fix bisection: fixed by (bisect log) :
commit 54584f79579b9f6ed49b93cadcd2361223ecce28
Author: Eric Biggers <ebiggers@google.com>
Date: Sun Mar 22 03:43:04 2020 +0000

  vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console

  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in release_tty C done 591 1692d 1814d 15/28 fixed on 2020/05/10 10:41
linux-4.14 KASAN: use-after-free Write in release_tty C done 124 1695d 1814d 1/1 fixed on 2020/05/01 20:49

Sample crash report:
audit: type=1400 audit(1585429994.010:36): avc:  denied  { map } for  pid=7979 comm="syz-executor089" path="/root/syz-executor089977404" dev="sda1" ino=16483 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
==================================================================
BUG: KASAN: use-after-free in con_shutdown+0x7f/0x90 drivers/tty/vt/vt.c:3262
Write of size 8 at addr ffff8880a574e248 by task syz-executor089/7986

CPU: 0 PID: 7986 Comm: syz-executor089 Not tainted 4.19.113-syzkaller #0
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+0x188/0x20d lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x212 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x88/0x2b9 mm/kasan/report.c:396
 con_shutdown+0x7f/0x90 drivers/tty/vt/vt.c:3262
 release_tty+0xda/0x4c0 drivers/tty/tty_io.c:1509
 tty_release_struct+0x37/0x50 drivers/tty/tty_io.c:1624
 tty_release+0xbc7/0xe90 drivers/tty/tty_io.c:1784
 __fput+0x2cd/0x890 fs/file_table.c:278
 task_work_run+0x13f/0x1b0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xbcd/0x2f30 kernel/exit.c:880
 do_group_exit+0x125/0x350 kernel/exit.c:983
 __do_sys_exit_group kernel/exit.c:994 [inline]
 __se_sys_exit_group kernel/exit.c:992 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:992
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x43ffe8
Code: 00 00 be 3c 00 00 00 eb 19 66 0f 1f 84 00 00 00 00 00 48 89 d7 89 f0 0f 05 48 3d 00 f0 ff ff 77 21 f4 48 89 d7 44 89 c0 0f 05 <48> 3d 00 f0 ff ff 76 e0 f7 d8 64 41 89 01 eb d8 0f 1f 84 00 00 00
RSP: 002b:00007ffddea0f908 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043ffe8
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00000000004bfa30 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 000000000000000e R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d2180 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7986:
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531
 kmem_cache_alloc_trace+0x14d/0x7a0 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 vc_allocate drivers/tty/vt/vt.c:1099 [inline]
 vc_allocate+0x1db/0x6d0 drivers/tty/vt/vt.c:1080
 con_install+0x4f/0x400 drivers/tty/vt/vt.c:3213
 tty_driver_install_tty drivers/tty/tty_io.c:1226 [inline]
 tty_init_dev drivers/tty/tty_io.c:1339 [inline]
 tty_init_dev+0xee/0x450 drivers/tty/tty_io.c:1316
 tty_open_by_driver drivers/tty/tty_io.c:1981 [inline]
 tty_open+0x4b0/0xb00 drivers/tty/tty_io.c:2029
 chrdev_open+0x219/0x5c0 fs/char_dev.c:423
 do_dentry_open+0x4a8/0x1160 fs/open.c:796
 do_last fs/namei.c:3421 [inline]
 path_openat+0x1031/0x4200 fs/namei.c:3537
 do_filp_open+0x1a1/0x280 fs/namei.c:3567
 do_sys_open+0x3c0/0x500 fs/open.c:1085
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7990:
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0xf7/0x140 mm/kasan/kasan.c:521
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xce/0x220 mm/slab.c:3822
 vt_disallocate_all+0x293/0x3b0 drivers/tty/vt/vt_ioctl.c:323
 vt_ioctl+0xb79/0x2310 drivers/tty/vt/vt_ioctl.c:816
 tty_ioctl+0x7a1/0x1420 drivers/tty/tty_io.c:2669
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcda/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a574e140
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 264 bytes inside of
 2048-byte region [ffff8880a574e140, ffff8880a574e940)
The buggy address belongs to the page:
page:ffffea000295d380 count:1 mapcount:0 mapping:ffff88812c3dcc40 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea000295e988 ffffea00021dd488 ffff88812c3dcc40
raw: 0000000000000000 ffff8880a574e140 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a574e100: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8880a574e180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a574e200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff8880a574e280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a574e300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (148):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/28 21:15 linux-4.19.y 54b4fa6d3955 f1ebdfba .config console log report syz C ci2-linux-4-19
2020/03/28 05:29 linux-4.19.y 54b4fa6d3955 831e9a81 .config console log report syz C ci2-linux-4-19
2020/03/26 00:39 linux-4.19.y 54b4fa6d3955 e8e6c7d2 .config console log report syz C ci2-linux-4-19
2020/03/19 22:44 linux-4.19.y 93556fb211fa 2c31c529 .config console log report syz C ci2-linux-4-19
2020/03/16 07:14 linux-4.19.y 569209711609 749688d2 .config console log report syz C ci2-linux-4-19
2020/03/15 16:44 linux-4.19.y 569209711609 749688d2 .config console log report syz C ci2-linux-4-19
2020/03/14 12:58 linux-4.19.y 569209711609 749688d2 .config console log report syz C ci2-linux-4-19
2020/03/13 10:37 linux-4.19.y 569209711609 fd69032d .config console log report syz C ci2-linux-4-19
2020/03/11 06:50 linux-4.19.y 7472c4028e23 35f53e45 .config console log report syz C ci2-linux-4-19
2020/03/07 04:52 linux-4.19.y 7472c4028e23 fd2a5f28 .config console log report syz C ci2-linux-4-19
2020/03/05 16:08 linux-4.19.y a083db76118d b655d91b .config console log report syz C ci2-linux-4-19
2020/03/04 20:14 linux-4.19.y a083db76118d 712198ac .config console log report syz C ci2-linux-4-19
2020/03/04 18:53 linux-4.19.y a083db76118d 712198ac .config console log report syz C ci2-linux-4-19
2020/03/04 02:52 linux-4.19.y a083db76118d 1f73b64b .config console log report syz C ci2-linux-4-19
2020/03/03 01:12 linux-4.19.y a083db76118d 4a4e0509 .config console log report syz C ci2-linux-4-19
2020/03/02 23:16 linux-4.19.y a083db76118d 4a4e0509 .config console log report syz C ci2-linux-4-19
2020/02/29 04:45 linux-4.19.y a083db76118d c88c7b75 .config console log report syz C ci2-linux-4-19
2020/02/28 12:44 linux-4.19.y f25804f38984 c88c7b75 .config console log report syz C ci2-linux-4-19
2020/02/27 15:25 linux-4.19.y f25804f38984 40bcfdd5 .config console log report syz C ci2-linux-4-19
2020/02/26 23:43 linux-4.19.y f25804f38984 251aabb7 .config console log report syz C ci2-linux-4-19
2020/02/24 18:59 linux-4.19.y f25804f38984 1253d6f0 .config console log report syz C ci2-linux-4-19
2020/02/23 19:08 linux-4.19.y 4fccc2503536 2c36e7a7 .config console log report syz C ci2-linux-4-19
2020/02/20 17:36 linux-4.19.y 4fccc2503536 81230308 .config console log report syz C ci2-linux-4-19
2020/02/20 16:53 linux-4.19.y 4fccc2503536 81230308 .config console log report syz C ci2-linux-4-19
2020/02/19 11:11 linux-4.19.y 9b15f7fae677 135c18aa .config console log report syz C ci2-linux-4-19
2020/02/16 08:04 linux-4.19.y 9b15f7fae677 5d7b90f1 .config console log report syz C ci2-linux-4-19
2020/02/13 21:04 linux-4.19.y 357668399cf7 e6247653 .config console log report syz C ci2-linux-4-19
2020/02/10 22:03 linux-4.19.y b499cf4b3a90 d9e55b05 .config console log report syz C ci2-linux-4-19
2020/02/10 03:43 linux-4.19.y b499cf4b3a90 35f5e45e .config console log report syz C ci2-linux-4-19
2020/02/09 15:24 linux-4.19.y b499cf4b3a90 6ece2ea5 .config console log report syz C ci2-linux-4-19
2020/02/09 12:53 linux-4.19.y b499cf4b3a90 6ece2ea5 .config console log report syz C ci2-linux-4-19
2020/02/08 21:07 linux-4.19.y b499cf4b3a90 06150bf1 .config console log report syz C ci2-linux-4-19
2020/02/07 10:04 linux-4.19.y b499cf4b3a90 06150bf1 .config console log report syz C ci2-linux-4-19
2020/02/03 03:17 linux-4.19.y 32ee7492f104 93e5e335 .config console log report syz C ci2-linux-4-19
2020/02/01 15:43 linux-4.19.y 32ee7492f104 326d4c78 .config console log report syz C ci2-linux-4-19
2020/01/24 19:24 linux-4.19.y d183c8e2647a 2e95ab33 .config console log report syz C ci2-linux-4-19
2020/01/23 13:15 linux-4.19.y d183c8e2647a 3334d684 .config console log report syz C ci2-linux-4-19
2020/01/21 14:21 linux-4.19.y dc4ba5be1bab 8eda0b95 .config console log report syz C ci2-linux-4-19
2020/01/21 10:27 linux-4.19.y dc4ba5be1bab 8eda0b95 .config console log report syz C ci2-linux-4-19
2020/01/20 18:57 linux-4.19.y dc4ba5be1bab c40da18c .config console log report syz C ci2-linux-4-19
2020/01/17 00:05 linux-4.19.y db5b9190ff82 3de7aabb .config console log report syz C ci2-linux-4-19
2020/01/09 22:11 linux-4.19.y cb1f9a169a0e 4de4e9f0 .config console log report syz C ci2-linux-4-19
2020/01/09 13:08 linux-4.19.y cb1f9a169a0e ddc3e859 .config console log report syz C ci2-linux-4-19
2020/01/09 02:18 linux-4.19.y 3d40d7117e35 ddc3e859 .config console log report syz C ci2-linux-4-19
2019/12/03 04:39 linux-4.19.y 174651bdf802 ab342da3 .config console log report syz C ci2-linux-4-19
2020/03/29 03:55 linux-4.19.y 54b4fa6d3955 05736b29 .config console log report ci2-linux-4-19
2020/03/27 01:42 linux-4.19.y 54b4fa6d3955 6d25c5a0 .config console log report ci2-linux-4-19
2020/03/21 11:29 linux-4.19.y 14cfdbd39e31 aa6c6a55 .config console log report ci2-linux-4-19
2020/03/18 12:40 linux-4.19.y 93556fb211fa 0a96a13c .config console log report ci2-linux-4-19
2020/03/18 01:42 linux-4.19.y 339485c9a80f 97bc55ce .config console log report ci2-linux-4-19
2020/03/02 17:28 linux-4.19.y a083db76118d 4a4e0509 .config console log report ci2-linux-4-19
2020/03/02 09:13 linux-4.19.y a083db76118d 4a4e0509 .config console log report ci2-linux-4-19
2020/02/29 21:27 linux-4.19.y a083db76118d c88c7b75 .config console log report ci2-linux-4-19
2020/02/27 11:19 linux-4.19.y f25804f38984 40bcfdd5 .config console log report ci2-linux-4-19
2020/02/27 05:25 linux-4.19.y f25804f38984 251aabb7 .config console log report ci2-linux-4-19
2020/02/21 23:50 linux-4.19.y 4fccc2503536 2ffa6679 .config console log report ci2-linux-4-19
2020/02/18 14:29 linux-4.19.y 9b15f7fae677 012fbc32 .config console log report ci2-linux-4-19
2020/02/18 10:43 linux-4.19.y 9b15f7fae677 1ce142dc .config console log report ci2-linux-4-19
2020/02/17 17:04 linux-4.19.y 9b15f7fae677 72bfa6f2 .config console log report ci2-linux-4-19
2020/02/17 04:37 linux-4.19.y 9b15f7fae677 1f448cd6 .config console log report ci2-linux-4-19
2020/02/11 12:52 linux-4.19.y b499cf4b3a90 084454ae .config console log report ci2-linux-4-19
2020/02/07 21:33 linux-4.19.y b499cf4b3a90 06150bf1 .config console log report ci2-linux-4-19
2020/02/05 19:10 linux-4.19.y b499cf4b3a90 662cf49a .config console log report ci2-linux-4-19
2020/02/05 16:45 linux-4.19.y b499cf4b3a90 662cf49a .config console log report ci2-linux-4-19
2020/02/03 16:45 linux-4.19.y 32ee7492f104 93e5e335 .config console log report ci2-linux-4-19
2020/02/02 15:33 linux-4.19.y 32ee7492f104 93e5e335 .config console log report ci2-linux-4-19
2020/02/01 19:34 linux-4.19.y 32ee7492f104 326d4c78 .config console log report ci2-linux-4-19
2020/01/30 17:33 linux-4.19.y 7cdefde351b6 5ed23f9a .config console log report ci2-linux-4-19
2020/01/27 21:01 linux-4.19.y 88d6de67e390 56cd6c9b .config console log report ci2-linux-4-19
2020/01/21 12:45 linux-4.19.y dc4ba5be1bab 8eda0b95 .config console log report ci2-linux-4-19
2020/01/16 20:01 linux-4.19.y db5b9190ff82 3de7aabb .config console log report ci2-linux-4-19
2020/01/16 01:23 linux-4.19.y db5b9190ff82 f9b69507 .config console log report ci2-linux-4-19
2020/01/15 16:49 linux-4.19.y db5b9190ff82 069a5a44 .config console log report ci2-linux-4-19
2020/01/13 14:33 linux-4.19.y dcd888983542 99565c1a .config console log report ci2-linux-4-19
2020/01/13 09:24 linux-4.19.y dcd888983542 53faa9fe .config console log report ci2-linux-4-19
2020/01/12 23:33 linux-4.19.y dcd888983542 53faa9fe .config console log report ci2-linux-4-19
2020/01/12 12:56 linux-4.19.y dcd888983542 31290a45 .config console log report ci2-linux-4-19
2020/01/12 02:25 linux-4.19.y cb1f9a169a0e 4c04afaa .config console log report ci2-linux-4-19
2020/01/05 20:40 linux-4.19.y 3d40d7117e35 d646e21f .config console log report ci2-linux-4-19
2020/01/01 19:34 linux-4.19.y c7ecf3e3a71c 25a0186e .config console log report ci2-linux-4-19
2020/01/01 12:20 linux-4.19.y c7ecf3e3a71c 25a0186e .config console log report ci2-linux-4-19
2020/01/01 01:39 linux-4.19.y c7ecf3e3a71c 25a0186e .config console log report ci2-linux-4-19
2019/12/20 02:56 linux-4.19.y 7d120bf21c05 36650b4b .config console log report ci2-linux-4-19
2019/12/19 04:09 linux-4.19.y 7d120bf21c05 79b211f7 .config console log report ci2-linux-4-19
2019/12/17 21:24 linux-4.19.y 7d120bf21c05 1af3875f .config console log report ci2-linux-4-19
2019/12/17 03:41 linux-4.19.y 312017a460d5 d13d7958 .config console log report ci2-linux-4-19
2019/12/16 03:24 linux-4.19.y 312017a460d5 eef6e580 .config console log report ci2-linux-4-19
2019/12/14 18:13 linux-4.19.y 312017a460d5 eef6e580 .config console log report ci2-linux-4-19
2019/12/13 21:41 linux-4.19.y 312017a460d5 a5c1ab05 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.