syzbot


KASAN: out-of-bounds Read in ext4_ext_remove_space

Status: upstream: reported C repro on 2024/01/21 16:07
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+023ffea00bea0075efe3@syzkaller.appspotmail.com
First crash: 106d, last: 15d
Bug presence (3)
Date Name Commit Repro Result
2024/04/21 linux-5.15.y (ToT) c52b9710c83d C [report] KASAN: out-of-bounds Read in ext4_ext_remove_space
2024/01/21 upstream (ToT) 4fbbed787267 C [report] KASAN: out-of-bounds Read in ext4_ext_remove_space
2024/04/21 upstream (ToT) 977b1ef51866 C Didn't crash
Similar bugs (5)
Kernel Title 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 C error 4 8d17h 275d 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 C 1 12d 247d 0/2 upstream: reported C repro on 2023/09/02 13:17
upstream KASAN: out-of-bounds Read in ext4_ext_remove_space ext4 C error done 8 123d 297d 26/26 fixed on 2024/02/16 19:40
android-6-1 KASAN: out-of-bounds Read in ext4_ext_remove_space origin:upstream missing-backport C error 4 8d18h 266d 0/2 upstream: reported C repro on 2023/08/14 17:29
linux-6.1 KASAN: out-of-bounds Read in ext4_ext_remove_space origin:upstream missing-backport C 1 17d 124d 0/3 upstream: reported C repro on 2024/01/03 15:27
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2024/04/01 00:18 2h38m bisect fix linux-5.15.y job log (0) log
2024/03/01 14:23 2h08m bisect fix linux-5.15.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: out-of-bounds in ext4_ext_rm_leaf fs/ext4/extents.c:2711 [inline]
BUG: KASAN: out-of-bounds in ext4_ext_remove_space+0x1e04/0x4db0 fs/ext4/extents.c:2933
Read of size 18446744073709551544 at addr ffff888070819054 by task syz-executor254/15241

CPU: 1 PID: 15241 Comm: syz-executor254 Not tainted 5.15.153-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb 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
 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
 memmove+0x25/0x60 mm/kasan/shadow.c:54
 ext4_ext_rm_leaf fs/ext4/extents.c:2711 [inline]
 ext4_ext_remove_space+0x1e04/0x4db0 fs/ext4/extents.c:2933
 ext4_punch_hole+0x7c0/0xc10 fs/ext4/inode.c:4088
 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+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f25602ebbb9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 91 1b 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f256027e168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f256036c6d8 RCX: 00007f25602ebbb9
RDX: 0000000020000080 RSI: 000000004030582b RDI: 0000000000000004
RBP: 00007f256036c6d0 R08: 00007fff507e0487 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f256036c6dc
R13: 000000000000006e R14: 00007fff507e03a0 R15: 00007fff507e0488
 </TASK>

The buggy address belongs to the page:
page:ffffea0001c20640 refcount:2 mapcount:0 mapping:ffff8880185cc370 index:0x11 pfn:0x70819
memcg:ffff88814077c000
aops:def_blk_aops ino:700001
flags: 0xfff00000002036(referenced|uptodate|lru|active|private|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000002036 ffffea0000665f48 ffffea0001c39f08 ffff8880185cc370
raw: 0000000000000011 ffff88806f94c488 00000002ffffffff ffff88814077c000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x108c48(GFP_NOFS|__GFP_NOFAIL|__GFP_HARDWALL|__GFP_MOVABLE), pid 15227, ts 1085142908390, free_ts 1084643196204
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 __page_cache_alloc+0xd4/0x4a0 mm/filemap.c:1022
 pagecache_get_page+0xa91/0x1010 mm/filemap.c:1940
 find_or_create_page include/linux/pagemap.h:420 [inline]
 grow_dev_page fs/buffer.c:949 [inline]
 grow_buffers fs/buffer.c:1014 [inline]
 __getblk_slow fs/buffer.c:1041 [inline]
 __getblk_gfp+0x22a/0xaf0 fs/buffer.c:1336
 sb_getblk_gfp include/linux/buffer_head.h:368 [inline]
 ext4_ext_grow_indepth fs/ext4/extents.c:1328 [inline]
 ext4_ext_create_new_leaf fs/ext4/extents.c:1429 [inline]
 ext4_ext_insert_extent+0xfdf/0x4e60 fs/ext4/extents.c:2099
 ext4_ext_map_blocks+0x1d6d/0x7690 fs/ext4/extents.c:4337
 ext4_map_blocks+0xaad/0x1e00 fs/ext4/inode.c:645
 _ext4_get_block+0x23b/0x660 fs/ext4/inode.c:792
 ext4_block_write_begin+0x6b0/0x13a0 fs/ext4/inode.c:1077
 ext4_write_begin+0x6c6/0x15f0
 ext4_da_write_begin+0x342/0xb60 fs/ext4/inode.c:2963
 generic_perform_write+0x2bf/0x5b0 mm/filemap.c:3785
 ext4_buffered_write_iter+0x227/0x360 fs/ext4/file.c:268
 ext4_file_write_iter+0x87c/0x1990
 call_write_iter include/linux/fs.h:2148 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0xacf/0xe50 fs/read_write.c:594
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_list+0x1f7/0x8e0 mm/page_alloc.c:3433
 release_pages+0x1bb9/0x1f40 mm/swap.c:963
 __pagevec_release+0x80/0xf0 mm/swap.c:983
 pagevec_release include/linux/pagevec.h:81 [inline]
 shmem_undo_range+0x67a/0x1b50 mm/shmem.c:964
 shmem_truncate_range mm/shmem.c:1063 [inline]
 shmem_evict_inode+0x21b/0xa00 mm/shmem.c:1145
 evict+0x2a4/0x620 fs/inode.c:587
 __dentry_kill+0x436/0x650 fs/dcache.c:582
 dentry_kill+0xbb/0x290
 dput+0xd8/0x1a0 fs/dcache.c:889
 __fput+0x5ec/0x890 fs/file_table.c:288
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86

Memory state around the buggy address:
 ffff888070818f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888070818f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888070819000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                                 ^
 ffff888070819080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888070819100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/06 12:33 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: out-of-bounds Read in ext4_ext_remove_space
2024/01/21 16:07 linux-5.15.y ddcaf4999061 9bd8dcda .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: out-of-bounds Read in ext4_ext_remove_space
2024/04/15 05:06 linux-5.15.y fa3df276cd36 c8349e48 .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan KASAN: out-of-bounds Read in ext4_ext_remove_space
* Struck through repros no longer work on HEAD.