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

11 views
Skip to first unread message

syzbot

unread,
Sep 19, 2023, 10:41:01 PM9/19/23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: a27512601c2d Merge 5.10.194 into android13-5.10-lts
git tree: android13-5.10-lts
console+strace: https://syzkaller.appspot.com/x/log.txt?x=169f1f54680000
kernel config: https://syzkaller.appspot.com/x/.config?x=c1c2ce51f851d2f6
dashboard link: https://syzkaller.appspot.com/bug?extid=9b8029e222e845c4480b
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=12fb8364680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14f26c6a680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/da4c10f4a7cd/disk-a2751260.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/4d65589a1227/vmlinux-a2751260.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a8c5b14df758/bzImage-a2751260.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/a5bfa93c4a13/mount_0.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/6e960ed6e8a3/mount_2.gz
mounted in repro #3: https://storage.googleapis.com/syzbot-assets/dc4965a5053f/mount_4.gz

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

==================================================================
BUG: KASAN: out-of-bounds in ext4_xattr_set_entry+0x1277/0x3a90 fs/ext4/xattr.c:1747
Read of size 18446744073709551552 at addr ffff88811c3252e8 by task syz-executor567/16160

CPU: 0 PID: 16160 Comm: syz-executor567 Not tainted 5.10.194-syzkaller-00508-ga27512601c2d #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
print_address_description+0x81/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:435 [inline]
kasan_report+0x179/0x1c0 mm/kasan/report.c:452
kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
memmove+0x2d/0x70 mm/kasan/shadow.c:54
ext4_xattr_set_entry+0x1277/0x3a90 fs/ext4/xattr.c:1747
ext4_xattr_ibody_set+0x124/0x390 fs/ext4/xattr.c:2228
ext4_xattr_set_handle+0xc26/0x14e0 fs/ext4/xattr.c:2385
ext4_xattr_set+0x231/0x3d0 fs/ext4/xattr.c:2498
ext4_xattr_trusted_set+0x3b/0x50 fs/ext4/xattr_trusted.c:37
__vfs_setxattr+0x404/0x450 fs/xattr.c:177
__vfs_setxattr_noperm+0x11d/0x4f0 fs/xattr.c:208
__vfs_setxattr_locked+0x1f9/0x210 fs/xattr.c:266
vfs_setxattr+0x112/0x2c0 fs/xattr.c:283
setxattr+0x1ea/0x3f0 fs/xattr.c:548
path_setxattr+0x169/0x240 fs/xattr.c:567
__do_sys_setxattr fs/xattr.c:582 [inline]
__se_sys_setxattr fs/xattr.c:578 [inline]
__x64_sys_setxattr+0xc5/0xe0 fs/xattr.c:578
do_syscall_64+0x34/0x70
entry_SYSCALL_64_after_hwframe+0x61/0xc6
RIP: 0033:0x7fbc673511c9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 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:00007fbc5ef2c218 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc
RAX: ffffffffffffffda RBX: 00007fbc673d96d8 RCX: 00007fbc673511c9
RDX: 0000000000000000 RSI: 0000000020000240 RDI: 00000000200002c0
RBP: 00007fbc673d96d0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fbc673a5a90
R13: 0031656c69662f2e R14: 00007ffcb1f7dc20 R15: 6f6f6c2f7665642f

The buggy address belongs to the page:
page:ffffea000470c940 refcount:3 mapcount:0 mapping:ffff88810044ad10 index:0x2 pfn:0x11c325
aops:def_blk_aops ino:0
flags: 0x4000000000002026(referenced|uptodate|active|private)
raw: 4000000000002026 dead000000000100 dead000000000122 ffff88810044ad10
raw: 0000000000000002 ffff88811f84e9d8 00000003ffffffff ffff888100144000
page dumped because: kasan: bad access detected
page->mem_cgroup:ffff888100144000
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 16157, ts 321218578083, free_ts 321215858150
set_page_owner include/linux/page_owner.h:35 [inline]
post_alloc_hook mm/page_alloc.c:2456 [inline]
prep_new_page+0x166/0x180 mm/page_alloc.c:2462
get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
__alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5346
__alloc_pages include/linux/gfp.h:544 [inline]
__alloc_pages_node include/linux/gfp.h:557 [inline]
alloc_pages_node include/linux/gfp.h:571 [inline]
alloc_pages include/linux/gfp.h:590 [inline]
__page_cache_alloc include/linux/pagemap.h:290 [inline]
pagecache_get_page+0x669/0x950 mm/filemap.c:1848
find_or_create_page include/linux/pagemap.h:402 [inline]
grow_dev_page fs/buffer.c:976 [inline]
grow_buffers fs/buffer.c:1045 [inline]
__getblk_slow fs/buffer.c:1072 [inline]
__getblk_gfp+0x221/0x7e0 fs/buffer.c:1370
sb_getblk include/linux/buffer_head.h:361 [inline]
__ext4_get_inode_loc+0x4c2/0xbf0 fs/ext4/inode.c:4431
__ext4_get_inode_loc_noinmem fs/ext4/inode.c:4541 [inline]
__ext4_iget+0x516/0x41f0 fs/ext4/inode.c:4766
ext4_orphan_get+0x1e3/0x630 fs/ext4/ialloc.c:1391
ext4_orphan_cleanup+0x696/0xd50 fs/ext4/super.c:3083
ext4_fill_super+0x888c/0x9150 fs/ext4/super.c:5075
mount_bdev+0x262/0x370 fs/super.c:1429
ext4_mount+0x34/0x40 fs/ext4/super.c:6626
legacy_get_tree+0xf1/0x190 fs/fs_context.c:593
vfs_get_tree+0x88/0x290 fs/super.c:1559
do_new_mount+0x28b/0xad0 fs/namespace.c:2899
path_mount+0x56f/0xcb0 fs/namespace.c:3229
page last free stack trace:
reset_page_owner include/linux/page_owner.h:28 [inline]
free_pages_prepare mm/page_alloc.c:1349 [inline]
free_pcp_prepare mm/page_alloc.c:1421 [inline]
free_unref_page_prepare+0x2ae/0x2d0 mm/page_alloc.c:3336
free_unref_page_list+0x122/0xb20 mm/page_alloc.c:3443
release_pages+0xea0/0xef0 mm/swap.c:1103
free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:356
tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
tlb_flush_mmu mm/mmu_gather.c:247 [inline]
tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:326
unmap_region+0x31c/0x370 mm/mmap.c:2807
__do_munmap+0x699/0x8c0 mm/mmap.c:3036
__vm_munmap mm/mmap.c:3059 [inline]
__do_sys_munmap mm/mmap.c:3085 [inline]
__se_sys_munmap+0x120/0x1a0 mm/mmap.c:3081
__x64_sys_munmap+0x5b/0x70 mm/mmap.c:3081
do_syscall_64+0x34/0x70
entry_SYSCALL_64_after_hwframe+0x61/0xc6

Memory state around the buggy address:
ffff88811c325180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88811c325200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88811c325280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff88811c325300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff88811c325380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
EXT4-fs warning (device loop0): ext4_update_dynamic_rev:1047: updating to rev 1 because of new feature flag, running e2fsck is recommended


---
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 bug is already fixed, 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 bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, 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