syzbot


KASAN: use-after-free Read in reiserfs_find_entry

Status: upstream: reported C repro on 2023/06/03 22:29
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+c78666ac17322c2ddc5c@syzkaller.appspotmail.com
First crash: 329d, last: 30d
Bug presence (1)
Date Name Commit Repro Result
2023/09/27 upstream (ToT) 0e945134b680 C [report] KASAN: use-after-free Read in reiserfs_find_entry
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in reiserfs_find_entry origin:upstream C error 4 211d 368d 0/3 upstream: reported C repro on 2023/04/26 06:52
linux-4.14 KASAN: use-after-free Read in reiserfs_find_entry reiserfs C 1 437d 437d 0/1 upstream: reported C repro on 2023/02/16 03:16
upstream BUG: unable to handle kernel NULL pointer dereference in reiserfs_find_entry reiserfs C error done 25 121d 558d 26/26 fixed on 2024/02/02 11:15
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2024/03/11 00:51 1h14m bisect fix linux-6.1.y job log (0) log
2024/02/01 14:00 1h30m bisect fix linux-6.1.y job log (0) log
2023/12/29 23:59 1h48m bisect fix linux-6.1.y job log (0) log
2023/11/29 08:26 1h48m bisect fix linux-6.1.y job log (0) log
2023/10/29 12:34 1h29m bisect fix linux-6.1.y job log (0) log
2023/09/27 05:05 1h19m bisect fix linux-6.1.y job log (0) log
2023/07/07 20:12 2h21m bisect fix linux-6.1.y job log (0) log

Sample crash report:
REISERFS warning:  read_super_block: reiserfs filesystem is deprecated and scheduled to be removed from the kernel in 2025
REISERFS (device loop0): found reiserfs format "3.5" with non-standard journal
REISERFS (device loop0): using ordered data mode
reiserfs: using flush barriers
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: use-after-free in strlen+0x54/0x60 lib/string.c:495
Read of size 1 at addr ffff888072c857a3 by task syz-executor450/3540

CPU: 0 PID: 3540 Comm: syz-executor450 Not tainted 6.1.39-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 strlen+0x54/0x60 lib/string.c:495
 set_de_name_and_namelen fs/reiserfs/namei.c:82 [inline]
 linear_search_in_dir_item fs/reiserfs/namei.c:262 [inline]
 reiserfs_find_entry+0x97e/0x19b0 fs/reiserfs/namei.c:331
 reiserfs_lookup+0x1e6/0x4b0 fs/reiserfs/namei.c:368
 __lookup_slow+0x27e/0x3d0 fs/namei.c:1685
 lookup_one_len+0x187/0x2d0 fs/namei.c:2711
 reiserfs_lookup_privroot+0x85/0x1e0 fs/reiserfs/xattr.c:973
 reiserfs_fill_super+0x1957/0x2620 fs/reiserfs/super.c:2192
 mount_bdev+0x2c9/0x3f0 fs/super.c:1423
 legacy_get_tree+0xeb/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1553
 do_new_mount+0x28b/0xae0 fs/namespace.c:3040
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fee22b65daa
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffeaf2a66b8 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffeaf2a66c0 RCX: 00007fee22b65daa
RDX: 00000000200000c0 RSI: 0000000020000040 RDI: 00007ffeaf2a66c0
RBP: 0000000000000004 R08: 00007ffeaf2a6700 R09: 000000000000111c
R10: 0000000000008001 R11: 0000000000000286 R12: 00007ffeaf2a6700
R13: 0000000000000003 R14: 0000000000400000 R15: 00007fee22bad03b
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001cb2140 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x72c85
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001cb2188 ffff8880b98405e0 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 3539, tgid 3539 (sshd), ts 52830659224, free_ts 52831671242
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533
 prep_new_page mm/page_alloc.c:2540 [inline]
 get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
 __folio_alloc+0xf/0x30 mm/page_alloc.c:5591
 vma_alloc_folio+0x486/0x990 mm/mempolicy.c:2241
 alloc_page_vma include/linux/gfp.h:284 [inline]
 wp_page_copy+0x292/0x17d0 mm/memory.c:3124
 handle_pte_fault mm/memory.c:5001 [inline]
 __handle_mm_fault mm/memory.c:5125 [inline]
 handle_mm_fault+0x2522/0x5330 mm/memory.c:5246
 do_user_addr_fault arch/x86/mm/fault.c:1380 [inline]
 handle_page_fault arch/x86/mm/fault.c:1471 [inline]
 exc_page_fault+0x26f/0x660 arch/x86/mm/fault.c:1527
 asm_exc_page_fault+0x22/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:1460 [inline]
 free_pcp_prepare mm/page_alloc.c:1510 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388
 free_unref_page_list+0x107/0x810 mm/page_alloc.c:3530
 release_pages+0x2836/0x2b40 mm/swap.c:1055
 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:254 [inline]
 tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261
 tlb_finish_mmu+0xce/0x1f0 mm/mmu_gather.c:361
 unmap_region+0x29f/0x2f0 mm/mmap.c:2319
 do_mas_align_munmap+0xe93/0x15c0 mm/mmap.c:2569
 do_mas_munmap+0x246/0x2b0 mm/mmap.c:2627
 __vm_munmap+0x268/0x370 mm/mmap.c:2904
 __do_sys_munmap mm/mmap.c:2929 [inline]
 __se_sys_munmap mm/mmap.c:2926 [inline]
 __x64_sys_munmap+0x5c/0x70 mm/mmap.c:2926
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff888072c85680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888072c85700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888072c85780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                               ^
 ffff888072c85800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888072c85880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/07/23 03:02 linux-6.1.y a456e1743881 27cbe77f .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: use-after-free Read in reiserfs_find_entry
2024/03/28 23:31 linux-6.1.y e5cd595e23c1 e91187ee .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in reiserfs_find_entry
2023/06/03 22:28 linux-6.1.y d2869ace6eeb a4ae4f42 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in reiserfs_find_entry
* Struck through repros no longer work on HEAD.