syzbot


KASAN: out-of-bounds Read in ext4_xattr_set_entry

Status: upstream: reported C repro on 2024/05/13 18:18
Bug presence: origin:lts
[Documentation on labels]
Reported-by: syzbot+7b995704ecf34efc252c@syzkaller.appspotmail.com
First crash: 144d, last: 15d
Bug presence (2)
Date Name Commit Repro Result
2024/05/14 lts (merge base) 883d1a956208 C [report] KASAN: out-of-bounds Read in ext4_xattr_set_entry
2024/05/14 upstream (ToT) a5131c3fdf26 C Didn't crash
Similar bugs (15)
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 1118d 1577d 1/1 fixed on 2021/10/13 07:23
android-5-15 KASAN: out-of-bounds Read in ext4_xattr_set_entry 1 474d 474d 0/2 auto-obsoleted due to no activity on 2023/09/17 07:02
upstream KASAN: out-of-bounds Read in ext4_xattr_set_entry ext4 C 30 3h23m 13d 0/28 upstream: reported C repro on 2024/09/22 00:16
android-54 KASAN: out-of-bounds Read in ext4_xattr_set_entry ext4 C 14 528d 1293d 0/2 auto-obsoleted due to no activity on 2023/08/23 09:06
linux-6.1 KASAN: out-of-bounds Read in ext4_xattr_set_entry origin:upstream missing-backport syz unreliable 7 10d 505d 0/3 upstream: reported syz repro on 2023/05/19 08:42
android-5-10 KASAN: out-of-bounds Read in ext4_xattr_set_entry C inconclusive 2 2d19h 381d 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 758d 1272d 0/1 upstream: reported C repro on 2021/04/12 14:20
android-5-15 general protection fault in ext4_xattr_set_entry C error 1 582d 662d 2/2 fixed on 2023/03/28 12:29
android-5-10 general protection fault in ext4_xattr_set_entry (4) C error 62 486d 515d 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 521d 721d 2/2 fixed on 2023/05/03 13:06
upstream KASAN: use-after-free Read in ext4_xattr_set_entry (5) ext4 2 802d 861d 0/28 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 516d 519d 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 957d 1344d 20/28 fixed on 2022/03/28 10:17
android-5-10 general protection fault in ext4_xattr_set_entry C error 2 743d 758d 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 483d 485d 2/2 fixed on 2023/06/13 02:27
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/05/27 18:35 12m retest repro android14-6.1 report log
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2024/09/20 00:28 2h02m bisect fix android14-6.1 OK (0) job log log
2024/08/16 14:46 1h18m bisect fix android14-6.1 OK (0) job log log
2024/07/06 11:23 1h04m bisect fix android14-6.1 OK (0) job log log

Sample crash report:
loop0: detected capacity change from 0 to 512
==================================================================
BUG: KASAN: out-of-bounds in ext4_xattr_set_entry+0x13c0/0x3ef0 fs/ext4/xattr.c:1732
Read of size 18446744073709551584 at addr ffff888122b72fc8 by task syz-executor245/2813

CPU: 1 PID: 2813 Comm: syz-executor245 Not tainted 6.1.75-syzkaller-00003-g4d55129aea65 #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+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x158/0x4e0 mm/kasan/report.c:427
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189
 memmove+0x2d/0x70 mm/kasan/shadow.c:54
 ext4_xattr_set_entry+0x13c0/0x3ef0 fs/ext4/xattr.c:1732
 ext4_xattr_ibody_set+0x124/0x390 fs/ext4/xattr.c:2237
 ext4_xattr_move_to_block fs/ext4/xattr.c:2624 [inline]
 ext4_xattr_make_inode_space fs/ext4/xattr.c:2692 [inline]
 ext4_expand_extra_isize_ea+0x1147/0x1c40 fs/ext4/xattr.c:2784
 __ext4_expand_extra_isize+0x31a/0x420 fs/ext4/inode.c:5921
 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5964 [inline]
 __ext4_mark_inode_dirty+0x4bb/0x7d0 fs/ext4/inode.c:6042
 ext4_inline_data_truncate+0x552/0xd60 fs/ext4/inline.c:2031
 ext4_truncate+0x337/0xfb0 fs/ext4/inode.c:4235
 ext4_process_orphan+0x1d3/0x2f0 fs/ext4/orphan.c:339
 ext4_orphan_cleanup+0xa50/0x11b0 fs/ext4/orphan.c:474
 __ext4_fill_super fs/ext4/super.c:5520 [inline]
 ext4_fill_super+0x7d46/0x8460 fs/ext4/super.c:5651
 get_tree_bdev+0x440/0x680 fs/super.c:1357
 ext4_get_tree+0x1c/0x20 fs/ext4/super.c:5681
 vfs_get_tree+0x88/0x290 fs/super.c:1564
 do_new_mount+0x2ba/0xb30 fs/namespace.c:3051
 path_mount+0x671/0x1070 fs/namespace.c:3381
 do_mount fs/namespace.c:3394 [inline]
 __do_sys_mount fs/namespace.c:3602 [inline]
 __se_sys_mount+0x2c4/0x3b0 fs/namespace.c:3579
 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3579
 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:0x7f22e15d522a
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 5e 04 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007f22e1590048 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00000000200000c0 RCX: 00007f22e15d522a
RDX: 0000000020000180 RSI: 00000000200000c0 RDI: 00007f22e15900a0
RBP: 0000000020000180 R08: 00007f22e15900e0 R09: 00007f22e15900e0
R10: 0000000000000000 R11: 0000000000000202 R12: 00007f22e15900e0
R13: 000000000000046a R14: 0000000000000000 R15: 0000000020000300
 </TASK>

The buggy address belongs to the physical page:
page:ffffea00048adc80 refcount:3 mapcount:1 mapping:ffff88810bc2d850 index:0x1 pfn:0x122b72
memcg:ffff888100360000
aops:def_blk_aops ino:700000
flags: 0x660000000002205e(referenced|uptodate|dirty|lru|workingset|private|mappedtodisk|zone=1)
raw: 660000000002205e ffffea0004407108 ffffea0004436b48 ffff88810bc2d850
raw: 0000000000000001 ffff88810b7f60a8 0000000300000000 ffff888100360000
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 2814, tgid 2812 (syz-executor245), ts 61930659462, free_ts 61927931968
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2597
 get_page_from_freelist+0x27ea/0x2870 mm/page_alloc.c:4425
 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5712
 __folio_alloc+0x15/0x40 mm/page_alloc.c:5744
 __folio_alloc_node include/linux/gfp.h:245 [inline]
 folio_alloc include/linux/gfp.h:274 [inline]
 filemap_alloc_folio include/linux/pagemap.h:507 [inline]
 page_cache_ra_unbounded+0x2a4/0x690 mm/readahead.c:259
 do_page_cache_ra mm/readahead.c:311 [inline]
 page_cache_ra_order+0x92f/0xb40 mm/readahead.c:571
 do_sync_mmap_readahead+0x97c/0xcc0 mm/filemap.c:3128
 filemap_fault+0x744/0x11a0 mm/filemap.c:3220
 __do_fault mm/memory.c:4308 [inline]
 do_read_fault mm/memory.c:4663 [inline]
 do_fault+0xbde/0x19e0 mm/memory.c:4799
 handle_pte_fault mm/memory.c:5096 [inline]
 __handle_mm_fault mm/memory.c:5238 [inline]
 handle_mm_fault+0x184a/0x2f40 mm/memory.c:5378
 faultin_page mm/gup.c:1009 [inline]
 __get_user_pages+0x377/0xf20 mm/gup.c:1233
 populate_vma_page_range mm/gup.c:1590 [inline]
 __mm_populate+0x375/0x570 mm/gup.c:1704
 mm_populate include/linux/mm.h:3052 [inline]
 vm_mmap_pgoff+0x290/0x430 mm/util.c:530
 ksys_mmap_pgoff+0x15d/0x1e0 mm/mmap.c:1521
 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:93 [inline]
 __se_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline]
 __x64_sys_mmap+0x103/0x120 arch/x86/kernel/sys_x86_64.c:86
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1498 [inline]
 free_pcp_prepare mm/page_alloc.c:1572 [inline]
 free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3498
 free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3594
 free_the_page mm/page_alloc.c:798 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5801
 __free_slab+0xce/0x1a0 mm/slub.c:2039
 free_slab mm/slub.c:2054 [inline]
 discard_slab+0x29/0x40 mm/slub.c:2060
 __slab_free+0x205/0x280 mm/slub.c:3597
 do_slab_free mm/slub.c:3638 [inline]
 ___cache_free+0xc6/0xd0 mm/slub.c:3691
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0xc5/0x140 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:310
 kasan_slab_alloc include/linux/kasan.h:202 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
 slab_alloc_node mm/slub.c:3421 [inline]
 slab_alloc mm/slub.c:3429 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3436 [inline]
 kmem_cache_alloc+0x175/0x2c0 mm/slub.c:3445
 getname_flags+0xba/0x520 fs/namei.c:139
 user_path_at_empty+0x2d/0x1a0 fs/namei.c:2905
 do_readlinkat+0x114/0x3a0 fs/stat.c:468
 __do_sys_readlink fs/stat.c:501 [inline]
 __se_sys_readlink fs/stat.c:498 [inline]
 __x64_sys_readlink+0x7f/0x90 fs/stat.c:498

Memory state around the buggy address:
 ffff888122b72e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888122b72f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888122b72f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                              ^
 ffff888122b73000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888122b73080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
EXT4-fs error (device loop0): ext4_xattr_ibody_find:2213: inode #12: comm syz-executor245: corrupted in-inode xattr
EXT4-fs warning (device loop0): ext4_xattr_set_entry:1745: inode #12: comm syz-executor245: unable to update i_inline_off
EXT4-fs warning (device loop0): ext4_expand_extra_isize_ea:2810: Unable to expand inode 12. Delete some EAs or run e2fsck.
EXT4-fs (loop0): 1 truncate cleaned up
EXT4-fs mount: 52 callbacks suppressed
EXT4-fs (loop0): mounted filesystem without journal. Quota mode: writeback.

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/13 18:17 android14-6.1 4d55129aea65 9026e142 .config strace log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro #1] [mounted in repro #2] ci2-android-6-1 KASAN: out-of-bounds Read in ext4_xattr_set_entry
* Struck through repros no longer work on HEAD.