KASAN: use-after-free Read in ext4_read_inline_dir

Status: upstream: reported C repro on 2025/01/07 14:17
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+26c4a8cab92d0cda3e3b@syzkaller.appspotmail.com
First crash: 576d, last: 19d
Fix bisection: failed (error log, bisect log)
  
Discussions (1)
Title Replies (including bot) Last reply
[PATCH] ext4: prevent out-of-bounds read in ext4_read_inline_data() 4 (4) 2026/04/23 17:05
Bug presence (2)
Date Name Commit Repro Result
2025/01/07 lts (merge base) 91786f140358 C [report] KASAN: use-after-free Read in ext4_read_inline_dir
2025/01/07 upstream (ToT) fbfd64d25c7a C [report] KASAN: use-after-free Read in ext4_read_inline_dir
Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 KASAN: use-after-free Read in ext4_read_inline_dir (2) origin:upstream 19 syz, C error 5 104d 583d 0/2 upstream: reported C repro on 2024/12/31 16:48
android-6-1 KASAN: use-after-free Read in ext4_read_inline_dir 19 1 738d 738d 0/2 auto-obsoleted due to no activity on 2024/10/28 03:11
android-5-10 KASAN: slab-out-of-bounds Read in ext4_read_inline_dir 19 syz, C error 5 19d 381d 0/2 upstream: reported C repro on 2025/07/21 09:03
upstream KASAN: slab-out-of-bounds Read in ext4_read_inline_dir ext4 19 syz, C done error 79 299d 739d 0/29 auto-obsoleted due to no activity on 2026/01/25 02:41
Last patch testing requests (9)
Created Duration User Patch Repo Result
2026/06/25 12:56 13m retest repro android13-5.15-lts log
2026/05/28 07:54 12m retest repro android13-5.15-lts log
2026/05/28 07:54 12m retest repro android13-5.15-lts error
2026/05/09 18:02 46m retest repro android13-5.15-lts report log
2026/05/09 18:02 14m retest repro android13-5.15-lts report log
2026/04/21 04:36 21m junjie.cao@intel.com patch upstream OK log
2026/03/19 16:29 9m junjie.cao@linux.dev https://github.com/Lukaaa525/linux-kernel.git ext4-inline-bounds-fix error
2026/03/19 15:46 7m junjie.cao@linux.dev https://github.com/Lukaaa525/linux-kernel.git ext4-inline-bounds-fix error
2026/03/19 11:52 13m junjie.cao@linux.dev patch upstream error
Fix bisection attempts (9)
Created Duration User Patch Repo Result
2026/01/27 15:26 0m bisect fix android13-5.15-lts error job log
2025/11/29 12:37 1h45m bisect fix android13-5.15-lts OK (0) job log log
2025/10/28 10:39 1h17m bisect fix android13-5.15-lts OK (0) job log log
2025/09/02 20:10 2h00m bisect fix android13-5.15-lts OK (0) job log log
2025/07/28 09:52 1h33m bisect fix android13-5.15-lts OK (0) job log log
2025/06/12 21:32 2h37m bisect fix android13-5.15-lts OK (0) job log log
2025/05/12 14:33 1h22m bisect fix android13-5.15-lts OK (0) job log log
2025/03/25 16:24 1h11m bisect fix android13-5.15-lts OK (0) job log log
2025/02/22 07:17 1h11m bisect fix android13-5.15-lts OK (0) job log log

Sample crash report:
loop2: detected capacity change from 0 to 1024
EXT4-fs (loop2): mounted filesystem without journal. Opts: resgid=0x000000000000ee00,bsddf,grpquota,nojournal_checksum,debug_want_extra_isize=0x0000000000000080,delalloc,nogrpid,noauto_da_alloc,stripe=0x0000000000000002,,errors=continue. Quota mode: writeback.
==================================================================
BUG: KASAN: use-after-free in ext4_read_inline_data fs/ext4/inline.c:210 [inline]
BUG: KASAN: use-after-free in ext4_read_inline_dir+0x414/0xd00 fs/ext4/inline.c:1551
Read of size 68 at addr ffff88812ab1141e by task syz.2.17/373

CPU: 1 PID: 373 Comm: syz.2.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
Call Trace:
 <TASK>
 __dump_stack+0x21/0x30 lib/dump_stack.c:88
 dump_stack_lvl+0x110/0x170 lib/dump_stack.c:106
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x10f/0x150 mm/kasan/report.c:444
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x249/0x2a0 mm/kasan/generic.c:189
 memcpy+0x2d/0x70 mm/kasan/shadow.c:65
 ext4_read_inline_data fs/ext4/inline.c:210 [inline]
 ext4_read_inline_dir+0x414/0xd00 fs/ext4/inline.c:1551
 ext4_readdir+0x3af/0x3aa0 fs/ext4/dir.c:161
 iterate_dir+0x25c/0x600 fs/readdir.c:-1
 __do_sys_getdents fs/readdir.c:286 [inline]
 __se_sys_getdents+0xf2/0x250 fs/readdir.c:271
 __x64_sys_getdents+0x7b/0x90 fs/readdir.c:271
 x64_sys_call+0xb4/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:79
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f501a8eee99
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f501a750028 EFLAGS: 00000246 ORIG_RAX: 000000000000004e
RAX: ffffffffffffffda RBX: 00007f501ab76fa0 RCX: 00007f501a8eee99
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000006
RBP: 00007f501a984eaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f501ab77038 R14: 00007f501ab76fa0 R15: 00007ffcba5ca328
 </TASK>

The buggy address belongs to the page:
page:ffffea0004aac440 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x12ab11
flags: 0x4000000000000000(zone=1)
raw: 4000000000000000 ffffea0004aac408 ffffea0004a0fbc8 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 0x100dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), pid 310, ts 30022176201, free_ts 30023160927
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2607
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2613
 get_page_from_freelist+0x2c3a/0x2cd0 mm/page_alloc.c:4487
 __alloc_pages+0x1a2/0x460 mm/page_alloc.c:5824
 __alloc_pages_node include/linux/gfp.h:595 [inline]
 alloc_pages_node include/linux/gfp.h:609 [inline]
 alloc_pages include/linux/gfp.h:622 [inline]
 do_anonymous_page mm/memory.c:4072 [inline]
 handle_pte_fault+0xee5/0x2770 mm/memory.c:4921
 __handle_mm_fault mm/memory.c:-1 [inline]
 do_handle_mm_fault+0x1b3b/0x1e30 mm/memory.c:5345
 handle_mm_fault include/linux/mm.h:1847 [inline]
 do_user_addr_fault+0x808/0x11c0 arch/x86/mm/fault.c:1416
 handle_page_fault arch/x86/mm/fault.c:1507 [inline]
 exc_page_fault+0x51/0xb0 arch/x86/mm/fault.c:1560
 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:606
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1474 [inline]
 free_pcp_prepare mm/page_alloc.c:1546 [inline]
 free_unref_page_prepare+0x5fa/0x600 mm/page_alloc.c:3536
 free_unref_page_list+0x138/0x9e0 mm/page_alloc.c:3673
 release_pages+0x1264/0x12c0 mm/swap.c:1015
 free_pages_and_swap_cache+0x86/0xa0 mm/swap_state.c:320
 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
 tlb_flush_mmu mm/mmu_gather.c:247 [inline]
 tlb_finish_mmu+0x17e/0x310 mm/mmu_gather.c:338
 unmap_region+0x344/0x3b0 mm/mmap.c:2692
 __do_munmap+0xa99/0x1090 mm/mmap.c:2925
 __vm_munmap+0x14e/0x280 mm/mmap.c:2978
 __do_sys_munmap mm/mmap.c:3004 [inline]
 __se_sys_munmap mm/mmap.c:3000 [inline]
 __x64_sys_munmap+0x6b/0x80 mm/mmap.c:3000
 x64_sys_call+0xc9/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:12
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff88812ab11300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88812ab11380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88812ab11400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                            ^
 ffff88812ab11480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88812ab11500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/07/18 15:13 android13-5.15-lts 31c263582f4e 72524a66 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-android-5-15 KASAN: use-after-free Read in ext4_read_inline_dir
2025/01/07 15:25 android13-5.15-lts 19092c8155b4 f3558dbf .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Read in ext4_read_inline_dir
2025/01/07 14:47 android13-5.15-lts 19092c8155b4 f3558dbf .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Read in ext4_read_inline_dir
2025/01/07 14:16 android13-5.15-lts 19092c8155b4 f3558dbf .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-android-5-15 KASAN: use-after-free Read in ext4_read_inline_dir
2026/07/18 14:50 android13-5.15-lts 31c263582f4e 72524a66 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-android-5-15 KASAN: use-after-free Read in ext4_read_inline_dir
2025/12/14 07:31 android13-5.15-lts 057fdbf6d3c7 d6526ea3 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-5-15 KASAN: use-after-free Read in ext4_read_inline_dir
2025/12/14 07:11 android13-5.15-lts 057fdbf6d3c7 d6526ea3 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-5-15 KASAN: use-after-free Read in ext4_read_inline_dir
* Struck through repros no longer work on HEAD.