syzbot


KASAN: out-of-bounds Read in ext4_ext_remove_space

Status: upstream: reported C repro on 2024/01/03 15:27
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+2de4e7fee59aa0477fcd@syzkaller.appspotmail.com
First crash: 173d, last: 18d
Bug presence (3)
Date Name Commit Repro Result
2024/05/03 linux-6.1.y (ToT) 909ba1f1b414 C [report] INFO: rcu detected stall in corrupted
2024/01/03 upstream (ToT) 610a9b8f49fb C [report] KASAN: out-of-bounds Read in ext4_ext_remove_space
2024/05/03 upstream (ToT) f03359bca01b 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 error 5 6d02h 325d 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 2 1d13h 296d 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 172d 346d 26/27 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 error 4 57d 315d 0/2 upstream: reported C repro on 2023/08/14 17:29
linux-5.15 KASAN: out-of-bounds Read in ext4_ext_remove_space origin:upstream missing-backport C error 3 29d 155d 0/3 upstream: reported C repro on 2024/01/21 16:07
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2024/05/23 07:36 4h55m bisect fix linux-6.1.y job log (0) log
2024/04/18 18:49 3h43m bisect fix linux-6.1.y job log (0) log
2024/03/16 04:47 2h08m bisect fix linux-6.1.y job log (0) log
2024/02/10 15:00 2h10m bisect fix linux-6.1.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: out-of-bounds in ext4_ext_rm_leaf fs/ext4/extents.c:2737 [inline]
BUG: KASAN: out-of-bounds in ext4_ext_remove_space+0x1c22/0x4f30 fs/ext4/extents.c:2959
Read of size 18446744073709551544 at addr ffff88806c501054 by task syz-executor329/8785

CPU: 1 PID: 8785 Comm: syz-executor329 Not tainted 6.1.70-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 kasan_check_range+0x27f/0x290 mm/kasan/generic.c:189
 memmove+0x25/0x60 mm/kasan/shadow.c:54
 ext4_ext_rm_leaf fs/ext4/extents.c:2737 [inline]
 ext4_ext_remove_space+0x1c22/0x4f30 fs/ext4/extents.c:2959
 ext4_punch_hole+0x80b/0xd00 fs/ext4/inode.c:4127
 ext4_fallocate+0x30b/0x2160 fs/ext4/extents.c:4708
 vfs_fallocate+0x547/0x6b0 fs/open.c:323
 do_vfs_ioctl+0x222c/0x2a90 fs/ioctl.c:849
 __do_sys_ioctl fs/ioctl.c:868 [inline]
 __se_sys_ioctl+0x81/0x160 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fbb65e70f49
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 18 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:00007fbb65deb218 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fbb65ef86e8 RCX: 00007fbb65e70f49
RDX: 0000000020000080 RSI: 000000004030582b RDI: 0000000000000004
RBP: 00007fbb65ef86e0 R08: 00007ffd2d80c7c7 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbb65ec5578
R13: 000000000000006e R14: 00007ffd2d80c6e0 R15: 6f6f6c2f7665642f
 </TASK>

The buggy address belongs to the physical page:
page:ffffea0001b14040 refcount:2 mapcount:0 mapping:ffff8880128875f8 index:0x11 pfn:0x6c501
memcg:ffff888140058000
aops:def_blk_aops ino:700004
flags: 0xfff58000002056(referenced|uptodate|lru|workingset|private|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff58000002056 ffffea0001e475c8 ffffea0001b454c8 ffff8880128875f8
raw: 0000000000000011 ffff8880739b6000 00000002ffffffff ffff888140058000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Movable, gfp_mask 0x148c48(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 8763, tgid 8762 (syz-executor329), ts 697107977280, free_ts 696324971462
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
 prep_new_page mm/page_alloc.c:2520 [inline]
 get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5545
 folio_alloc+0x1a/0x50 mm/mempolicy.c:2292
 filemap_alloc_folio+0xda/0x4f0 mm/filemap.c:971
 __filemap_get_folio+0x749/0xe80 mm/filemap.c:1965
 pagecache_get_page+0x28/0x250 mm/folio-compat.c:110
 find_or_create_page include/linux/pagemap.h:613 [inline]
 grow_dev_page fs/buffer.c:946 [inline]
 grow_buffers fs/buffer.c:1011 [inline]
 __getblk_slow fs/buffer.c:1038 [inline]
 __getblk_gfp+0x211/0xa20 fs/buffer.c:1333
 sb_getblk_gfp include/linux/buffer_head.h:363 [inline]
 ext4_ext_grow_indepth fs/ext4/extents.c:1334 [inline]
 ext4_ext_create_new_leaf fs/ext4/extents.c:1435 [inline]
 ext4_ext_insert_extent+0xfdf/0x4e50 fs/ext4/extents.c:2102
 ext4_ext_map_blocks+0x1d55/0x77c0 fs/ext4/extents.c:4308
 ext4_map_blocks+0xa3c/0x1ca0 fs/ext4/inode.c:651
 _ext4_get_block+0x23b/0x660 fs/ext4/inode.c:798
 ext4_block_write_begin+0x631/0x1400 fs/ext4/inode.c:1100
 ext4_write_begin+0x638/0xf80
 ext4_da_write_begin+0x30a/0x9c0 fs/ext4/inode.c:2988
 generic_perform_write+0x2fc/0x5e0 mm/filemap.c:3808
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1440 [inline]
 free_pcp_prepare mm/page_alloc.c:1490 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358
 free_unref_page_list+0x663/0x900 mm/page_alloc.c:3499
 release_pages+0x2836/0x2b40 mm/swap.c:1055
 __pagevec_release+0x80/0xf0 mm/swap.c:1075
 pagevec_release include/linux/pagevec.h:71 [inline]
 folio_batch_release include/linux/pagevec.h:135 [inline]
 truncate_inode_pages_range+0x48a/0x1340 mm/truncate.c:373
 ext4_punch_hole+0x4f1/0xd00 fs/ext4/inode.c:4089
 ext4_fallocate+0x30b/0x2160 fs/ext4/extents.c:4708
 vfs_fallocate+0x547/0x6b0 fs/open.c:323
 do_vfs_ioctl+0x222c/0x2a90 fs/ioctl.c:849
 __do_sys_ioctl fs/ioctl.c:868 [inline]
 __se_sys_ioctl+0x81/0x160 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88806c500f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88806c500f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88806c501000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                                 ^
 ffff88806c501080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88806c501100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/01/03 15:26 linux-6.1.y a507f147e6f0 fb427a07 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: out-of-bounds Read in ext4_ext_remove_space
2024/06/06 05:12 linux-6.1.y 88690811da69 121701b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: out-of-bounds Read in ext4_ext_remove_space
* Struck through repros no longer work on HEAD.