syzbot


KASAN: stack-out-of-bounds Read in collapse_file

Status: closed as invalid on 2022/12/01 18:40
Subsystems: mm
[Documentation on labels]
First crash: 1022d, last: 1009d
Cause bisection: introduced by (bisect log) :
commit a0157a2c735bd9c8ea8486b2f3631225a086fe9d
Author: Jiaqi Yan <jiaqiyan@google.com>
Date: Mon Nov 7 02:53:59 2022 +0000

  mm/khugepaged: recover from poisoned file-backed memory

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

Sample crash report:
==================================================================
BUG: KASAN: stack-out-of-bounds in collapse_file+0x4edf/0x5830 mm/khugepaged.c:2038
Read of size 8 at addr ffffc90003bbf908 by task syz-executor395/5243

CPU: 0 PID: 5243 Comm: syz-executor395 Not tainted 6.1.0-rc4-next-20221111-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:253 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:364
 kasan_report+0xbb/0x1f0 mm/kasan/report.c:464
 collapse_file+0x4edf/0x5830 mm/khugepaged.c:2038
 hpage_collapse_scan_file+0xdba/0x18e0 mm/khugepaged.c:2237
 madvise_collapse+0x521/0xb30 mm/khugepaged.c:2696
 madvise_vma_behavior+0x6f6/0x1db0 mm/madvise.c:1089
 madvise_walk_vmas+0x1c7/0x2b0 mm/madvise.c:1263
 do_madvise.part.0+0x24a/0x340 mm/madvise.c:1442
 do_madvise mm/madvise.c:1455 [inline]
 __do_sys_madvise mm/madvise.c:1455 [inline]
 __se_sys_madvise mm/madvise.c:1453 [inline]
 __x64_sys_madvise+0x113/0x150 mm/madvise.c:1453
 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+0x63/0xcd
RIP: 0033:0x7febb249cb29
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdc0d58878 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007febb249cb29
RDX: 0000000000000019 RSI: 0000000000600003 RDI: 0000000020000000
RBP: 00007febb2460cd0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007febb2460d60
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

The buggy address belongs to stack of task syz-executor395/5243
 and is located at offset 120 in frame:
 collapse_file+0x0/0x5830 arch/x86/include/asm/bitops.h:207

This frame has 4 objects:
 [32, 40) 'hpage'
 [64, 72) 'folio'
 [96, 112) 'pagelist'
 [128, 184) 'xas'

The buggy address belongs to the virtual mapping at
 [ffffc90003bb8000, ffffc90003bc1000) created by:
 kernel_clone+0xe7/0x980 kernel/fork.c:2681

The buggy address belongs to the physical page:
page:ffffea0000a69b00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x29a6c
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_ZERO), pid 5240, tgid 5240 (strace-static-x), ts 87999283973, free_ts 82222049820
 prep_new_page mm/page_alloc.c:2561 [inline]
 get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4310
 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5569
 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2285
 vm_area_alloc_pages mm/vmalloc.c:2989 [inline]
 __vmalloc_area_node mm/vmalloc.c:3057 [inline]
 __vmalloc_node_range+0x971/0x13b0 mm/vmalloc.c:3227
 alloc_thread_stack_node kernel/fork.c:311 [inline]
 dup_task_struct kernel/fork.c:987 [inline]
 copy_process+0x12d2/0x7520 kernel/fork.c:2097
 kernel_clone+0xe7/0x980 kernel/fork.c:2681
 __do_sys_clone+0xba/0x100 kernel/fork.c:2822
 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+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1468 [inline]
 free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1518
 free_unref_page_prepare mm/page_alloc.c:3409 [inline]
 free_unref_page+0x19/0x4d0 mm/page_alloc.c:3505
 __folio_put_small mm/swap.c:106 [inline]
 __folio_put+0xc1/0x130 mm/swap.c:129
 folio_put include/linux/mm.h:1180 [inline]
 put_page include/linux/mm.h:1243 [inline]
 anon_pipe_buf_release+0x369/0x430 fs/pipe.c:138
 pipe_buf_release include/linux/pipe_fs_i.h:183 [inline]
 pipe_read+0x610/0x1100 fs/pipe.c:324
 call_read_iter include/linux/fs.h:2153 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x7f6/0x930 fs/read_write.c:470
 ksys_read+0x1e8/0x250 fs/read_write.c:613
 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+0x63/0xcd

Memory state around the buggy address:
 ffffc90003bbf800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90003bbf880: 00 00 f1 f1 f1 f1 00 f2 f2 f2 00 f2 f2 f2 00 00
>ffffc90003bbf900: f2 f2 00 00 00 00 00 00 00 f3 f3 f3 f3 f3 00 00
                      ^
 ffffc90003bbf980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90003bbfa00: 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00
==================================================================

Crashes (29):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/11/11 15:42 linux-next f8f60f322f06 3ead01ad .config strace log report syz C ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/24 00:13 linux-next 15f3bff12cf6 12c66417 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/23 22:16 linux-next 15f3bff12cf6 12c66417 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/19 22:46 linux-next 15f3bff12cf6 5bb70014 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/18 22:37 linux-next 15f3bff12cf6 5bb70014 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/18 05:20 linux-next 15f3bff12cf6 4ba8ab94 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/18 03:56 linux-next 15f3bff12cf6 4ba8ab94 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/17 22:10 linux-next 15f3bff12cf6 4ba8ab94 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/17 14:41 linux-next 15f3bff12cf6 3a127a31 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/16 19:21 linux-next 15f3bff12cf6 3a127a31 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/16 05:16 linux-next 3c1f24109dfc 3a127a31 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/16 02:52 linux-next 3c1f24109dfc 3a127a31 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/15 04:41 linux-next 5c92ddca1053 943f4cb8 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/15 01:30 linux-next 5c92ddca1053 943f4cb8 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/14 12:46 linux-next 5c92ddca1053 943f4cb8 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/14 12:22 linux-next 5c92ddca1053 943f4cb8 .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/12 10:37 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/12 08:36 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 23:09 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 22:26 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 21:52 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 19:30 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 11:49 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 11:05 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 10:50 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 09:30 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 09:17 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 07:33 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
2022/11/11 06:59 linux-next f8f60f322f06 3ead01ad .config console log report info ci-upstream-linux-next-kasan-gce-root KASAN: stack-out-of-bounds Read in collapse_file
* Struck through repros no longer work on HEAD.