syzbot


KASAN: use-after-free Read in __ext4_check_dir_entry (3)

Status: auto-obsoleted due to no activity on 2025/06/16 07:57
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+09921540dd04aba82a35@syzkaller.appspotmail.com
First crash: 266d, last: 109d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: KASAN: use-after-free Read in __ext4_check_dir_entry (log)
Repro: C syz .config
  
Fix bisection: fixed by (bisect log) :
commit 26343ca0df715097065b02a6cddb4a029d5b9327
Author: Baokun Li <libaokun1@huawei.com>
Date: Wed Jan 22 11:05:27 2025 +0000

  ext4: reject the 'data_err=abort' option in nojournal mode

  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ext4?] KASAN: use-after-free Read in __ext4_check_dir_entry (3) 0 (2) 2025/04/12 14:12
Similar bugs (11)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in __ext4_check_dir_entry (2) C 5 18d 157d 0/2 upstream: reported C repro on 2025/01/19 16:52
linux-4.14 KASAN: use-after-free Read in __ext4_check_dir_entry C inconclusive 6 1736d 1839d 0/1 upstream: reported C repro on 2020/06/12 02:23
upstream KASAN: use-after-free Read in __ext4_check_dir_entry (2) ext4 C error 1 397d 407d 0/29 closed as dup on 2024/06/26 08:39
android-5-15 KASAN: use-after-free Read in __ext4_check_dir_entry (2) origin:lts C 3 6d14h 77d 0/2 upstream: reported C repro on 2025/04/09 15:24
linux-5.15 KASAN: use-after-free Read in __ext4_check_dir_entry origin:upstream C error 10 24d 388d 0/3 upstream: reported C repro on 2024/06/03 01:15
android-5-15 KASAN: use-after-free Read in __ext4_check_dir_entry missing-backport origin:upstream C error 4 238d 362d 0/2 auto-obsoleted due to no activity on 2025/02/07 07:57
upstream KASAN: use-after-free Read in __ext4_check_dir_entry ext4 C 8 2640d 2643d 22/29 closed as dup on 2018/03/31 22:38
android-5-10 KASAN: use-after-free Read in __ext4_check_dir_entry C error 2 293d 411d 0/2 auto-obsoleted due to no activity on 2024/12/26 18:56
android-6-1 KASAN: use-after-free Read in __ext4_check_dir_entry missing-backport origin:upstream C error 4 286d 410d 0/2 auto-obsoleted due to no activity on 2024/12/21 14:06
linux-6.1 KASAN: use-after-free Read in __ext4_check_dir_entry 15 351d 388d 0/3 auto-obsoleted due to no activity on 2024/09/17 20:54
android-6-1 KASAN: use-after-free Read in __ext4_check_dir_entry (2) origin:lts C 3 14d 81d 0/2 upstream: reported C repro on 2025/04/05 13:22
Last patch testing requests (10)
Created Duration User Patch Repo Result
2025/06/11 00:21 22m retest repro upstream OK log
2025/06/11 00:21 41m retest repro upstream OK log
2025/05/22 15:11 20m retest repro upstream OK log
2025/04/27 07:27 19m retest repro upstream OK log
2025/03/31 14:35 15m retest repro upstream report log
2025/03/31 14:35 16m retest repro upstream report log
2025/03/08 07:42 14m retest repro upstream report log
2025/02/16 06:18 19m retest repro upstream report log
2025/02/02 05:35 12m retest repro upstream report log
2025/01/19 03:55 12m retest repro upstream report log
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2025/04/12 07:08 7h02m bisect fix upstream OK (1) job log
2024/11/19 08:27 2h02m bisect fix upstream OK (0) job log log

Sample crash report:
EXT4-fs warning (device loop1): dx_probe:833: inode #2: comm syz.1.21: Unrecognised inode hash code 4
EXT4-fs warning (device loop1): dx_probe:966: inode #2: comm syz.1.21: Corrupt directory, running e2fsck is recommended
==================================================================
BUG: KASAN: use-after-free in __ext4_check_dir_entry+0x6fd/0x880 fs/ext4/dir.c:85
Read of size 2 at addr ffff8880320de003 by task syz.1.21/6041

CPU: 0 UID: 0 PID: 6041 Comm: syz.1.21 Not tainted 6.13.0-rc5-syzkaller-00161-g63676eefb7a0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:489
 kasan_report+0x143/0x180 mm/kasan/report.c:602
 __ext4_check_dir_entry+0x6fd/0x880 fs/ext4/dir.c:85
 ext4_readdir+0x1436/0x3a60 fs/ext4/dir.c:259
 iterate_dir+0x571/0x800 fs/readdir.c:108
 __do_sys_getdents64 fs/readdir.c:403 [inline]
 __se_sys_getdents64+0x1e2/0x4b0 fs/readdir.c:389
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f81cef85d29
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd0fdd5d08 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 00007f81cf175fa0 RCX: 00007f81cef85d29
RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000000006
RBP: 00007f81cf001b08 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f81cf175fa0 R14: 00007f81cf175fa0 R15: 0000000000000175
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x320de
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f0(buddy)
raw: 00fff00000000000 ffffea0000c86108 ffffea0000c78688 0000000000000000
raw: 0000000000000000 0000000000000001 00000000f0000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0xcc0(GFP_KERNEL), pid 2949, tgid 2949 (kworker/u8:7), ts 23682765784, free_ts 86494647811
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1558
 prep_new_page mm/page_alloc.c:1566 [inline]
 get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3476
 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4753
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2269
 get_free_pages_noprof+0xc/0x30 mm/page_alloc.c:4800
 kasan_populate_vmalloc_pte+0x38/0xe0 mm/kasan/shadow.c:304
 apply_to_pte_range mm/memory.c:2831 [inline]
 apply_to_pmd_range mm/memory.c:2875 [inline]
 apply_to_pud_range mm/memory.c:2911 [inline]
 apply_to_p4d_range mm/memory.c:2947 [inline]
 __apply_to_page_range+0x806/0xde0 mm/memory.c:2981
 alloc_vmap_area+0x1d4e/0x2400 mm/vmalloc.c:2035
 __get_vm_area_node+0x1c8/0x2d0 mm/vmalloc.c:3137
 __vmalloc_node_range_noprof+0x344/0x1380 mm/vmalloc.c:3806
 alloc_thread_stack_node kernel/fork.c:314 [inline]
 dup_task_struct+0x444/0x8c0 kernel/fork.c:1116
 copy_process+0x5d1/0x3d50 kernel/fork.c:2224
 kernel_clone+0x223/0x870 kernel/fork.c:2806
 user_mode_thread+0x132/0x1a0 kernel/fork.c:2884
 call_usermodehelper_exec_work+0x5c/0x230 kernel/umh.c:171
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310
page last free pid 25 tgid 25 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1127 [inline]
 free_unref_page+0xd2c/0x1000 mm/page_alloc.c:2659
 kasan_depopulate_vmalloc_pte+0x74/0x90 mm/kasan/shadow.c:408
 apply_to_pte_range mm/memory.c:2831 [inline]
 apply_to_pmd_range mm/memory.c:2875 [inline]
 apply_to_pud_range mm/memory.c:2911 [inline]
 apply_to_p4d_range mm/memory.c:2947 [inline]
 __apply_to_page_range+0x806/0xde0 mm/memory.c:2981
 kasan_release_vmalloc+0xa5/0xd0 mm/kasan/shadow.c:529
 kasan_release_vmalloc_node mm/vmalloc.c:2196 [inline]
 purge_vmap_node+0x22f/0x8d0 mm/vmalloc.c:2213
 __purge_vmap_area_lazy+0x708/0xae0 mm/vmalloc.c:2304
 drain_vmap_area_work+0x27/0x40 mm/vmalloc.c:2338
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310
 worker_thread+0x870/0xd30 kernel/workqueue.c:3391
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Memory state around the buggy address:
 ffff8880320ddf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880320ddf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880320de000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff8880320de080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880320de100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/04 13:24 upstream 63676eefb7a0 f3558dbf .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in __ext4_check_dir_entry
2024/10/02 19:37 upstream e32cde8d2bd7 02f9582a .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in __ext4_check_dir_entry
2024/10/02 18:25 upstream e32cde8d2bd7 02f9582a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: use-after-free Read in __ext4_check_dir_entry
2024/10/02 17:08 upstream e32cde8d2bd7 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in __ext4_check_dir_entry
2025/01/04 21:58 upstream ab75170520d4 f3558dbf .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: slab-use-after-free Read in __ext4_check_dir_entry
2024/11/23 07:47 upstream 06afb0f36106 68da6d95 .config console log report syz / log [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root KASAN: slab-use-after-free Read in __ext4_check_dir_entry
* Struck through repros no longer work on HEAD.