KASAN: use-after-free Read in ext4_ext_remove_space

Status: upstream: reported C repro on 2025/07/20 13:48
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+8ecc8500ff5712c63801@syzkaller.appspotmail.com
First crash: 462d, last: 1d18h
Fix bisection: failed (error log)
  
▶ ▼ Bug presence (2)
Date Name Commit Repro Result
2026/10/08 lts (merge base) 090666d3cc90 C [report] KASAN: use-after-free Read in ext4_ext_remove_space
2026/10/08 upstream (ToT) 0c2669a9f4a1 C [report] KASAN: use-after-free Read in ext4_ext_remove_space
▶ ▼ Similar bugs (8)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-15 KASAN: out-of-bounds Read in ext4_ext_remove_space origin:upstream missing-backport 22 syz, C error error 54 4d06h 1178d 0/2 upstream: reported C repro on 2023/08/04 22:38
android-5-10 KASAN: out-of-bounds Read in ext4_ext_remove_space 22 syz, C error 59 17d 1149d 0/2 upstream: reported C repro on 2023/09/02 13:17
upstream KASAN: slab-use-after-free Read in ext4_ext_remove_space ext4 19 syz, C error 73 215d 573d 29/29 fixed on 2026/05/21 07:50
linux-6.1 KASAN: out-of-bounds Read in ext4_ext_remove_space origin:upstream missing-backport 19 syz, C done 35 207d 1026d 0/3 upstream: reported C repro on 2024/01/03 15:27
linux-6.6 KASAN: use-after-free Read in ext4_ext_remove_space 19 1 236d 236d 0/2 auto-obsoleted due to no activity on 2026/06/12 03:57
upstream KASAN: out-of-bounds Read in ext4_ext_remove_space ext4 17 syz, C error done 8 1025d 1199d 25/29 fixed on 2024/02/16 19:40
android-6-1 KASAN: out-of-bounds Read in ext4_ext_remove_space missing-backport 17 syz, C error error 6 736d 1168d 0/2 auto-obsoleted due to no activity on 2025/01/27 17:01
linux-5.15 KASAN: out-of-bounds Read in ext4_ext_remove_space missing-backport origin:upstream 17 syz, C done 5 166d 1008d 0/3 upstream: reported C repro on 2024/01/21 16:07
▶ ▼ Last patch testing requests (1)
Created Duration User Patch Repo Result
2026/10/24 10:43 17m retest repro android14-6.1 report job log log
▶ ▼ Fix bisection attempts (2)
Created Duration User Patch Repo Result
2025/11/18 21:12 0m bisect fix android14-6.1 error
2025/09/13 14:37 1h52m bisect fix android14-6.1 OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in ext4_ext_rm_leaf fs/ext4/extents.c:2602 [inline]
BUG: KASAN: slab-out-of-bounds in ext4_ext_remove_space+0x348b/0x40d0 fs/ext4/extents.c:2940
Read of size 4 at addr ffff888109a1b69c by task syz.3.380/1526

CPU: 0 PID: 1526 Comm: syz.3.380 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
Call Trace:
 <TASK>
 __dump_stack+0x21/0x24 lib/dump_stack.c:88
 dump_stack_lvl+0x110/0x170 lib/dump_stack.c:106
 print_address_description+0x71/0x200 mm/kasan/report.c:316
 print_report+0x4a/0x60 mm/kasan/report.c:420
 kasan_report+0x122/0x150 mm/kasan/report.c:524
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:350
 ext4_ext_rm_leaf fs/ext4/extents.c:2602 [inline]
 ext4_ext_remove_space+0x348b/0x40d0 fs/ext4/extents.c:2940
 ext4_ext_truncate+0x200/0x320 fs/ext4/extents.c:4476
 ext4_truncate+0x9be/0xfb0 fs/ext4/inode.c:4304
 ext4_setattr+0x1249/0x1bb0 fs/ext4/inode.c:5670
 notify_change+0xcc3/0xf80 fs/attr.c:499
 do_truncate+0x1ac/0x240 fs/open.c:66
 handle_truncate fs/namei.c:3292 [inline]
 do_open fs/namei.c:3637 [inline]
 path_openat+0x28f0/0x2f80 fs/namei.c:3790
 do_filp_open+0x1f1/0x430 fs/namei.c:3817
 do_sys_openat2+0x15e/0x810 fs/open.c:1343
 do_sys_open fs/open.c:1359 [inline]
 __do_sys_creat fs/open.c:1437 [inline]
 __se_sys_creat fs/open.c:1431 [inline]
 __x64_sys_creat+0x8e/0xb0 fs/open.c:1431
 x64_sys_call+0x116/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:86
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fef1399ce59
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:00007fef14917028 EFLAGS: 00000246
 ORIG_RAX: 0000000000000055
RAX: ffffffffffffffda RBX: 00007fef13c15fa0 RCX: 00007fef1399ce59
RDX: 0000000000000000 RSI: 0000000000000100 RDI: 0000200000000100
RBP: 00007fef13a32d6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fef13c16038 R14: 00007fef13c15fa0 R15: 00007ffc501c6818
 </TASK>

Allocated by task 1:
 kasan_save_stack mm/kasan/common.c:46 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:53
 kasan_save_alloc_info+0x25/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:380 [inline]
 __kasan_kmalloc+0x95/0xb0 mm/kasan/common.c:389
 kasan_kmalloc include/linux/kasan.h:212 [inline]
 __do_kmalloc_node mm/slab_common.c:938 [inline]
 __kmalloc_node_track_caller+0xb1/0x1e0 mm/slab_common.c:958
 kstrdup mm/util.c:66 [inline]
 kstrdup_const+0x5a/0xa0 mm/util.c:89
 kvasprintf_const+0xd7/0x240 lib/kasprintf.c:-1
 kobject_set_name_vargs+0x61/0x110 lib/kobject.c:265
 dev_set_name+0xdf/0x130 drivers/base/core.c:3486
 tty_register_device_attr+0x3c7/0x990 drivers/tty/tty_io.c:3244
 tty_register_device drivers/tty/tty_io.c:3185 [inline]
 tty_register_driver+0x59a/0xb20 drivers/tty/tty_io.c:3449
 vty_init+0x23a/0x33c drivers/tty/vt/vt.c:3615
 tty_init+0x138/0x178 drivers/tty/tty_io.c:3604
 chr_dev_init+0x145/0x14c drivers/char/mem.c:784
 do_one_initcall+0x1d6/0x580 init/main.c:1433
 do_initcall_level+0x16f/0x2d0 init/main.c:1506
 do_initcalls+0x50/0x92 init/main.c:1522
 do_basic_setup+0x92/0x99 init/main.c:1541
 kernel_init_freeable+0x2d1/0x424 init/main.c:1761
 kernel_init+0x1d/0x1c0 init/main.c:1649
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff888109a1b690
 which belongs to the cache kmalloc-8 of size 8
The buggy address is located 4 bytes to the right of
 8-byte region [ffff888109a1b690, ffff888109a1b698)

The buggy address belongs to the physical page:
page:ffffea00042686c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888109a1bc58 pfn:0x109a1b
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 ffffea0004c5c7c8 ffffea000489f908 ffff888100042300
raw: ffff888109a1bc58 000000000066005d 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, tgid 1 (swapper/0), ts 1640206480, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1f5/0x210 mm/page_alloc.c:2672
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2679
 get_page_from_freelist+0x2d12/0x2d80 mm/page_alloc.c:4585
 __alloc_pages+0x1fa/0x610 mm/page_alloc.c:5929
 alloc_slab_page+0x6e/0xf0 include/linux/gfp.h:-1
 allocate_slab mm/slub.c:1967 [inline]
 new_slab+0x98/0x3d0 mm/slub.c:2020
 ___slab_alloc+0x6bd/0xb20 mm/slub.c:3177
 __slab_alloc+0x5e/0xa0 mm/slub.c:3263
 slab_alloc_node mm/slub.c:3348 [inline]
 __kmem_cache_alloc_node+0x203/0x2c0 mm/slub.c:3423
 __do_kmalloc_node mm/slab_common.c:937 [inline]
 __kmalloc_node_track_caller+0xa0/0x1e0 mm/slab_common.c:958
 kstrdup mm/util.c:66 [inline]
 kstrdup_const+0x5a/0xa0 mm/util.c:89
 __kernfs_new_node+0xa8/0x6b0 fs/kernfs/dir.c:610
 kernfs_new_node+0x150/0x260 fs/kernfs/dir.c:690
 kernfs_create_link+0xa4/0x200 fs/kernfs/symlink.c:39
 sysfs_do_create_link_sd+0x8a/0x110 fs/sysfs/symlink.c:44
 sysfs_do_create_link fs/sysfs/symlink.c:80 [inline]
 sysfs_create_link+0x68/0x80 fs/sysfs/symlink.c:92
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888109a1b580: fc fc fc fc 06 fc fc fc fc 06 fc fc fc fc fa fc
 ffff888109a1b600: fc fc fc 06 fc fc fc fc 03 fc fc fc fc 06 fc fc
>ffff888109a1b680: fc fc 06 fc fc fc fc fa fc fc fc fc 05 fc fc fc
                            ^
 ffff888109a1b700: fc fb fc fc fc fc fa fc fc fc fc 05 fc fc fc fc
 ffff888109a1b780: 06 fc fc fc fc 05 fc fc fc fc 04 fc fc fc fc 04
==================================================================
EXT4-fs error (device loop3): ext4_free_blocks:6220: comm syz.3.380: Freeing blocks not in datazone - block = 0, count = 0
EXT4-fs error (device loop3): ext4_free_blocks:6220: comm syz.3.380: Freeing blocks not in datazone - block = 1, count = 55

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/05/30 22:16 android14-6.1 b28955bde980 6b4a8443 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-android-6-1 KASAN: slab-out-of-bounds Read in ext4_ext_remove_space
2026/05/31 20:40 android14-6.1 b28955bde980 6b4a8443 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2026/05/31 15:42 android14-6.1 b28955bde980 6b4a8443 .config console log report syz / log [disk image] [vmlinux] [kernel image] [mounted in repro (clean fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2026/03/31 19:10 android14-6.1 f5931d57f029 aeea1c72 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2026/02/23 18:57 android14-6.1 34c1a8e17200 6beca497 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2026/01/18 08:52 android14-6.1 f8a5ad1fcf13 20d37d28 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2026/01/17 11:11 android14-6.1 f8a5ad1fcf13 20d37d28 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2025/07/20 17:34 android14-6.1 145c7fad733f 7117feec .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2025/07/20 16:23 android14-6.1 145c7fad733f 7117feec .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2025/07/20 15:35 android14-6.1 145c7fad733f 7117feec .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2025/07/20 14:43 android14-6.1 145c7fad733f 7117feec .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2025/07/20 13:37 android14-6.1 145c7fad733f 7117feec .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
2025/07/20 12:27 android14-6.1 145c7fad733f 7117feec .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in ext4_ext_remove_space
* Struck through repros no longer work on HEAD.