syzbot


KASAN: use-after-free Read in ext4_find_extent (4)

Status: upstream: reported C repro on 2024/12/30 20:06
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+ee60e584b5c6bb229126@syzkaller.appspotmail.com
First crash: 100d, last: 6d00h
Cause bisection: introduced by (bisect log) :
commit 93cdf49f6eca5e23f6546b8f28457b2e6a6961d9
Author: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Date: Sat Mar 25 08:13:39 2023 +0000

  ext4: Fix best extent lstart adjustment logic in ext4_mb_new_inode_pa()

Crash: KASAN: use-after-free Read in ext4_ext_remove_space (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ext4?] KASAN: use-after-free Read in ext4_find_extent (4) 1 (3) 2025/03/28 17:10
Similar bugs (10)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: use-after-free Read in ext4_find_extent C 1 37d 51d 0/2 upstream: reported C repro on 2025/02/13 21:05
android-5-10 KASAN: use-after-free Read in ext4_find_extent ext4 C error inconclusive 29 11d 831d 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 C error done 3 161d 658d 0/2 auto-obsoleted due to no activity on 2025/02/04 04:57
linux-5.15 KASAN: use-after-free Read in ext4_find_extent origin:lts-only C inconclusive 5 42d 626d 0/3 upstream: reported C repro on 2023/07/19 14:49
upstream KASAN: use-after-free Read in ext4_find_extent ext4 2 1264d 1324d 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 342d 565d 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 11 5d13h 831d 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 702d 826d 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 466d 648d 25/28 fixed on 2024/01/30 23:26
android-54 KASAN: slab-out-of-bounds Read in ext4_find_extent ext4 C 1 646d 831d 0/2 auto-obsoleted due to no activity on 2023/10/08 03:20
Last patch testing requests (6)
Created Duration User Patch Repo Result
2025/03/10 06:06 21m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2025/03/10 06:06 21m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2025/03/10 06:06 21m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2025/03/10 06:06 21m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2025/03/10 06:06 23m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log
2025/01/09 20:52 1h28m retest repro git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:840 [inline]
BUG: KASAN: use-after-free in ext4_find_extent+0xb92/0xd80 fs/ext4/extents.c:955
Read of size 4 at addr ffff888078554d18 by task kworker/u8:1/13

CPU: 1 UID: 0 PID: 13 Comm: kworker/u8:1 Not tainted 6.14.0-syzkaller-03576-g1e1ba8d23dae #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: writeback wb_workfn (flush-7:3)
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:408 [inline]
 print_report+0x16e/0x5b0 mm/kasan/report.c:521
 kasan_report+0x143/0x180 mm/kasan/report.c:634
 ext4_ext_binsearch fs/ext4/extents.c:840 [inline]
 ext4_find_extent+0xb92/0xd80 fs/ext4/extents.c:955
 ext4_ext_map_blocks+0x2e6/0x7d80 fs/ext4/extents.c:4205
 ext4_map_create_blocks fs/ext4/inode.c:516 [inline]
 ext4_map_blocks+0x909/0x1a70 fs/ext4/inode.c:702
 mpage_map_one_extent fs/ext4/inode.c:2219 [inline]
 mpage_map_and_submit_extent fs/ext4/inode.c:2272 [inline]
 ext4_do_writepages+0x21cd/0x3e00 fs/ext4/inode.c:2735
 ext4_writepages+0x203/0x3c0 fs/ext4/inode.c:2824
 do_writepages+0x36a/0x890 mm/page-writeback.c:2687
 __writeback_single_inode+0x14f/0x10d0 fs/fs-writeback.c:1680
 writeback_sb_inodes+0x822/0x1360 fs/fs-writeback.c:1976
 __writeback_inodes_wb+0x11b/0x260 fs/fs-writeback.c:2047
 wb_writeback+0x429/0xb90 fs/fs-writeback.c:2158
 wb_check_old_data_flush fs/fs-writeback.c:2262 [inline]
 wb_do_writeback fs/fs-writeback.c:2315 [inline]
 wb_workfn+0xbbc/0x10b0 fs/fs-writeback.c:2343
 process_one_work kernel/workqueue.c:3238 [inline]
 process_scheduled_works+0xac3/0x18e0 kernel/workqueue.c:3319
 worker_thread+0x870/0xd30 kernel/workqueue.c:3400
 kthread+0x7a9/0x920 kernel/kthread.c:464
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:153
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xe pfn:0x78554
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000
raw: 000000000000000e 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 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 6763, tgid 6763 (syz-executor423), ts 102180888823, free_ts 102196582757
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1551
 prep_new_page mm/page_alloc.c:1559 [inline]
 get_page_from_freelist+0x368a/0x37d0 mm/page_alloc.c:3477
 __alloc_frozen_pages_noprof+0x2c5/0x7b0 mm/page_alloc.c:4740
 alloc_pages_mpol+0x339/0x690 mm/mempolicy.c:2301
 folio_alloc_mpol_noprof+0x36/0x70 mm/mempolicy.c:2320
 shmem_alloc_folio mm/shmem.c:1863 [inline]
 shmem_alloc_and_add_folio+0x490/0x1070 mm/shmem.c:1902
 shmem_get_folio_gfp+0x655/0x1800 mm/shmem.c:2545
 shmem_get_folio mm/shmem.c:2651 [inline]
 shmem_write_begin+0x17e/0x3a0 mm/shmem.c:3301
 generic_perform_write+0x329/0xa10 mm/filemap.c:4102
 shmem_file_write_iter+0xf9/0x120 mm/shmem.c:3477
 new_sync_write fs/read_write.c:591 [inline]
 vfs_write+0x70f/0xd10 fs/read_write.c:684
 ksys_write+0x19d/0x2d0 fs/read_write.c:736
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 6763 tgid 6763 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1127 [inline]
 free_unref_folios+0xe5b/0x18d0 mm/page_alloc.c:2707
 folios_put_refs+0x779/0x880 mm/swap.c:994
 folio_batch_release include/linux/pagevec.h:101 [inline]
 shmem_undo_range+0x595/0x1820 mm/shmem.c:1112
 shmem_truncate_range mm/shmem.c:1224 [inline]
 shmem_evict_inode+0x29d/0xa80 mm/shmem.c:1352
 evict+0x4f9/0x9b0 fs/inode.c:810
 __dentry_kill+0x20d/0x630 fs/dcache.c:643
 dput+0x19f/0x2b0 fs/dcache.c:885
 __fput+0x60b/0x9f0 fs/file_table.c:473
 fput_close_sync+0x1ef/0x270 fs/file_table.c:570
 __do_sys_close fs/open.c:1581 [inline]
 __se_sys_close fs/open.c:1566 [inline]
 __x64_sys_close+0x7f/0x110 fs/open.c:1566
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff888078554c00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888078554c80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888078554d00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                            ^
 ffff888078554d80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888078554e00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (22):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/27 12:48 upstream 1e1ba8d23dae 20510e88 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-upstream-fs KASAN: use-after-free Read in ext4_find_extent
2025/02/23 19:10 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a1c24ab82279 d34966d1 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2025/02/23 14:46 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a1c24ab82279 d34966d1 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1 (corrupt fs)] [mounted in repro #2 (corrupt fs)] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2025/02/23 13:39 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a1c24ab82279 d34966d1 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1 (corrupt fs)] [mounted in repro #2 (corrupt fs)] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2025/02/23 12:35 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a1c24ab82279 d34966d1 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1 (corrupt fs)] [mounted in repro #2 (corrupt fs)] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2025/02/23 11:31 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a1c24ab82279 d34966d1 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1 (corrupt fs)] [mounted in repro #2 (corrupt fs)] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2024/12/26 20:29 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 573067a5a685 d3ccff63 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2025/03/31 05:42 upstream aa918db707fb d3999433 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in ext4_find_extent
2025/03/27 05:50 upstream 1e1ba8d23dae 20510e88 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in ext4_find_extent
2025/03/10 17:09 upstream 80e54e84911a 16256247 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in ext4_find_extent
2025/02/20 16:48 upstream 87a132e73910 50668798 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in ext4_find_extent
2025/02/16 06:37 upstream 496659003dac 40a34ec9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: use-after-free Read in ext4_find_extent
2025/03/26 15:11 upstream 1e26c5e28ca5 19e40f48 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: use-after-free Read in ext4_find_extent
2025/03/21 15:40 upstream b3ee1e460951 62330552 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root KASAN: use-after-free Read in ext4_find_extent
2025/03/15 20:52 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a5618886fdab e2826670 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2025/03/13 16:40 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 78e3fd2b7e4b 44be8b44 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2025/02/24 05:53 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a1c24ab82279 d34966d1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2025/02/24 05:53 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a1c24ab82279 d34966d1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2024/12/26 19:55 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 573067a5a685 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: use-after-free Read in ext4_find_extent
2025/03/21 01:46 upstream 5fc319360819 62330552 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-out-of-bounds Read in ext4_find_extent
2025/03/15 10:08 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a5618886fdab e2826670 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in ext4_find_extent
2025/01/15 17:56 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 6251d1776bc5 7315a7cf .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-out-of-bounds Read in ext4_find_extent
* Struck through repros no longer work on HEAD.