syzbot


KASAN: stack-out-of-bounds Write in check_move_unevictable_pages

Status: upstream: reported C repro on 2022/06/07 13:11
Reported-by: syzbot+8847ae8c7bc46bc9c10e@syzkaller.appspotmail.com
First crash: 109d, last: 108d

Cause bisection: introduced by (bisect log) :
commit 15603c238d1318c66c49df232fb2e2631a0062a0
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date: Sat Jun 4 21:39:09 2022 +0000

  vmscan: Add check_move_unevictable_folios()

Crash: KASAN: stack-out-of-bounds Write in check_move_unevictable_pages (log)
Repro: C syz .config

Sample crash report:
==================================================================
BUG: KASAN: vmalloc-out-of-bounds in folio_batch_add include/linux/pagevec.h:130 [inline]
BUG: KASAN: vmalloc-out-of-bounds in check_move_unevictable_pages+0x3f6/0x440 mm/vmscan.c:4857
Write of size 8 at addr ffffc90002d20008 by task syz-executor405/3609

CPU: 0 PID: 3609 Comm: syz-executor405 Not tainted 5.19.0-rc1-next-20220607-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0xf/0x495 mm/kasan/report.c:313
 print_report mm/kasan/report.c:429 [inline]
 kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491
 folio_batch_add include/linux/pagevec.h:130 [inline]
 check_move_unevictable_pages+0x3f6/0x440 mm/vmscan.c:4857
 drm_gem_check_release_pagevec drivers/gpu/drm/drm_gem.c:511 [inline]
 drm_gem_put_pages+0x29f/0x3f0 drivers/gpu/drm/drm_gem.c:639
 drm_gem_shmem_put_pages_locked+0x13e/0x230 drivers/gpu/drm/drm_gem_shmem_helper.c:237
 drm_gem_shmem_put_pages drivers/gpu/drm/drm_gem_shmem_helper.c:252 [inline]
 drm_gem_shmem_vm_close+0x45/0x70 drivers/gpu/drm/drm_gem_shmem_helper.c:588
 remove_vma+0x81/0x130 mm/mmap.c:187
 exit_mmap+0x2a1/0x750 mm/mmap.c:3215
 __mmput+0x128/0x4c0 kernel/fork.c:1180
 mmput+0x5c/0x70 kernel/fork.c:1201
 exit_mm kernel/exit.c:510 [inline]
 do_exit+0xa18/0x2a00 kernel/exit.c:782
 do_group_exit+0xd2/0x2f0 kernel/exit.c:925
 __do_sys_exit_group kernel/exit.c:936 [inline]
 __se_sys_exit_group kernel/exit.c:934 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:934
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f8e2c28b299
Code: Unable to access opcode bytes at RIP 0x7f8e2c28b26f.
RSP: 002b:00007ffe02c318d8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f8e2c2ff270 RCX: 00007f8e2c28b299
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 0000000100000000
R10: 0000000000000012 R11: 0000000000000246 R12: 00007f8e2c2ff270
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
 </TASK>

The buggy address belongs to the virtual mapping at
 [ffffc90002d18000, ffffc90002d21000) created by:
 kernel_clone+0xe7/0xab0 kernel/fork.c:2648

Memory state around the buggy address:
 ffffc90002d1ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90002d1ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc90002d20000: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
                      ^
 ffffc90002d20080: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
 ffffc90002d20100: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================

Crashes (9):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-linux-next-kasan-gce-root 2022/06/07 22:54 linux-next 73d0e32571a0 c8857892 .config log report syz C KASAN: vmalloc-out-of-bounds Write in check_move_unevictable_pages
ci-upstream-linux-next-kasan-gce-root 2022/06/07 18:47 linux-next 73d0e32571a0 c8857892 .config log report syz C KASAN: vmalloc-out-of-bounds Write in check_move_unevictable_pages
ci-upstream-linux-next-kasan-gce-root 2022/06/07 16:23 linux-next 73d0e32571a0 c8857892 .config log report syz C KASAN: vmalloc-out-of-bounds Write in check_move_unevictable_pages
ci-upstream-linux-next-kasan-gce-root 2022/06/07 14:21 linux-next 73d0e32571a0 c8857892 .config log report info KASAN: stack-out-of-bounds Write in check_move_unevictable_pages
ci-upstream-linux-next-kasan-gce-root 2022/06/07 14:16 linux-next 73d0e32571a0 c8857892 .config log report info KASAN: stack-out-of-bounds Write in check_move_unevictable_pages
ci-upstream-linux-next-kasan-gce-root 2022/06/07 14:05 linux-next 73d0e32571a0 c8857892 .config log report info KASAN: stack-out-of-bounds Write in check_move_unevictable_pages
ci-upstream-linux-next-kasan-gce-root 2022/06/07 14:03 linux-next 73d0e32571a0 c8857892 .config log report info KASAN: stack-out-of-bounds Write in check_move_unevictable_pages
ci-upstream-linux-next-kasan-gce-root 2022/06/07 12:40 linux-next 73d0e32571a0 c8857892 .config log report info KASAN: stack-out-of-bounds Write in check_move_unevictable_pages
ci-upstream-linux-next-kasan-gce-root 2022/06/07 11:10 linux-next 73d0e32571a0 c8857892 .config log report info KASAN: stack-out-of-bounds Write in check_move_unevictable_pages
* Struck through repros no longer work on HEAD.