[v6.1] KASAN: use-after-free Read in release_metapage (2)

0 views
Skip to first unread message

syzbot

unread,
May 2, 2024, 1:44:30 AMMay 2
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: dcbc050cb0d3 Linux 6.1.89
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15c68508980000
kernel config: https://syzkaller.appspot.com/x/.config?x=64d62dbbe99e136b
dashboard link: https://syzkaller.appspot.com/bug?extid=8c3eb1c2604e62f1e28d
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2f2d9a291fdb/disk-dcbc050c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5ecf467e0c49/vmlinux-dcbc050c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/78f74d050dba/Image-dcbc050c.gz.xz

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

ERROR: (device loop3): release_metapage: write_one_page() failed
ERROR: (device loop3): remounting filesystem as read-only
==================================================================
BUG: KASAN: use-after-free in drop_metapage fs/jfs/jfs_metapage.c:223 [inline]
BUG: KASAN: use-after-free in release_metapage+0x70c/0xc84 fs/jfs/jfs_metapage.c:757
Read of size 8 at addr ffff0000ca096120 by task syz-executor.3/5438

CPU: 0 PID: 5438 Comm: syz-executor.3 Not tainted 6.1.89-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x174/0x4c0 mm/kasan/report.c:395
kasan_report+0xd4/0x130 mm/kasan/report.c:495
__asan_report_load8_noabort+0x2c/0x38 mm/kasan/report_generic.c:351
drop_metapage fs/jfs/jfs_metapage.c:223 [inline]
release_metapage+0x70c/0xc84 fs/jfs/jfs_metapage.c:757
write_metapage fs/jfs/jfs_metapage.h:75 [inline]
flush_metapage fs/jfs/jfs_metapage.h:81 [inline]
ea_write+0x50c/0xba0 fs/jfs/xattr.c:280
ea_put fs/jfs/xattr.c:610 [inline]
__jfs_setxattr+0xc10/0x1338 fs/jfs/xattr.c:783
__jfs_xattr_set+0xf8/0x190 fs/jfs/xattr.c:917
jfs_xattr_set+0x58/0x70 fs/jfs/xattr.c:941
__vfs_setxattr+0x388/0x3a4 fs/xattr.c:182
__vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:216
__vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:277
vfs_setxattr+0x1a8/0x344 fs/xattr.c:309
do_setxattr fs/xattr.c:594 [inline]
setxattr+0x230/0x294 fs/xattr.c:617
path_setxattr+0x17c/0x258 fs/xattr.c:636
__do_sys_setxattr fs/xattr.c:652 [inline]
__se_sys_setxattr fs/xattr.c:648 [inline]
__arm64_sys_setxattr+0xbc/0xd8 fs/xattr.c:648
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Allocated by task 5438:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
__kasan_slab_alloc+0x74/0x8c mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x74/0x458 mm/slab.h:737
slab_alloc_node mm/slub.c:3398 [inline]
slab_alloc mm/slub.c:3406 [inline]
__kmem_cache_alloc_lru mm/slub.c:3413 [inline]
kmem_cache_alloc+0x230/0x37c mm/slub.c:3422
mempool_alloc_slab+0x58/0x74 mm/mempool.c:512
mempool_alloc+0x150/0x48c mm/mempool.c:392
alloc_metapage fs/jfs/jfs_metapage.c:176 [inline]
__get_metapage+0x618/0x1050 fs/jfs/jfs_metapage.c:651
ea_write+0x49c/0xba0 fs/jfs/xattr.c:256
ea_put fs/jfs/xattr.c:610 [inline]
__jfs_setxattr+0xc10/0x1338 fs/jfs/xattr.c:783
__jfs_xattr_set+0xf8/0x190 fs/jfs/xattr.c:917
jfs_xattr_set+0x58/0x70 fs/jfs/xattr.c:941
__vfs_setxattr+0x388/0x3a4 fs/xattr.c:182
__vfs_setxattr_noperm+0x110/0x528 fs/xattr.c:216
__vfs_setxattr_locked+0x1ec/0x218 fs/xattr.c:277
vfs_setxattr+0x1a8/0x344 fs/xattr.c:309
do_setxattr fs/xattr.c:594 [inline]
setxattr+0x230/0x294 fs/xattr.c:617
path_setxattr+0x17c/0x258 fs/xattr.c:636
__do_sys_setxattr fs/xattr.c:652 [inline]
__se_sys_setxattr fs/xattr.c:648 [inline]
__arm64_sys_setxattr+0xbc/0xd8 fs/xattr.c:648
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

Freed by task 5448:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
__kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
kasan_slab_free include/linux/kasan.h:177 [inline]
slab_free_hook mm/slub.c:1724 [inline]
slab_free_freelist_hook mm/slub.c:1750 [inline]
slab_free mm/slub.c:3661 [inline]
kmem_cache_free+0x2f0/0x588 mm/slub.c:3683
mempool_free_slab+0x28/0x38 mm/mempool.c:519
mempool_free+0xbc/0x2e0 mm/mempool.c:501
free_metapage fs/jfs/jfs_metapage.c:191 [inline]
metapage_release_folio+0x448/0x5b4 fs/jfs/jfs_metapage.c:551
metapage_invalidate_folio+0x140/0x1d8 fs/jfs/jfs_metapage.c:563
folio_invalidate mm/truncate.c:158 [inline]
truncate_cleanup_folio+0x174/0x2e0 mm/truncate.c:178
truncate_inode_pages_range+0x244/0xf10 mm/truncate.c:368
truncate_inode_pages+0x2c/0x3c mm/truncate.c:451
jfs_remount+0x2dc/0x594 fs/jfs/super.c:451
legacy_reconfigure+0xfc/0x114 fs/fs_context.c:655
reconfigure_super+0x318/0x7a4 fs/super.c:966
vfs_fsconfig_locked fs/fsopen.c:254 [inline]
__do_sys_fsconfig fs/fsopen.c:439 [inline]
__se_sys_fsconfig fs/fsopen.c:314 [inline]
__arm64_sys_fsconfig+0xa1c/0xd18 fs/fsopen.c:314
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

The buggy address belongs to the object at ffff0000ca0960f8
which belongs to the cache jfs_mp of size 184
The buggy address is located 40 bytes inside of
184-byte region [ffff0000ca0960f8, ffff0000ca0961b0)

The buggy address belongs to the physical page:
page:000000004e8a40f7 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10a096
flags: 0x5ffe00000000200(slab|node=0|zone=2|lastcpupid=0xfff)
raw: 05ffe00000000200 0000000000000000 dead000000000001 ffff0000c6ee7c80
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000ca096000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000ca096080: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa
>ffff0000ca096100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000ca096180: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb
ffff0000ca096200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


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