syzbot


BUG: unable to handle kernel paging request in reiserfs_readdir_inode

Status: upstream: reported C repro on 2023/01/05 19:12
Subsystems: reiserfs (incorrect?)
Reported-by: syzbot+3f6ef04b7cf85153b528@syzkaller.appspotmail.com
First crash: 76d, last: 3d16h

Cause bisection: failed (error log, bisect log)

Sample crash report:
REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
==================================================================
BUG: KASAN: out-of-bounds in instrument_atomic_read include/linux/instrumented.h:72 [inline]
BUG: KASAN: out-of-bounds in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
BUG: KASAN: out-of-bounds in test_bit_le include/asm-generic/bitops/le.h:21 [inline]
BUG: KASAN: out-of-bounds in reiserfs_readdir_inode+0x5dc/0x14c0 fs/reiserfs/dir.c:147
Read of size 8 at addr ffff888073bf2000 by task syz-executor189/5068

CPU: 0 PID: 5068 Comm: syz-executor189 Not tainted 6.3.0-rc2-syzkaller-00387-g534293368afa #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:319 [inline]
 print_report+0x163/0x540 mm/kasan/report.c:430
 kasan_report+0x176/0x1b0 mm/kasan/report.c:536
 kasan_check_range+0x283/0x290 mm/kasan/generic.c:187
 instrument_atomic_read include/linux/instrumented.h:72 [inline]
 _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
 test_bit_le include/asm-generic/bitops/le.h:21 [inline]
 reiserfs_readdir_inode+0x5dc/0x14c0 fs/reiserfs/dir.c:147
 iterate_dir+0x228/0x570
 __do_sys_getdents64 fs/readdir.c:369 [inline]
 __se_sys_getdents64+0x20d/0x4f0 fs/readdir.c:354
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fc3e23c8c39
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 31 18 00 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffec2d689a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fc3e23c8c39
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 0000000000000003 R08: 00007ffec2d689f0 R09: 00007ffec2d689f0
R10: 0000000000001131 R11: 0000000000000246 R12: 00007ffec2d68a10
R13: 00007ffec2d689e8 R14: 00007ffec2d68a30 R15: 0000000000000003
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001cefc80 refcount:1 mapcount:1 mapping:0000000000000000 index:0x560db210a pfn:0x73bf2
memcg:ffff888016786000
anon flags: 0xfff000000a0014(uptodate|lru|mappedtodisk|swapbacked|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff000000a0014 ffffea0001f135c8 ffffea0001cefcc8 ffff888023a13771
raw: 0000000560db210a 0000000000000000 0000000100000000 ffff888016786000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 4433, tgid 4433 (udevd), ts 62194464908, free_ts 18357036743
 prep_new_page mm/page_alloc.c:2552 [inline]
 get_page_from_freelist+0x3246/0x33c0 mm/page_alloc.c:4325
 __alloc_pages+0x255/0x670 mm/page_alloc.c:5591
 __folio_alloc+0x13/0x30 mm/page_alloc.c:5623
 vma_alloc_folio+0x48a/0x9a0 mm/mempolicy.c:2244
 wp_page_copy mm/memory.c:3068 [inline]
 do_wp_page+0xb3b/0x3620 mm/memory.c:3426
 handle_pte_fault mm/memory.c:4927 [inline]
 __handle_mm_fault mm/memory.c:5051 [inline]
 handle_mm_fault+0x23a0/0x51c0 mm/memory.c:5197
 do_user_addr_fault arch/x86/mm/fault.c:1407 [inline]
 handle_page_fault arch/x86/mm/fault.c:1498 [inline]
 exc_page_fault+0x5b1/0x7c0 arch/x86/mm/fault.c:1554
 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1453 [inline]
 free_pcp_prepare mm/page_alloc.c:1503 [inline]
 free_unref_page_prepare+0xe2f/0xe70 mm/page_alloc.c:3387
 free_unref_page+0x37/0x3f0 mm/page_alloc.c:3482
 free_contig_range+0x9e/0x150 mm/page_alloc.c:9531
 destroy_args+0x102/0x9a0 mm/debug_vm_pgtable.c:1023
 debug_vm_pgtable+0x405/0x490 mm/debug_vm_pgtable.c:1403
 do_one_initcall+0x23d/0x7d0 init/main.c:1306
 do_initcall_level+0x157/0x210 init/main.c:1379
 do_initcalls+0x3f/0x80 init/main.c:1395
 kernel_init_freeable+0x477/0x630 init/main.c:1634
 kernel_init+0x1d/0x2a0 init/main.c:1522
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Memory state around the buggy address:
 ffff888073bf1f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888073bf1f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888073bf2000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                      ^
 ffff888073bf2080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888073bf2100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (5):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci2-upstream-fs 2023/03/19 00:33 upstream 534293368afa 7939252e .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: out-of-bounds Read in reiserfs_readdir_inode
ci-upstream-linux-next-kasan-gce-root 2023/03/18 20:21 linux-next 6f08c1de13a9 7939252e .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in reiserfs_readdir_inode
ci-upstream-gce-arm64 2023/01/05 19:12 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 247f34f7b803 1dac8c7a .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] BUG: unable to handle kernel paging request in reiserfs_readdir_inode
ci-upstream-gce-arm64 2023/01/05 16:37 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 247f34f7b803 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] BUG: unable to handle kernel paging request in reiserfs_readdir_inode
ci-upstream-linux-next-kasan-gce-root 2023/03/18 19:48 linux-next 6f08c1de13a9 7939252e .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in reiserfs_readdir_inode
* Struck through repros no longer work on HEAD.