syzbot


KASAN: use-after-free Read in soft_cursor

Status: fixed on 2020/10/26 21:28
Reported-by: syzbot+78f3eb4775da1505c7e6@syzkaller.appspotmail.com
Fix commit: 76fe92986c5c fbcon: Fix user font detection test at fbcon_resize().
First crash: 1767d, last: 1470d
Fix bisection: fixed by (bisect log) :
commit 76fe92986c5c2fff36d8fb83e86332113b6c1725
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Thu Sep 10 22:57:06 2020 +0000

  fbcon: Fix user font detection test at fbcon_resize().

  
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in soft_cursor fbdev C done inconclusive 12 1489d 1765d 0/28 auto-obsoleted due to no activity on 2022/09/23 11:46
linux-4.19 KASAN: use-after-free Read in soft_cursor (2) 2 1378d 1417d 0/1 auto-closed as invalid on 2021/04/26 05:01
linux-4.14 KASAN: use-after-free Read in soft_cursor C inconclusive 7 1256d 1767d 0/1 upstream: reported C repro on 2019/12/04 13:11
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2020/10/26 11:59 3h02m bisect fix linux-4.19.y OK (1) job log
2020/08/30 18:51 27m bisect fix linux-4.19.y OK (0) job log log
2020/07/17 23:16 26m bisect fix linux-4.19.y OK (0) job log log
2020/06/17 22:51 25m bisect fix linux-4.19.y OK (0) job log log
2020/04/20 19:19 26m bisect fix linux-4.19.y OK (0) job log log

Sample crash report:
audit: type=1400 audit(1575461460.667:36): avc:  denied  { map } for  pid=7685 comm="syz-executor975" path="/root/syz-executor975556075" dev="sda1" ino=16484 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 memcpy include/linux/string.h:348 [inline]
BUG: KASAN: use-after-free in soft_cursor+0x439/0xa30 drivers/video/fbdev/core/softcursor.c:70
Read of size 9 at addr ffff8880a5169c51 by task syz-executor975/7685

CPU: 0 PID: 7685 Comm: syz-executor975 Not tainted 4.19.87-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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x20d 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+0x8c/0x2ba mm/kasan/report.c:396
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
 memcpy+0x24/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:348 [inline]
 soft_cursor+0x439/0xa30 drivers/video/fbdev/core/softcursor.c:70
 bit_cursor+0x12fc/0x1a60 drivers/video/fbdev/core/bitblit.c:386
 fbcon_cursor+0x58a/0x7b0 drivers/video/fbdev/core/fbcon.c:1369
 hide_cursor+0x9e/0x300 drivers/tty/vt/vt.c:895
 redraw_screen+0x2ee/0x8e0 drivers/tty/vt/vt.c:988
 vc_do_resize+0x118e/0x14a0 drivers/tty/vt/vt.c:1287
 vc_resize+0x4d/0x60 drivers/tty/vt/vt.c:1307
 vt_ioctl+0x1fe0/0x2530 drivers/tty/vt/vt_ioctl.c:887
 tty_ioctl+0x7f3/0x1510 drivers/tty/tty_io.c:2669
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:688
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:710
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440219
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 5b 14 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc5a43c378 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440219
RDX: 00000000200002c0 RSI: 000000000000560a RDI: 0000000000000004
RBP: 00000000006ca018 R08: 0000000000000001 R09: 00000000004002c8
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000401b00
R13: 0000000000401b90 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6003:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15d/0x750 mm/slab.c:3736
 kmalloc include/linux/slab.h:520 [inline]
 load_elf_phdrs+0x157/0x200 fs/binfmt_elf.c:441
 load_elf_binary+0x94a/0x53a0 fs/binfmt_elf.c:838
 search_binary_handler fs/exec.c:1653 [inline]
 search_binary_handler+0x179/0x570 fs/exec.c:1631
 exec_binprm fs/exec.c:1695 [inline]
 __do_execve_file.isra.0+0x1227/0x2150 fs/exec.c:1819
 do_execveat_common fs/exec.c:1866 [inline]
 do_execve fs/exec.c:1883 [inline]
 __do_sys_execve fs/exec.c:1964 [inline]
 __se_sys_execve fs/exec.c:1959 [inline]
 __x64_sys_execve+0x8f/0xc0 fs/exec.c:1959
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6003:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcf/0x220 mm/slab.c:3822
 load_elf_binary+0x249e/0x53a0 fs/binfmt_elf.c:1117
 search_binary_handler fs/exec.c:1653 [inline]
 search_binary_handler+0x179/0x570 fs/exec.c:1631
 exec_binprm fs/exec.c:1695 [inline]
 __do_execve_file.isra.0+0x1227/0x2150 fs/exec.c:1819
 do_execveat_common fs/exec.c:1866 [inline]
 do_execve fs/exec.c:1883 [inline]
 __do_sys_execve fs/exec.c:1964 [inline]
 __se_sys_execve fs/exec.c:1959 [inline]
 __x64_sys_execve+0x8f/0xc0 fs/exec.c:1959
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a5169a80
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 465 bytes inside of
 512-byte region [ffff8880a5169a80, ffff8880a5169c80)
The buggy address belongs to the page:
page:ffffea0002945a40 count:1 mapcount:0 mapping:ffff88812c31c940 index:0x0
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea0002153ac8 ffffea000281f648 ffff88812c31c940
raw: 0000000000000000 ffff8880a5169080 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a5169b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a5169b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a5169c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff8880a5169c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a5169d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (16):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/12/04 12:14 linux-4.19.y 174651bdf802 0ecb9746 .config console log report syz C ci2-linux-4-19
2020/09/26 11:58 linux-4.19.y d09b80172c22 2d5ea0cb .config console log report info ci2-linux-4-19
2020/09/24 03:04 linux-4.19.y d09b80172c22 54289b08 .config console log report info ci2-linux-4-19
2020/07/31 17:40 linux-4.19.y 13af6c74b14a 8df85ed9 .config console log report ci2-linux-4-19
2020/05/18 22:50 linux-4.19.y 258f0cf7ac3b 684d3606 .config console log report ci2-linux-4-19
2020/05/06 01:39 linux-4.19.y fdc072324f3c 35b8eb30 .config console log report ci2-linux-4-19
2020/04/25 19:31 linux-4.19.y 7edd66cf6167 a113ba38 .config console log report ci2-linux-4-19
2020/03/21 19:04 linux-4.19.y 14cfdbd39e31 78267cec .config console log report ci2-linux-4-19
2020/03/15 02:19 linux-4.19.y 569209711609 749688d2 .config console log report ci2-linux-4-19
2020/03/14 05:28 linux-4.19.y 569209711609 749688d2 .config console log report ci2-linux-4-19
2020/02/26 03:21 linux-4.19.y f25804f38984 4f588111 .config console log report ci2-linux-4-19
2020/01/27 08:42 linux-4.19.y d183c8e2647a dd56146d .config console log report ci2-linux-4-19
2019/12/28 17:28 linux-4.19.y 672481c2deff af6b8ef8 .config console log report ci2-linux-4-19
2019/12/25 06:46 linux-4.19.y 672481c2deff be5c2c81 .config console log report ci2-linux-4-19
2019/12/19 08:15 linux-4.19.y 7d120bf21c05 79b211f7 .config console log report ci2-linux-4-19
2019/12/09 14:51 linux-4.19.y fb683b5e3f53 b31eda3d .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.