syzbot


KASAN: use-after-free Read in fb_mode_is_equal

Status: upstream: reported syz repro on 2019/12/07 10:05
Reported-by: syzbot+f11cda116c57db68c227@syzkaller.appspotmail.com
First crash: 1026d, last: 440d

Cause bisection: introduced by (bisect log) :
commit 13ff178ccd6d3b8074c542a911300b79c4eec255
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Tue May 28 09:02:53 2019 +0000

  fbcon: Call fbcon_mode_deleted/new_modelist directly

Crash: KASAN: use-after-free Read in fb_mode_is_equal (log)
Repro: syz .config

Fix bisection: the fix commit could be any of (bisect log):
  6b643a07a7e4 x86/entry, ubsan, objtool: Whitelist __ubsan_handle_*()
  8e8bb06d199a x86/entry, bug: Comment the instrumentation_begin() usage for WARN()
  14d3b376b6c3 x86/entry, cpumask: Provide non-instrumented variant of cpu_is_offline()
  33aea07f30c2 compiler_attributes.h: Support no_sanitize_undefined check with GCC 4
  5144f8a8dfd7 compiler_types.h: Add __no_sanitize_{address,undefined} to noinstr
  acf7b0bf7dcf kasan: Fix required compiler version
  734d099ba644 objtool: Don't consider vmlinux a C-file
  7b861a53e46b kasan: Bump required compiler version
  5ddbc4082e10 x86, kcsan: Add __no_kcsan to noinstr
  e3a9e681adb7 x86/entry: Fixup bad_iret vs noinstr
  c7aadc09321d x86/entry: Increase entry_stack size to a full page
  e79302ae8c8c kcsan: Remove __no_kcsan_or_inline
  145a773aef83 x86/entry: Fix #UD vs WARN more
  e82587336695 x86, kcsan: Remove __no_kcsan_or_inline usage
  2c92d787cc9f Merge branch 'linus' into x86/entry, to resolve conflicts
Patch testing requests:
Created Duration User Patch Repo Result
2022/09/26 23:30 15m upstream OK log
2022/09/16 05:29 16m upstream OK log
2022/09/10 09:27 15m upstream OK log
2021/03/15 01:49 15m ducheng2@gmail.com upstream OK

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in fb_mode_is_equal+0x297/0x300 drivers/video/fbdev/core/modedb.c:924
Read of size 4 at addr ffff88809188de9c by task syz-executor.2/9357

CPU: 0 PID: 9357 Comm: syz-executor.2 Not tainted 5.5.0-rc3-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.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
 __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
 kasan_report+0x12/0x20 mm/kasan/common.c:639
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:134
 fb_mode_is_equal+0x297/0x300 drivers/video/fbdev/core/modedb.c:924
 fbcon_mode_deleted+0x12c/0x190 drivers/video/fbdev/core/fbcon.c:3060
 fb_set_var+0xab9/0xdd0 drivers/video/fbdev/core/fbmem.c:971
 do_fb_ioctl+0x390/0x7d0 drivers/video/fbdev/core/fbmem.c:1104
 fb_ioctl+0xe6/0x130 drivers/video/fbdev/core/fbmem.c:1180
 vfs_ioctl fs/ioctl.c:47 [inline]
 file_ioctl fs/ioctl.c:545 [inline]
 do_vfs_ioctl+0x977/0x14e0 fs/ioctl.c:732
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:749
 __do_sys_ioctl fs/ioctl.c:756 [inline]
 __se_sys_ioctl fs/ioctl.c:754 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:754
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45a919
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ff3ef112c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045a919
RDX: 0000000020000000 RSI: 0000000000004601 RDI: 0000000000000013
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff3ef1136d4
R13: 00000000004c310d R14: 00000000004d8498 R15: 00000000ffffffff

Allocated by task 9260:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
 kmem_cache_alloc_trace+0x158/0x790 mm/slab.c:3551
 kmalloc include/linux/slab.h:556 [inline]
 fb_add_videomode drivers/video/fbdev/core/modedb.c:1073 [inline]
 fb_add_videomode+0x2fb/0x610 drivers/video/fbdev/core/modedb.c:1057
 fb_set_var+0x5ef/0xdd0 drivers/video/fbdev/core/fbmem.c:1041
 do_fb_ioctl+0x390/0x7d0 drivers/video/fbdev/core/fbmem.c:1104
 fb_ioctl+0xe6/0x130 drivers/video/fbdev/core/fbmem.c:1180
 vfs_ioctl fs/ioctl.c:47 [inline]
 file_ioctl fs/ioctl.c:545 [inline]
 do_vfs_ioctl+0x977/0x14e0 fs/ioctl.c:732
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:749
 __do_sys_ioctl fs/ioctl.c:756 [inline]
 __se_sys_ioctl fs/ioctl.c:754 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:754
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9341:
 save_stack+0x23/0x90 mm/kasan/common.c:72
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:335 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x2c0 mm/slab.c:3757
 fb_delete_videomode+0x3fa/0x540 drivers/video/fbdev/core/modedb.c:1104
 fb_set_var+0xac8/0xdd0 drivers/video/fbdev/core/fbmem.c:974
 do_fb_ioctl+0x390/0x7d0 drivers/video/fbdev/core/fbmem.c:1104
 fb_ioctl+0xe6/0x130 drivers/video/fbdev/core/fbmem.c:1180
 vfs_ioctl fs/ioctl.c:47 [inline]
 file_ioctl fs/ioctl.c:545 [inline]
 do_vfs_ioctl+0x977/0x14e0 fs/ioctl.c:732
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:749
 __do_sys_ioctl fs/ioctl.c:756 [inline]
 __se_sys_ioctl fs/ioctl.c:754 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:754
 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809188de80
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 28 bytes inside of
 96-byte region [ffff88809188de80, ffff88809188dee0)
The buggy address belongs to the page:
page:ffffea0002462340 refcount:1 mapcount:0 mapping:ffff8880aa400540 index:0x0
raw: 00fffe0000000200 ffffea00024fe808 ffffea00024fe848 ffff8880aa400540
raw: 0000000000000000 ffff88809188d000 0000000100000020 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809188dd80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff88809188de00: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
>ffff88809188de80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                            ^
 ffff88809188df00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff88809188df80: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================

Crashes (545):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2019/12/25 10:06 upstream 46cf053efec6 be5c2c81 .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/12/25 09:48 upstream 46cf053efec6 be5c2c81 .config log report syz
ci-upstream-kasan-gce 2019/12/25 08:16 upstream 46cf053efec6 be5c2c81 .config log report syz
ci-upstream-kasan-gce-386 2019/12/25 09:48 upstream 46cf053efec6 be5c2c81 .config log report syz
ci-upstream-kasan-gce 2021/07/15 00:12 upstream 8096acd7442e 94e0b707 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/07/12 22:30 upstream 7fef2edf7cc7 f415556d .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-selinux-root 2021/07/10 13:47 upstream 3dbdb38e2869 8f5a7b8c .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/07/10 11:42 upstream 3dbdb38e2869 8f5a7b8c .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/07/08 08:55 upstream 3dbdb38e2869 95793bce .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-selinux-root 2021/07/05 14:50 upstream 3dbdb38e2869 55aa55c2 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/07/02 23:22 upstream 3dbdb38e2869 55aa55c2 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/06/26 23:28 upstream 625acffd7ae2 9d2ab5df .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-smack-root 2021/06/23 14:19 upstream 0c18f29aae7c aba2b2fb .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/06/20 13:00 upstream 913ec3c22ef4 aba2b2fb .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/06/19 18:05 upstream b1edae0d5f2e aba2b2fb .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/06/18 11:24 upstream fd0aa1a4567d aba2b2fb .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/06/18 05:37 upstream fd0aa1a4567d aba2b2fb .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/06/18 00:53 upstream 70585216fe77 aba2b2fb .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/06/17 02:12 upstream 6b00bc639f1f aba2b2fb .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/06/14 21:50 upstream 009c9aa5be65 1ba81399 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-smack-root 2021/06/12 05:50 upstream f21b807c3cf8 1ba81399 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/06/10 18:15 upstream cd1245d75ce9 1ba81399 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-smack-root 2021/06/07 13:42 upstream 614124bea77e e59537be .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-selinux-root 2021/06/06 12:23 upstream f5b6eb1e0182 500c2339 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/06/03 16:51 upstream 324c92e5e0ee 0740de69 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-smack-root 2021/05/29 04:56 upstream 5ff2756afde0 858ea628 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/05/27 06:48 upstream 7ac3a1c1ae51 858ea628 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/05/26 10:49 upstream ad9f25d33860 54f0bcf1 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/05/18 12:36 upstream 8ac91e6c6033 a343ba6b .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/05/17 19:47 upstream d07f6ca923ea a2eb125d .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/05/17 07:10 upstream d07f6ca923ea f54a5c09 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/05/15 06:20 upstream 25a1298726e9 8bdd5343 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/05/09 20:39 upstream b741596468b0 bc5434be .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/05/08 19:58 upstream ab159ac569fd bc5434be .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/05/05 23:20 upstream d2b6f8a17919 06c27ff5 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-selinux-root 2021/05/03 07:17 upstream d2b6f8a17919 77e2b668 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-root 2021/05/02 03:10 upstream d2b6f8a17919 77e2b668 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2021/04/23 22:47 upstream 18a3c5f7abfd 17f0b706 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-qemu-upstream 2021/03/26 21:59 upstream db24726bfefa a8529b82 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-qemu-upstream 2021/03/02 11:31 upstream 7a7fd0de4a98 92ead296 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-386 2021/06/15 05:50 upstream 009c9aa5be65 1ba81399 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-386 2021/06/04 14:12 upstream f88cd3fb9df2 966a236b .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-386 2021/05/14 14:39 upstream 315d99318179 8bdd5343 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce-386 2021/01/29 12:39 upstream bec4c2968fce 6593fd32 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-linux-next-kasan-gce-root 2021/06/21 18:30 linux-next a1f92694393a aba2b2fb .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-linux-next-kasan-gce-root 2021/06/04 22:31 linux-next a1f92694393a 966a236b .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-linux-next-kasan-gce-root 2021/05/25 09:47 linux-next a1f92694393a 3c7fef33 .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-linux-next-kasan-gce-root 2021/04/03 11:24 linux-next 454c576c3f5e 6a81331a .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-linux-next-kasan-gce-root 2021/03/24 05:12 linux-next d949689e7383 e613994b .config log report info KASAN: use-after-free Read in fb_mode_is_equal
ci-upstream-kasan-gce 2020/10/13 03:27 upstream bbf5c979011a d32b0bbf .config log report info
ci-upstream-kasan-gce 2020/10/12 15:53 upstream bbf5c979011a d32b0bbf .config log report info
ci-upstream-kasan-gce 2020/10/11 22:55 upstream 3dd0130f2430 4a77ae0b .config log report info
ci-upstream-kasan-gce-smack-root 2020/10/11 18:14 upstream da690031a5d6 4a77ae0b .config log report info
ci-upstream-kasan-gce 2020/10/11 15:03 upstream da690031a5d6 4a77ae0b .config log report info
ci-upstream-kasan-gce 2020/10/11 12:04 upstream da690031a5d6 4a77ae0b .config log report info
ci-upstream-kasan-gce 2020/10/10 19:04 upstream 6f2f486d57c4 4a77ae0b .config log report info
ci-upstream-kasan-gce-root 2019/12/07 08:45 upstream 7ada90eb9c7a 85f26751 .config log report
ci-qemu-upstream-386 2020/10/11 13:44 upstream da690031a5d6 4a77ae0b .config log report info
ci-upstream-kasan-gce-386 2020/10/11 04:48 upstream da690031a5d6 4a77ae0b .config log report info
* Struck through repros no longer work on HEAD.