syzbot


KASAN: use-after-free Read in ext4_find_extent

Status: upstream: reported C repro on 2023/07/19 14:49
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+1df2fc26f298c5e1a1dd@syzkaller.appspotmail.com
First crash: 443d, last: 1h21m
Bug presence (2)
Date Name Commit Repro Result
2023/07/20 linux-5.15.y (ToT) d54cfc420586 C [report] KASAN: use-after-free Read in ext4_find_extent
2023/07/20 upstream (ToT) bfa3037d8280 C Didn't crash
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Read in ext4_find_extent ext4 C error inconclusive 22 18d 648d 0/2 upstream: reported C repro on 2022/12/26 07:59
android-6-1 KASAN: use-after-free Read in ext4_find_extent missing-backport origin:lts C error 3 41d 474d 0/2 upstream: reported C repro on 2023/06/18 03:55
upstream KASAN: use-after-free Read in ext4_find_extent ext4 2 1080d 1141d 0/28 auto-closed as invalid on 2022/02/17 05:19
linux-6.1 KASAN: use-after-free Read in ext4_find_extent origin:upstream missing-backport C done 1 158d 382d 0/3 upstream: reported C repro on 2023/09/19 00:11
android-5-15 KASAN: use-after-free Read in ext4_find_extent ext4 origin:lts C error 9 8d22h 648d 0/2 upstream: reported C repro on 2022/12/26 07:59
upstream KASAN: use-after-free Read in ext4_find_extent (2) ext4 C error 2 519d 643d 22/28 fixed on 2023/06/08 14:41
upstream KASAN: use-after-free Read in ext4_find_extent (3) prio:low ext4 C error done 31 283d 465d 25/28 fixed on 2024/01/30 23:26
android-54 KASAN: slab-out-of-bounds Read in ext4_find_extent ext4 C 1 463d 648d 0/2 auto-obsoleted due to no activity on 2023/10/08 03:20
Last patch testing requests (3)
Created Duration User Patch Repo Result
2024/10/05 02:14 1h11m retest repro linux-5.15.y report log
2024/10/05 02:14 13m retest repro linux-5.15.y report log
2024/10/05 02:14 retest repro linux-5.15.y running
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2023/08/10 04:19 7h14m fix candidate upstream OK (2) job log

Sample crash report:
EXT4-fs (loop0): mounted filesystem without journal. Opts: errors=remount-ro,noquota,debug,auto_da_alloc=0x0000000000000000,data_err=ignore,auto_da_alloc=0x0000000000008000,nouid32,delalloc,usrquota,. Quota mode: writeback.
ext4 filesystem being mounted at /root/file1 supports timestamps until 2038 (0x7fffffff)
==================================================================
BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:827 [inline]
BUG: KASAN: use-after-free in ext4_find_extent+0xbc4/0xdd0 fs/ext4/extents.c:946
Read of size 4 at addr ffff88807003fa90 by task syz-executor152/3498

CPU: 0 PID: 3498 Comm: syz-executor152 Not tainted 5.15.158-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 ext4_ext_binsearch fs/ext4/extents.c:827 [inline]
 ext4_find_extent+0xbc4/0xdd0 fs/ext4/extents.c:946
 ext4_ext_map_blocks+0x2da/0x7690 fs/ext4/extents.c:4142
 ext4_map_blocks+0xaad/0x1e00 fs/ext4/inode.c:645
 mpage_map_one_extent fs/ext4/inode.c:2396 [inline]
 mpage_map_and_submit_extent fs/ext4/inode.c:2449 [inline]
 ext4_writepages+0x160e/0x3d10 fs/ext4/inode.c:2817
 do_writepages+0x481/0x730 mm/page-writeback.c:2364
 filemap_fdatawrite_wbc+0x1d6/0x230 mm/filemap.c:400
 __filemap_fdatawrite_range mm/filemap.c:433 [inline]
 filemap_write_and_wait_range+0x19e/0x280 mm/filemap.c:704
 ext4_punch_hole+0x199/0xc10 fs/ext4/inode.c:3983
 ext4_fallocate+0x30a/0x20c0 fs/ext4/extents.c:4740
 vfs_fallocate+0x54a/0x6b0 fs/open.c:308
 do_vfs_ioctl+0x2317/0x2b70 fs/ioctl.c:853
 __do_sys_ioctl fs/ioctl.c:872 [inline]
 __se_sys_ioctl+0x81/0x160 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7ff66a973ba9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 1a 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffde0ff8068 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007ff66a9b5110 RCX: 00007ff66a973ba9
RDX: 0000000020000000 RSI: 0000000040305829 RDI: 0000000000000004
RBP: 636f6c6c615f6164 R08: 00007ff66a9b50cc R09: 00007ff66a9b50cc
R10: 00007ff66a9b50cc R11: 0000000000000246 R12: 5f61645f6f747561
R13: 00007ff66a9b50e5 R14: 0000000000000001 R15: 0000000000000001
 </TASK>

The buggy address belongs to the page:
page:ffffea0001c00fc0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x7003f
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001c01008 ffffea0001c00f88 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, ts 10687359079, free_ts 11846083502
 split_map_pages+0x246/0x510 mm/compaction.c:99
 isolate_freepages_range+0x47c/0x4e0 mm/compaction.c:749
 alloc_contig_range+0xc2b/0xf90 mm/page_alloc.c:9216
 __alloc_contig_pages mm/page_alloc.c:9240 [inline]
 alloc_contig_pages+0x3ea/0x4e0 mm/page_alloc.c:9320
 debug_vm_pgtable_alloc_huge_page+0xb9/0x110 mm/debug_vm_pgtable.c:1085
 init_args+0xc4f/0xf40 mm/debug_vm_pgtable.c:1207
 debug_vm_pgtable+0xaa/0x470 mm/debug_vm_pgtable.c:1245
 do_one_initcall+0x22b/0x7a0 init/main.c:1302
 do_initcall_level+0x157/0x210 init/main.c:1375
 do_initcalls+0x49/0x90 init/main.c:1391
 kernel_init_freeable+0x425/0x5c0 init/main.c:1615
 kernel_init+0x19/0x290 init/main.c:1506
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_contig_range+0x95/0xf0 mm/page_alloc.c:9342
 destroy_args+0xfe/0x980 mm/debug_vm_pgtable.c:1018
 debug_vm_pgtable+0x40d/0x470 mm/debug_vm_pgtable.c:1331
 do_one_initcall+0x22b/0x7a0 init/main.c:1302
 do_initcall_level+0x157/0x210 init/main.c:1375
 do_initcalls+0x49/0x90 init/main.c:1391
 kernel_init_freeable+0x425/0x5c0 init/main.c:1615
 kernel_init+0x19/0x290 init/main.c:1506
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300

Memory state around the buggy address:
 ffff88807003f980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88807003fa00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88807003fa80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                         ^
 ffff88807003fb00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88807003fb80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/09 04:14 linux-5.15.y 284087d4f7d5 20bf80e1 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-5-15-kasan KASAN: use-after-free Read in ext4_find_extent
2023/08/15 04:53 linux-5.15.y 24c4de4069cb 39990d51 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-linux-5-15-kasan KASAN: use-after-free Read in ext4_find_extent
2023/07/19 14:47 linux-5.15.y d54cfc420586 022df2bb .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: use-after-free Read in ext4_find_extent
2024/05/09 03:53 linux-5.15.y 284087d4f7d5 20bf80e1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in ext4_find_extent
* Struck through repros no longer work on HEAD.