[v6.1] KASAN: out-of-bounds Read in ext4_xattr_set_entry

9 views
Skip to first unread message

syzbot

unread,
May 19, 2023, 4:42:56 AM5/19/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: fa74641fb6b9 Linux 6.1.29
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17a226ee280000
kernel config: https://syzkaller.appspot.com/x/.config?x=fac5c36c2b16009f
dashboard link: https://syzkaller.appspot.com/bug?extid=924d24c2471f965fe5e3
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12e5e26a280000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/3e78f005d7f8/disk-fa74641f.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6527fcf66401/vmlinux-fa74641f.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c5e0d5f8b434/bzImage-fa74641f.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/e6762d30cd18/mount_0.gz

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

==================================================================
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
==================================================================


---
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 change 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