syzbot


KASAN: use-after-free Read in ext4_inlinedir_to_tree

Status: upstream: reported C repro on 2024/08/28 22:55
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+46b0888255f68622d309@syzkaller.appspotmail.com
First crash: 635d, last: 138d
Cause bisection: introduced by (bisect log) :
commit e5598d6ae62626d261b046a2f19347c38681ff51
Author: Pavel Begunkov <asml.silence@gmail.com>
Date: Thu Aug 24 22:53:31 2023 +0000

  io_uring: compact SQ/CQ heads/tails

Crash: KASAN: use-after-free Read in ext4_inlinedir_to_tree (log)
Repro: C syz .config
  
Fix bisection: failed (error log, bisect log)
  
✨ AI Jobs (1)
ID Workflow Result Correct Bug Created Started Finished Revision Error
a6923085-e3ce-484a-9597-14220b3c531f assessment-security 💥 KASAN: use-after-free Read in ext4_inlinedir_to_tree 2026/05/21 13:11 2026/05/21 13:11 2026/05/21 13:41 cf874a1cf36318c06202027159ddac14acf00db7 failed to run ["make" "KERNELVERSION=syzkaller" "KERNELRELEASE=syzkaller" "LOCALVERSION=-syzkaller" "-j" "32" "ARCH=x86_64" "CC=ccache clang" "LD=ld.lld" "O=/app/workdir/cache/build/659d42d823b112803ecd9b5886e1e9e524199e9b" "-s" "bzImage" "compile_commands.json"]: exit status 2 Root cause: ld.lld: error: undefined symbol: wcslen * * Restart config... * * * General architecture-dependent options * Kprobes (KPROBES) [N/y/?] n Optimize very unlikely/likely branches (JUMP_LABEL) [Y/n/?] y Static key selftest (STATIC_KEYS_SELFTEST) [N/y/?] n Static call selftest (STATIC_CALL_SELFTEST) [N/y/?] n Enable seccomp to safely execute untrusted bytecode (SECCOMP) [Y/n/?] y Show seccomp filter cache status in /proc/pid/seccomp_cache (SECCOMP_CACHE_DEBUG) [N/y/?] n Stack Protector buffer overflow detection (STACKPROTECTOR) [Y/n/?] y Strong Stack Protector (STACKPROTECTOR_STRONG) [Y/n/?] y Link Time Optimization (LTO) > 1. None (LTO_NONE) choice[1]: 1 Use Clang's Control Flow Integrity (CFI) (CFI_CLANG) [N/y/?] (NEW) Error in reading or end of file. Number of bits to use for ASLR of mmap base address (ARCH_MMAP_RND_BITS) [28] 28 Number of bits to use for ASLR of mmap base address for compatible applications (ARCH_MMAP_RND_COMPAT_BITS) [8] 8 MMU page size > 1. 4KiB pages (PAGE_SIZE_4KB) choice[1]: 1 Provide system calls for 32-bit time_t (COMPAT_32BIT_TIME) [Y/n/?] y Use a virtually-mapped stack (VMAP_STACK) [Y/n/?] y Support for randomizing kernel stack offset on syscall entry (RANDOMIZE_KSTACK_OFFSET) [Y/n/?] y Default state of kernel stack offset randomization (RANDOMIZE_KSTACK_OFFSET_DEFAULT) [N/y/?] n Locking event counts collection (LOCK_EVENT_COUNTS) [N/y/?] n * * Memory initialization * Initialize kernel stack variables at function entry 1. no automatic stack variable initialization (weakest) (INIT_STACK_NONE) 2. pattern-init everything (strongest) (INIT_STACK_ALL_PATTERN) > 3. zero-init everything (strongest and safest) (INIT_STACK_ALL_ZERO) choice[1-3?]: 3 Enable heap memory zeroing on allocation by default (INIT_ON_ALLOC_DEFAULT_ON) [Y/n/?] y Enable heap memory zeroing on free by default (INIT_ON_FREE_DEFAULT_ON) [N/y/?] n Enable register zeroing on function exit (ZERO_CALL_USED_REGS) [N/y/?] (NEW) Error in reading or end of file. * * Kernel hardening options * Randomize layout of sensitive kernel structures > 1. Disable structure layout randomization (RANDSTRUCT_NONE) 2. Fully randomize structure layout (RANDSTRUCT_FULL) (NEW) choice[1-2?]: Error in reading or end of file. * * Compile-time checks and compiler options * Debug information 1. Disable debug information (DEBUG_INFO_NONE) 2. Rely on the toolchain's implicit default DWARF version (DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT) > 3. Generate DWARF Version 4 debuginfo (DEBUG_INFO_DWARF4) 4. Generate DWARF Version 5 debuginfo (DEBUG_INFO_DWARF5) choice[1-4?]: 3 Reduce debugging information (DEBUG_INFO_REDUCED) [N/y/?] n Compressed Debug information > 1. Don't compress debug information (DEBUG_INFO_COMPRESSED_NONE) 2. Compress debugging information with zlib (DEBUG_INFO_COMPRESSED_ZLIB) 3. Compress debugging information with zstd (DEBUG_INFO_COMPRESSED_ZSTD) (NEW) choice[1-3?]: Error in reading or end of file. Produce split debuginfo in .dwo files (DEBUG_INFO_SPLIT) [N/y/?] n Generate BTF type information (DEBUG_INFO_BTF) [N/y/?] n Provide GDB scripts for kernel debugging (GDB_SCRIPTS) [N/y/?] n Warn for stack frames larger than (FRAME_WARN) [2048] 2048 Strip assembler-generated symbols during link (STRIP_ASM_SYMS) [N/y/?] n Install uapi headers to usr/include (HEADERS_INSTALL) [N/y/?] n Make section mismatch errors non-fatal (SECTION_MISMATCH_WARN_ONLY) [Y/n/?] y Force all function address 64B aligned (DEBUG_FORCE_FUNCTION_ALIGN_64B) [N/y/?] n Generate vmlinux.map file when linking (VMLINUX_MAP) [N/y/?] n Force weak per-cpu definitions (DEBUG_FORCE_WEAK_PER_CPU) [N/y/?] n In file included from /app/workdir/cache/src/6aadec69e9654ce254f8943571309b469fab0d8e/net/socket.c:108: In file included from /app/workdir/cache/src/6aadec69e9654ce254f8943571309b4
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ext4?] KASAN: use-after-free Read in ext4_inlinedir_to_tree 1 (2) 2024/08/29 10:39
Similar bugs (7)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in ext4_inlinedir_to_tree 19 C error 9 31d 767d 0/2 upstream: reported C repro on 2024/04/14 03:44
android-5-15 KASAN: use-after-free Read in ext4_inlinedir_to_tree origin:upstream 19 C error 7 1d05h 116d 0/2 upstream: reported C repro on 2026/01/25 06:15
android-54 KASAN: slab-out-of-bounds Read in ext4_inlinedir_to_tree 17 C 1 402d 767d 0/2 upstream: reported C repro on 2024/04/14 03:10
upstream KMSAN: uninit-value in number (4) kernel 7 C 7189 1275d 1653d 0/29 closed as invalid on 2022/11/28 10:01
android-6-1 KASAN: slab-out-of-bounds Read in ext4_inlinedir_to_tree origin:upstream 17 C error 1 11d 767d 0/2 upstream: reported C repro on 2024/04/14 08:35
upstream KMSAN: uninit-value in ext4_inlinedir_to_tree ext4 7 C 267 706d 752d 27/29 fixed on 2024/08/14 03:44
upstream KMSAN: uninit-value in htree_dirblock_to_tree ext4 7 204 1103d 1234d 22/29 fixed on 2023/07/01 16:05
Last patch testing requests (10)
Created Duration User Patch Repo Result
2026/04/19 07:50 19m retest repro upstream report log
2026/04/13 03:51 13m retest repro upstream report log
2026/02/08 05:52 17m retest repro upstream report log
2025/11/29 23:23 15m retest repro upstream report log
2025/09/20 01:56 14m retest repro upstream report log
2025/07/10 13:06 14m retest repro upstream report log
2025/05/01 02:42 13m retest repro upstream report log
2025/02/19 03:00 15m retest repro upstream report log
2025/01/01 04:09 18m retest repro upstream report log
2024/11/27 18:21 1h11m retest repro upstream report log
Fix bisection attempts (13)
Created Duration User Patch Repo Result
2026/02/02 00:27 1m bisect fix upstream error job log
2026/01/02 22:18 1h49m bisect fix upstream OK (0) job log log
2025/11/30 19:06 2h19m bisect fix upstream OK (0) job log log
2025/10/30 16:46 4h00m bisect fix upstream OK (0) job log log
2025/09/22 03:26 1h24m bisect fix upstream OK (0) job log log
2025/08/17 09:27 2h10m bisect fix upstream OK (0) job log log
2025/07/18 01:58 3h47m bisect fix upstream OK (0) job log log
2025/06/16 12:38 4h57m bisect fix upstream OK (0) job log log
2025/05/14 18:36 2h21m bisect fix upstream OK (0) job log log
2025/04/11 21:23 2h39m bisect fix upstream OK (0) job log log
2025/03/07 06:21 1h34m bisect fix upstream OK (0) job log log
2025/02/04 23:56 2h18m bisect fix upstream OK (0) job log log
2024/10/20 09:45 1h57m bisect fix upstream OK (0) job log log

Sample crash report:
EXT4-fs error (device loop0): htree_dirblock_to_tree:1112: inode #2: block 21: comm syz-executor129: bad entry in directory: directory entry overrun - offset=1004, inode=0, rec_len=1000, size=1024 fake=0
==================================================================
BUG: KASAN: use-after-free in ext4_read_inline_data fs/ext4/inline.c:209 [inline]
BUG: KASAN: use-after-free in ext4_inlinedir_to_tree+0x57a/0x11d0 fs/ext4/inline.c:1365
Read of size 324 at addr ffff8880717c5c05 by task syz-executor129/5213

CPU: 0 UID: 0 PID: 5213 Comm: syz-executor129 Not tainted 6.11.0-rc4-syzkaller-00255-gd2bafcf224f3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189
 __asan_memcpy+0x29/0x70 mm/kasan/shadow.c:105
 ext4_read_inline_data fs/ext4/inline.c:209 [inline]
 ext4_inlinedir_to_tree+0x57a/0x11d0 fs/ext4/inline.c:1365
 ext4_htree_fill_tree+0x5d8/0x1400 fs/ext4/namei.c:1211
 ext4_dx_readdir fs/ext4/dir.c:597 [inline]
 ext4_readdir+0x2b1c/0x3500 fs/ext4/dir.c:142
 iterate_dir+0x57a/0x810 fs/readdir.c:108
 __do_sys_getdents64 fs/readdir.c:407 [inline]
 __se_sys_getdents64+0x20d/0x4f0 fs/readdir.c:392
 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:0x7fcb146ca613
Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 42 23 fb ff 66 90 b8 ff ff ff 7f 48 39 c2 48 0f 47 d0 b8 d9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 b8 ff ff ff f7 d8
RSP: 002b:00007fffaa54eac8 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9
RAX: ffffffffffffffda RBX: 0000555567e83770 RCX: 00007fcb146ca613
RDX: 0000000000008000 RSI: 0000555567e83770 RDI: 0000000000000005
RBP: 0000555567e83744 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffb8
R13: 0000000000000016 R14: 0000555567e83740 R15: 00007fffaa551e30
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x5615451c4 pfn:0x717c5
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000
raw: 00000005615451c4 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 0x140dca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_ZERO), pid 5174, tgid 5174 (sftp-server), ts 48575534501, free_ts 49882330156
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1493
 prep_new_page mm/page_alloc.c:1501 [inline]
 get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3439
 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4695
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2263
 folio_alloc_mpol_noprof mm/mempolicy.c:2281 [inline]
 vma_alloc_folio_noprof+0x12e/0x230 mm/mempolicy.c:2312
 folio_prealloc+0x31/0x170
 alloc_anon_folio mm/memory.c:4498 [inline]
 do_anonymous_page mm/memory.c:4555 [inline]
 do_pte_missing mm/memory.c:3945 [inline]
 handle_pte_fault+0x255e/0x6fc0 mm/memory.c:5521
 __handle_mm_fault mm/memory.c:5664 [inline]
 handle_mm_fault+0xf70/0x1880 mm/memory.c:5832
 do_user_addr_fault arch/x86/mm/fault.c:1338 [inline]
 handle_page_fault arch/x86/mm/fault.c:1481 [inline]
 exc_page_fault+0x459/0x8c0 arch/x86/mm/fault.c:1539
 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623
page last free pid 5174 tgid 5174 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1094 [inline]
 free_unref_folios+0x100f/0x1ac0 mm/page_alloc.c:2660
 folios_put_refs+0x76e/0x860 mm/swap.c:1039
 free_pages_and_swap_cache+0x2ea/0x690 mm/swap_state.c:332
 __tlb_batch_free_encoded_pages mm/mmu_gather.c:136 [inline]
 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:366 [inline]
 tlb_flush_mmu+0x3a3/0x680 mm/mmu_gather.c:373
 tlb_finish_mmu+0xd4/0x200 mm/mmu_gather.c:465
 exit_mmap+0x44f/0xc80 mm/mmap.c:3425
 __mmput+0x115/0x380 kernel/fork.c:1345
 exit_mm+0x220/0x310 kernel/exit.c:571
 do_exit+0x9b2/0x27f0 kernel/exit.c:869
 do_group_exit+0x207/0x2c0 kernel/exit.c:1031
 __do_sys_exit_group kernel/exit.c:1042 [inline]
 __se_sys_exit_group kernel/exit.c:1040 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1040
 x64_sys_call+0x2634/0x2640 arch/x86/include/generated/asm/syscalls_64.h:232
 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

Memory state around the buggy address:
 ffff8880717c5b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880717c5b80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8880717c5c00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff8880717c5c80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880717c5d00: 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
2024/08/25 01:07 upstream d2bafcf224f3 d7d32352 .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_inlinedir_to_tree
2024/08/25 03:11 upstream d2bafcf224f3 d7d32352 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ext4_inlinedir_to_tree
2024/08/25 14:49 upstream 780bdc1ba776 d7d32352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in ext4_inlinedir_to_tree
2024/08/24 22:45 upstream d2bafcf224f3 d7d32352 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in ext4_inlinedir_to_tree
2024/09/04 13:01 upstream 88fac17500f4 9d47f20a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Read in ext4_inlinedir_to_tree
2024/12/04 17:31 upstream feffde684ac2 b50eb251 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: slab-out-of-bounds Read in ext4_inlinedir_to_tree
* Struck through repros no longer work on HEAD.