syzbot


KASAN: use-after-free Read in set_de_name_and_namelen

Status: upstream: reported C repro on 2022/11/25 09:46
Labels: reiserfs (incorrect?)
Reported-by: syzbot+3969ffae9388a369bab8@syzkaller.appspotmail.com
First crash: 187d, last: 17d

Cause bisection: failed (error log, bisect log)
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] KASAN: use-after-free Read in set_de_name_and_namelen 0 (1) 2022/11/25 09:46
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2023/05/07 08:35 25m bisect fix upstream job log (0) log
2023/04/07 07:10 47m bisect fix upstream job log (0) log
2023/03/08 06:28 42m bisect fix upstream job log (0) log
2023/02/06 05:46 41m bisect fix upstream job log (0) 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: use-after-free in strlen+0x7d/0xa0 lib/string.c:418
Read of size 1 at addr ffff88807183c0c4 by task syz-executor266/4998

CPU: 0 PID: 4998 Comm: syz-executor266 Not tainted 6.4.0-rc1-syzkaller-00177-gbb7c241fae62 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
 print_report mm/kasan/report.c:462 [inline]
 kasan_report+0x11c/0x130 mm/kasan/report.c:572
 strlen+0x7d/0xa0 lib/string.c:418
 __fortify_strlen include/linux/fortify-string.h:241 [inline]
 set_de_name_and_namelen+0x4c4/0x6a0 fs/reiserfs/namei.c:82
 linear_search_in_dir_item fs/reiserfs/namei.c:262 [inline]
 reiserfs_find_entry.part.0+0x3db/0xdf0 fs/reiserfs/namei.c:331
 reiserfs_find_entry fs/reiserfs/namei.c:368 [inline]
 reiserfs_lookup+0x24e/0x610 fs/reiserfs/namei.c:368
 __lookup_slow+0x24c/0x460 fs/namei.c:1690
 lookup_one_len+0x16e/0x1a0 fs/namei.c:2742
 reiserfs_lookup_privroot+0x96/0x210 fs/reiserfs/xattr.c:976
 reiserfs_fill_super+0x1a8d/0x2eb0 fs/reiserfs/super.c:2192
 mount_bdev+0x357/0x420 fs/super.c:1380
 legacy_get_tree+0x109/0x220 fs/fs_context.c:610
 vfs_get_tree+0x8d/0x350 fs/super.c:1510
 do_new_mount fs/namespace.c:3039 [inline]
 path_mount+0x134b/0x1e40 fs/namespace.c:3369
 do_mount fs/namespace.c:3382 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount fs/namespace.c:3568 [inline]
 __x64_sys_mount+0x283/0x300 fs/namespace.c:3568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f8bfe77c25a
Code: 48 c7 c2 c0 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 98 03 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007ffca86059d8 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f8bfe77c25a
RDX: 00000000200000c0 RSI: 0000000020000040 RDI: 00007ffca86059e0
RBP: 00007ffca86059e0 R08: 00007ffca8605a20 R09: 0000000000000000
R10: 0000000000008001 R11: 0000000000000286 R12: 0000000000000004
R13: 000055555651e2c0 R14: 00007ffca8605a20 R15: 0000000000000000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001c60f00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x7183c
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 ffffea0001c60f48 ffff8880b9843660 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 0x8(__GFP_MOVABLE), pid 1, tgid 1 (swapper/0), ts 11119347758, free_ts 11881422708
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
 split_map_pages+0x1ef/0x520 mm/compaction.c:97
 isolate_freepages_range+0x313/0x350 mm/compaction.c:735
 alloc_contig_range+0x2fa/0x4a0 mm/page_alloc.c:6869
 __alloc_contig_pages mm/page_alloc.c:6892 [inline]
 alloc_contig_pages+0x361/0x4d0 mm/page_alloc.c:6972
 debug_vm_pgtable_alloc_huge_page mm/debug_vm_pgtable.c:1090 [inline]
 init_args mm/debug_vm_pgtable.c:1273 [inline]
 debug_vm_pgtable+0x91f/0x4210 mm/debug_vm_pgtable.c:1311
 do_one_initcall+0x102/0x540 init/main.c:1246
 do_initcall_level init/main.c:1319 [inline]
 do_initcalls init/main.c:1335 [inline]
 do_basic_setup init/main.c:1354 [inline]
 kernel_init_freeable+0x64e/0xba0 init/main.c:1571
 kernel_init+0x1e/0x2c0 init/main.c:1462
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1302 [inline]
 free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2564
 free_unref_page+0x33/0x370 mm/page_alloc.c:2659
 free_contig_range+0xb5/0x180 mm/page_alloc.c:6994
 destroy_args+0x6c4/0x920 mm/debug_vm_pgtable.c:1023
 debug_vm_pgtable+0x2412/0x4210 mm/debug_vm_pgtable.c:1403
 do_one_initcall+0x102/0x540 init/main.c:1246
 do_initcall_level init/main.c:1319 [inline]
 do_initcalls init/main.c:1335 [inline]
 do_basic_setup init/main.c:1354 [inline]
 kernel_init_freeable+0x64e/0xba0 init/main.c:1571
 kernel_init+0x1e/0x2c0 init/main.c:1462
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Memory state around the buggy address:
 ffff88807183bf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88807183c000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88807183c080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                           ^
 ffff88807183c100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88807183c180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Manager Title
2023/05/14 17:17 upstream bb7c241fae62 2b9ba477 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: use-after-free Read in set_de_name_and_namelen
2022/12/10 04:51 upstream 0d1409e4ff08 67be1ae7 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-kasan-gce-root KASAN: use-after-free Read in set_de_name_and_namelen
2022/11/25 04:30 upstream c3eb11fbb826 74a66371 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in set_de_name_and_namelen
2023/01/07 05:41 linux-next cc3c08b41a9c 1dac8c7a .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci-upstream-linux-next-kasan-gce-root KASAN: use-after-free Read in set_de_name_and_namelen
2022/11/25 04:08 upstream c3eb11fbb826 74a66371 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in set_de_name_and_namelen
* Struck through repros no longer work on HEAD.