syzbot


KASAN: out-of-bounds Read in ext4_xattr_set_entry

Status: upstream: reported syz repro on 2023/05/19 08:42
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+924d24c2471f965fe5e3@syzkaller.appspotmail.com
First crash: 371d, last: 8d02h
Fix bisection: the issue occurs on the latest tested release (bisect log)
Crash: WARNING in ext4_da_update_reserve_space (log)
Repro: syz .config
  
Bug presence (3)
Date Name Commit Repro Result
2023/07/08 linux-6.1.y (ToT) 61fd484b2cf6 C [report] INFO: rcu detected stall in corrupted
2023/05/20 upstream (ToT) d635f6cc934b C [report] WARNING in ext4_da_update_reserve_space
2023/07/08 upstream (ToT) 8689f4f2ea56 C Didn't crash
Similar bugs (14)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in ext4_xattr_set_entry (2) C done 7 984d 1442d 1/1 fixed on 2021/10/13 07:23
android-5-15 KASAN: out-of-bounds Read in ext4_xattr_set_entry 1 340d 340d 0/2 auto-obsoleted due to no activity on 2023/09/17 07:02
android-54 KASAN: out-of-bounds Read in ext4_xattr_set_entry ext4 C 14 393d 1159d 0/2 auto-obsoleted due to no activity on 2023/08/23 09:06
android-5-10 KASAN: out-of-bounds Read in ext4_xattr_set_entry C inconclusive 1 37d 247d 0/2 upstream: reported C repro on 2023/09/20 02:40
linux-4.14 KASAN: out-of-bounds Read in ext4_xattr_set_entry C error 2 623d 1137d 0/1 upstream: reported C repro on 2021/04/12 14:20
android-6-1 KASAN: out-of-bounds Read in ext4_xattr_set_entry origin:lts C 1 10d 10d 0/2 upstream: reported C repro on 2024/05/13 18:18
android-5-15 general protection fault in ext4_xattr_set_entry C error 1 448d 528d 2/2 fixed on 2023/03/28 12:29
android-5-10 general protection fault in ext4_xattr_set_entry (4) C error 62 351d 380d 2/2 fixed on 2023/06/07 17:22
android-5-10 general protection fault in ext4_xattr_set_entry (2) ext4 C error 423 386d 586d 2/2 fixed on 2023/05/03 13:06
upstream KASAN: use-after-free Read in ext4_xattr_set_entry (5) ext4 2 668d 726d 0/26 auto-obsoleted due to no activity on 2022/11/22 17:19
android-5-10 general protection fault in ext4_xattr_set_entry (3) C error 9 382d 385d 2/2 fixed on 2023/05/08 19:06
upstream KASAN: use-after-free Read in ext4_xattr_set_entry (4) ext4 C error done 21 822d 1209d 20/26 fixed on 2022/03/28 10:17
android-5-10 general protection fault in ext4_xattr_set_entry C error 2 609d 623d 0/2 closed as invalid on 2022/09/26 18:30
android-5-10 general protection fault in ext4_xattr_set_entry (5) C done 11 348d 350d 2/2 fixed on 2023/06/13 02:27
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2023/11/03 13:20 5h40m fix candidate upstream job log (1)
2023/06/19 08:59 45m bisect fix linux-6.1.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: out-of-bounds in ext4_xattr_set_entry+0x11dd/0x3c00 fs/ext4/xattr.c:1749
Read of size 18446744073709551580 at addr ffff8880276351cc by task syz-executor.4/5459

CPU: 1 PID: 5459 Comm: syz-executor.4 Not tainted 6.1.29-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/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_xattr_set_entry+0x11dd/0x3c00 fs/ext4/xattr.c:1749
 ext4_xattr_ibody_set+0x11d/0x330 fs/ext4/xattr.c:2238
 ext4_destroy_inline_data_nolock+0x20e/0x610 fs/ext4/inline.c:451
 ext4_destroy_inline_data+0x7e/0xe0 fs/ext4/inline.c:1886
 ext4_writepages+0x6ae/0x3de0 fs/ext4/inode.c:2747
 do_writepages+0x3a2/0x670 mm/page-writeback.c:2469
 filemap_fdatawrite_wbc+0x121/0x180 mm/filemap.c:388
 __filemap_fdatawrite_range mm/filemap.c:421 [inline]
 __filemap_fdatawrite mm/filemap.c:427 [inline]
 filemap_flush+0x11a/0x170 mm/filemap.c:454
 ext4_convert_inline_data+0x1a1/0x610 fs/ext4/inline.c:2055
 ext4_fallocate+0x149/0x2160 fs/ext4/extents.c:4702
 vfs_fallocate+0x547/0x6b0 fs/open.c:323
 ksys_fallocate fs/open.c:346 [inline]
 __do_sys_fallocate fs/open.c:354 [inline]
 __se_sys_fallocate fs/open.c:352 [inline]
 __x64_sys_fallocate+0xb9/0x100 fs/open.c:352
 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+0x63/0xcd
RIP: 0033:0x7f3700c8c169
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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:00007f3701a17168 EFLAGS: 00000246 ORIG_RAX: 000000000000011d
RAX: ffffffffffffffda RBX: 00007f3700dac120 RCX: 00007f3700c8c169
RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00007f3700ce7ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000008000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffd8a9fcf2f R14: 00007f3701a17300 R15: 0000000000022000
 </TASK>

The buggy address belongs to the physical page:
page:ffffea00009d8d40 refcount:2 mapcount:0 mapping:ffff888012896af8 index:0x3 pfn:0x27635
memcg:ffff888140160000
aops:def_blk_aops ino:700004
flags: 0xfff38000022056(referenced|uptodate|lru|workingset|private|mappedtodisk|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff38000022056 ffffea00008cd288 ffffea0000846308 ffff888012896af8
raw: 0000000000000003 ffff8880739afcb0 00000002ffffffff ffff888140160000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x152c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 3549, tgid 3549 (udevd), ts 153991730540, free_ts 153777865953
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533
 prep_new_page mm/page_alloc.c:2540 [inline]
 get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559
 folio_alloc+0x1a/0x50 mm/mempolicy.c:2290
 filemap_alloc_folio+0xda/0x4f0 mm/filemap.c:971
 page_cache_ra_unbounded+0x1ee/0x7b0 mm/readahead.c:248
 do_page_cache_ra mm/readahead.c:300 [inline]
 force_page_cache_ra mm/readahead.c:331 [inline]
 page_cache_sync_ra+0x3c5/0x480 mm/readahead.c:705
 page_cache_sync_readahead include/linux/pagemap.h:1213 [inline]
 filemap_get_pages mm/filemap.c:2582 [inline]
 filemap_read+0x7fa/0x31d0 mm/filemap.c:2676
 blkdev_read_iter+0x3e1/0x520 block/fops.c:613
 call_read_iter include/linux/fs.h:2199 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x7de/0xbe0 fs/read_write.c:470
 ksys_read+0x19c/0x2c0 fs/read_write.c:613
 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+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1460 [inline]
 free_pcp_prepare mm/page_alloc.c:1510 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388
 free_unref_page_list+0x107/0x810 mm/page_alloc.c:3530
 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]
 invalidate_mapping_pagevec+0x621/0x730 mm/truncate.c:543
 ext4_put_super+0x938/0x10f0 fs/ext4/super.c:1273
 generic_shutdown_super+0x130/0x340 fs/super.c:501
 kill_block_super+0x7a/0xe0 fs/super.c:1450
 deactivate_locked_super+0xa0/0x110 fs/super.c:332
 cleanup_mnt+0x490/0x520 fs/namespace.c:1186
 task_work_run+0x246/0x300 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204
 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
 syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:297
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff888027635080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888027635100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888027635180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                              ^
 ffff888027635200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888027635280: 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
2023/05/19 08:42 linux-6.1.y fa74641fb6b9 3bb7af1d .config console log report syz [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan KASAN: out-of-bounds Read in ext4_xattr_set_entry
2024/05/16 06:34 linux-6.1.y 909ba1f1b414 ef5d53ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: out-of-bounds Read in ext4_xattr_set_entry
* Struck through repros no longer work on HEAD.