[Android 6.1] KASAN: out-of-bounds Read in ext4_xattr_set_entry

2 views
Skip to first unread message

syzbot

unread,
May 13, 2024, 2:18:40 PMMay 13
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 4d55129aea65 UPSTREAM: crypto: x86/curve25519 - disable gcov
git tree: android14-6.1
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1291d598980000
kernel config: https://syzkaller.appspot.com/x/.config?x=4a340f281ebc7608
dashboard link: https://syzkaller.appspot.com/bug?extid=7b995704ecf34efc252c
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14a14100980000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14dfb220980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a8e23b3a85b8/disk-4d55129a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c7d768734df0/vmlinux-4d55129a.xz
kernel image: https://storage.googleapis.com/syzbot-assets/2c636465af27/bzImage-4d55129a.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/099521e5e481/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/e8760a8238af/mount_5.gz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+7b9957...@syzkaller.appspotmail.com

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.


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages