syzbot


KASAN: use-after-free Read in search_by_entry_key (2)

Status: upstream: reported C repro on 2022/06/12 10:38
Reported-by: syzbot+ffe24b1afbc4cb5ae8fb@syzkaller.appspotmail.com
First crash: 239d, last: 4d21h

Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: KASAN: use-after-free Read in search_by_entry_key (log)
Repro: C syz .config

Fix bisection: the fix commit could be any of (bisect log):
  1c27f1fc1549 iov_iter: fix build issue due to possible type mis-match
  3cc40a443a04 Merge tag 'nios2_fixes_v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux
similar bugs (6):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in search_by_entry_key (2) reiserfs C error 6 42d 661d 0/1 upstream: reported C repro on 2021/04/16 06:17
linux-4.14 KASAN: use-after-free Read in search_by_entry_key C done 3 761d 867d 1/1 fixed on 2021/02/21 17:18
linux-4.19 KASAN: use-after-free Read in search_by_entry_key (3) reiserfs C error 8 41d 234d 0/1 upstream: reported C repro on 2022/06/17 02:59
linux-4.19 KASAN: use-after-free Read in search_by_entry_key C done 1 763d 853d 1/1 fixed on 2021/02/20 09:47
upstream KASAN: use-after-free Read in search_by_entry_key C done 3 847d 851d 21/24 fixed on 2021/03/10 01:49
linux-4.19 KASAN: use-after-free Read in search_by_entry_key (2) C done 2 544d 694d 1/1 fixed on 2021/09/10 21:17
Last patch testing requests:
Created Duration User Patch Repo Result
2022/08/17 07:37 15m yin31149@gmail.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1c27f1fc1549f0e470429f5497a76ad28a37f21a report 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 bin_search_in_dir_item fs/reiserfs/namei.c:40 [inline]
BUG: KASAN: use-after-free in search_by_entry_key+0x823/0x960 fs/reiserfs/namei.c:165
Read of size 4 at addr ffff88807258b004 by task syz-executor182/5062

CPU: 1 PID: 5062 Comm: syz-executor182 Not tainted 6.2.0-rc5-syzkaller-00020-g7bf70dbb1882 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:306 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:417
 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517
 bin_search_in_dir_item fs/reiserfs/namei.c:40 [inline]
 search_by_entry_key+0x823/0x960 fs/reiserfs/namei.c:165
 reiserfs_find_entry.part.0+0x139/0xdf0 fs/reiserfs/namei.c:322
 reiserfs_find_entry fs/reiserfs/namei.c:368 [inline]
 reiserfs_lookup+0x24e/0x490 fs/reiserfs/namei.c:368
 __lookup_slow+0x24c/0x460 fs/namei.c:1685
 lookup_one_len+0x16e/0x1a0 fs/namei.c:2711
 reiserfs_lookup_privroot+0x96/0x290 fs/reiserfs/xattr.c:973
 reiserfs_fill_super+0x20e9/0x2e90 fs/reiserfs/super.c:2174
 mount_bdev+0x351/0x410 fs/super.c:1359
 legacy_get_tree+0x109/0x220 fs/fs_context.c:610
 vfs_get_tree+0x8d/0x2f0 fs/super.c:1489
 do_new_mount fs/namespace.c:3145 [inline]
 path_mount+0x132a/0x1e20 fs/namespace.c:3475
 do_mount fs/namespace.c:3488 [inline]
 __do_sys_mount fs/namespace.c:3697 [inline]
 __se_sys_mount fs/namespace.c:3674 [inline]
 __x64_sys_mount+0x283/0x300 fs/namespace.c:3674
 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:0x7f8f7dec793a
Code: 48 c7 c2 c0 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 a8 00 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:00007ffd120c6778 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f8f7dec793a
RDX: 0000000020000000 RSI: 0000000020000040 RDI: 00007ffd120c6790
RBP: 00007ffd120c6790 R08: 00007ffd120c67d0 R09: 0000000000000000
R10: 0000000000208000 R11: 0000000000000286 R12: 0000000000000004
R13: 00005555567522c0 R14: 0000000000208000 R15: 00007ffd120c67d0
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001c962c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x7258b
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001c96308 ffff8880b99421e0 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 8796240948, free_ts 9322777396
 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:9363
 __alloc_contig_pages mm/page_alloc.c:9386 [inline]
 alloc_contig_pages+0x35e/0x4c0 mm/page_alloc.c:9463
 debug_vm_pgtable_alloc_huge_page mm/debug_vm_pgtable.c:1065 [inline]
 init_args mm/debug_vm_pgtable.c:1188 [inline]
 debug_vm_pgtable+0x899/0x296f mm/debug_vm_pgtable.c:1226
 do_one_initcall+0x141/0x790 init/main.c:1306
 do_initcall_level init/main.c:1379 [inline]
 do_initcalls init/main.c:1395 [inline]
 do_basic_setup init/main.c:1414 [inline]
 kernel_init_freeable+0x6f9/0x782 init/main.c:1634
 kernel_init+0x1e/0x1d0 init/main.c:1522
 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:1446 [inline]
 free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1496
 free_unref_page_prepare mm/page_alloc.c:3369 [inline]
 free_unref_page+0x1d/0x490 mm/page_alloc.c:3464
 free_contig_range+0xb5/0x180 mm/page_alloc.c:9485
 destroy_args+0xa8/0x64c mm/debug_vm_pgtable.c:998
 debug_vm_pgtable+0x28de/0x296f mm/debug_vm_pgtable.c:1318
 do_one_initcall+0x141/0x790 init/main.c:1306
 do_initcall_level init/main.c:1379 [inline]
 do_initcalls init/main.c:1395 [inline]
 do_basic_setup init/main.c:1414 [inline]
 kernel_init_freeable+0x6f9/0x782 init/main.c:1634
 kernel_init+0x1e/0x1d0 init/main.c:1522
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Memory state around the buggy address:
 ffff88807258af00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88807258af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88807258b000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff88807258b080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88807258b100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (25):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2023/01/24 17:33 upstream 7bf70dbb1882 9dfcf09c .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in search_by_entry_key
ci-upstream-kasan-gce-root 2022/11/07 05:30 upstream 089d1c31224e 6d752409 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in search_by_entry_key
ci-upstream-kasan-gce-root 2022/10/25 19:58 upstream a970174d7a10 45645420 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/10/15 06:57 upstream 493ffd6605b2 67cb024c .config console log report syz C [disk image] [vmlinux] [mounted in repro] KASAN: use-after-free Read in search_by_entry_key
ci-upstream-kasan-gce-smack-root 2022/09/21 02:45 upstream 60891ec99e14 c4b8ccfd .config strace log report syz C [disk image] [vmlinux] KASAN: use-after-free Read in search_by_entry_key
ci-upstream-kasan-gce-root 2022/06/12 07:40 upstream 1c27f1fc1549 0d5abf15 .config console log report syz C KASAN: use-after-free Read in search_by_entry_key
ci-upstream-linux-next-kasan-gce-root 2022/09/04 18:35 linux-next e47eb90a0a9a 28811d0a .config strace log report syz C KASAN: use-after-free Read in search_by_entry_key
ci-upstream-kasan-gce-root 2023/02/01 22:43 upstream c0b67534c95c 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2023/02/01 16:15 upstream c0b67534c95c 9a6f477c .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2023/01/27 11:46 upstream 7c46948a6e9c 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci-upstream-kasan-gce-selinux-root 2023/01/16 08:53 upstream 5dc4c995db9e a63719e7 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2023/01/10 17:28 upstream 5a41237ad1d4 48bc529a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2023/01/08 19:32 upstream 9b43a525db12 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2023/01/05 14:21 upstream 512dee0c00ad 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/12/21 03:37 upstream 6feb57c2fd7c d3e76707 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/12/14 07:24 upstream 02bf43c7b7f7 f6511626 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/11/21 21:17 upstream eb7081409f94 1c576c23 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/11/20 12:26 upstream fe24a97cf254 5bb70014 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/10/16 16:25 upstream 493ffd6605b2 67cb024c .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/10/08 16:15 upstream 62e6e5940c0c aea5da89 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/10/06 23:53 upstream 833477fce7a1 80b58a42 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/10/02 19:42 upstream b357fd1c2afc feb56351 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in search_by_entry_key
ci2-upstream-fs 2022/10/02 09:16 upstream b357fd1c2afc feb56351 .config console log report info [disk image] [vmlinux] KASAN: use-after-free Read in search_by_entry_key
ci-upstream-kasan-gce-root 2022/06/12 07:02 upstream 1c27f1fc1549 0d5abf15 .config console log report info KASAN: use-after-free Read in search_by_entry_key
ci-upstream-linux-next-kasan-gce-root 2022/12/28 17:35 linux-next c76083fac3ba 44712fbc .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in search_by_entry_key
* Struck through repros no longer work on HEAD.