syzbot


KASAN: out-of-bounds Read in ext4_xattr_set_entry

Status: auto-obsoleted due to no activity on 2023/09/17 07:02
Reported-by: syzbot+22ca0caa9bb090b6d64c@syzkaller.appspotmail.com
First crash: 313d, last: 313d
Similar bugs (13)
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 958d 1416d 1/1 fixed on 2021/10/13 07:23
android-54 KASAN: out-of-bounds Read in ext4_xattr_set_entry ext4 C 14 367d 1133d 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 1 313d 344d 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 1 11d 221d 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 597d 1111d 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 422d 502d 2/2 fixed on 2023/03/28 12:29
android-5-10 general protection fault in ext4_xattr_set_entry (4) C error 62 325d 354d 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 360d 560d 2/2 fixed on 2023/05/03 13:06
upstream KASAN: use-after-free Read in ext4_xattr_set_entry (5) ext4 2 642d 700d 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 356d 359d 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 796d 1183d 20/26 fixed on 2022/03/28 10:17
android-5-10 general protection fault in ext4_xattr_set_entry C error 2 583d 597d 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 322d 324d 2/2 fixed on 2023/06/13 02:27

Sample crash report:
==================================================================
BUG: KASAN: out-of-bounds in ext4_xattr_set_entry+0x108c/0x3a40 fs/ext4/xattr.c:1757
Read of size 18446744073709551572 at addr ffff88817a986050 by task syz-executor.2/14256

CPU: 1 PID: 14256 Comm: syz-executor.2 Tainted: G        W         5.15.106-syzkaller-00266-g36f4f6fb72d5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
 memmove+0x2d/0x70 mm/kasan/shadow.c:54
 ext4_xattr_set_entry+0x108c/0x3a40 fs/ext4/xattr.c:1757
 ext4_xattr_block_set+0x6b0/0x37a0 fs/ext4/xattr.c:1923
 ext4_xattr_set_handle+0xdac/0x1560 fs/ext4/xattr.c:2407
 ext4_xattr_set+0x231/0x3d0 fs/ext4/xattr.c:2508
 ext4_xattr_trusted_set+0x3c/0x50 fs/ext4/xattr_trusted.c:38
 __vfs_setxattr+0x3ed/0x440 fs/xattr.c:182
 __vfs_setxattr_noperm+0x126/0x5e0 fs/xattr.c:216
 __vfs_setxattr_locked+0x215/0x230 fs/xattr.c:277
 vfs_setxattr+0x21d/0x420 fs/xattr.c:303
 do_setxattr fs/xattr.c:588 [inline]
 setxattr+0x27e/0x2e0 fs/xattr.c:611
 __do_sys_fsetxattr fs/xattr.c:667 [inline]
 __se_sys_fsetxattr+0x18d/0x200 fs/xattr.c:656
 __x64_sys_fsetxattr+0xbf/0xd0 fs/xattr.c:656
 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:0x7f7225b74389
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:00007f721c506168 EFLAGS: 00000246 ORIG_RAX: 00000000000000be
RAX: ffffffffffffffda RBX: 00007f7225c94050 RCX: 00007f7225b74389
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000005
RBP: 00007f7225bbf493 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffea016a9af R14: 00007f721c506300 R15: 0000000000022000
 </TASK>

The buggy address belongs to the page:
page:ffffea0005ea6180 refcount:3 mapcount:0 mapping:ffff8881091c9d18 index:0x13 pfn:0x17a986
memcg:ffff88816a43c000
aops:def_blk_aops ino:700002
flags: 0x4000000000002037(locked|referenced|uptodate|lru|active|private|zone=1)
raw: 4000000000002037 ffffea0005e2a448 ffff88816a42f030 ffff8881091c9d18
raw: 0000000000000013 ffff88817283ef18 00000003ffffffff ffff88816a43c000
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 14228, ts 1097262634913, free_ts 1097063080902
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2595
 prep_new_page mm/page_alloc.c:2601 [inline]
 get_page_from_freelist+0x2eab/0x2f80 mm/page_alloc.c:4394
 __alloc_pages+0x386/0x7b0 mm/page_alloc.c:5679
 __alloc_pages_node include/linux/gfp.h:591 [inline]
 alloc_pages_node include/linux/gfp.h:605 [inline]
 alloc_pages include/linux/gfp.h:618 [inline]
 __page_cache_alloc include/linux/pagemap.h:305 [inline]
 pagecache_get_page+0xb18/0xeb0 mm/filemap.c:1940
 find_or_create_page include/linux/pagemap.h:418 [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+0x21e/0x7c0 fs/buffer.c:1336
 sb_getblk_gfp include/linux/buffer_head.h:368 [inline]
 __ext4_sb_bread_gfp+0x74/0x220 fs/ext4/super.c:210
 ext4_sb_bread+0x2a/0x40 fs/ext4/super.c:227
 ext4_xattr_block_get fs/ext4/xattr.c:557 [inline]
 ext4_xattr_get+0x1e9/0x810 fs/ext4/xattr.c:680
 ext4_xattr_security_get+0x32/0x40 fs/ext4/xattr_security.c:20
 __vfs_getxattr+0x3c3/0x3f0 fs/xattr.c:401
 inode_doinit_use_xattr+0xa8/0x3d0 security/selinux/hooks.c:1393
 inode_doinit_with_dentry+0x883/0x1070 security/selinux/hooks.c:1515
 selinux_d_instantiate+0x27/0x40 security/selinux/hooks.c:6455
 security_d_instantiate+0x9f/0x100 security/security.c:2056
 d_splice_alias+0x6d/0x390 fs/dcache.c:3064
 ext4_lookup+0x549/0xaa0 fs/ext4/namei.c:1863
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1466 [inline]
 free_pcp_prepare mm/page_alloc.c:1538 [inline]
 free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3502
 free_unref_page_list+0x14b/0xa60 mm/page_alloc.c:3633
 release_pages+0x1310/0x1370 mm/swap.c:1009
 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:320
 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
 tlb_flush_mmu+0xd0/0x180 mm/mmu_gather.c:247
 zap_pte_range mm/memory.c:1504 [inline]
 zap_pmd_range mm/memory.c:1553 [inline]
 zap_pud_range mm/memory.c:1582 [inline]
 zap_p4d_range mm/memory.c:1603 [inline]
 unmap_page_range+0x1a96/0x1ca0 mm/memory.c:1624
 unmap_single_vma mm/memory.c:1669 [inline]
 unmap_vmas+0x389/0x560 mm/memory.c:1701
 exit_mmap+0x3d8/0x6f0 mm/mmap.c:3209
 __mmput+0x95/0x310 kernel/fork.c:1171
 mmput+0x5b/0x170 kernel/fork.c:1194
 exit_mm kernel/exit.c:551 [inline]
 do_exit+0xbb4/0x2b60 kernel/exit.c:862
 do_group_exit+0x141/0x310 kernel/exit.c:997
 get_signal+0x7a3/0x1630 kernel/signal.c:2891
 arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:865
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:172
 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:208

Memory state around the buggy address:
 ffff88817a985f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88817a985f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88817a986000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                                 ^
 ffff88817a986080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88817a986100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
EXT4-fs warning (device loop2): ext4_update_dynamic_rev:1051: updating to rev 1 because of new feature flag, running e2fsck is recommended

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/19 06:52 android13-5.15-lts 36f4f6fb72d5 f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: out-of-bounds Read in ext4_xattr_set_entry
* Struck through repros no longer work on HEAD.