[v5.15] KASAN: use-after-free Read in release_metapage

1 view
Skip to first unread message

syzbot

unread,
Oct 12, 2023, 5:38:52 AM10/12/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 02e21884dcf2 Linux 5.15.135
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=179851e9680000
kernel config: https://syzkaller.appspot.com/x/.config?x=e4cc6ae646bdb7fa
dashboard link: https://syzkaller.appspot.com/bug?extid=a8c74787380be2a19813
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/070649b789aa/disk-02e21884.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b4dc88e68ad3/vmlinux-02e21884.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3bf6aaa2a543/bzImage-02e21884.xz

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

loop3: detected capacity change from 0 to 32768
==================================================================
BUG: KASAN: use-after-free in drop_metapage fs/jfs/jfs_metapage.c:222 [inline]
BUG: KASAN: use-after-free in release_metapage+0x829/0xe00 fs/jfs/jfs_metapage.c:758
Read of size 8 at addr ffff888022b7dad0 by task syz-executor.3/7866

CPU: 1 PID: 7866 Comm: syz-executor.3 Not tainted 5.15.135-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/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+0x63/0x3b0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
drop_metapage fs/jfs/jfs_metapage.c:222 [inline]
release_metapage+0x829/0xe00 fs/jfs/jfs_metapage.c:758
write_metapage fs/jfs/jfs_metapage.h:75 [inline]
flush_metapage fs/jfs/jfs_metapage.h:81 [inline]
ea_put fs/jfs/xattr.c:614 [inline]
__jfs_setxattr+0xad5/0x11d0 fs/jfs/xattr.c:783
__jfs_xattr_set+0xf5/0x180 fs/jfs/xattr.c:917
__vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
__vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
vfs_setxattr+0x21d/0x420 fs/xattr.c:303
do_setxattr fs/xattr.c:588 [inline]
setxattr+0x27e/0x2e0 fs/xattr.c:611
path_setxattr+0x1bc/0x2a0 fs/xattr.c:630
__do_sys_lsetxattr fs/xattr.c:653 [inline]
__se_sys_lsetxattr fs/xattr.c:649 [inline]
__x64_sys_lsetxattr+0xb4/0xd0 fs/xattr.c:649
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:0x7faa76f2fae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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:00007faa754b10c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd
RAX: ffffffffffffffda RBX: 00007faa7704ef80 RCX: 00007faa76f2fae9
RDX: 0000000000000000 RSI: 0000000020001d00 RDI: 0000000020001cc0
RBP: 00007faa76f7b47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007faa7704ef80 R15: 00007fff41b0dd88
</TASK>

Allocated by task 7866:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
__kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
mempool_alloc+0x17f/0x590 mm/mempool.c:393
alloc_metapage fs/jfs/jfs_metapage.c:175 [inline]
__get_metapage+0x672/0x1070 fs/jfs/jfs_metapage.c:652
ea_get+0xb3b/0x1280 fs/jfs/xattr.c:526
__jfs_setxattr+0x4b6/0x11d0 fs/jfs/xattr.c:718
__jfs_xattr_set+0xf5/0x180 fs/jfs/xattr.c:917
__vfs_setxattr+0x3e7/0x420 fs/xattr.c:182
__vfs_setxattr_noperm+0x12a/0x5e0 fs/xattr.c:216
vfs_setxattr+0x21d/0x420 fs/xattr.c:303
do_setxattr fs/xattr.c:588 [inline]
setxattr+0x27e/0x2e0 fs/xattr.c:611
path_setxattr+0x1bc/0x2a0 fs/xattr.c:630
__do_sys_lsetxattr fs/xattr.c:653 [inline]
__se_sys_lsetxattr fs/xattr.c:649 [inline]
__x64_sys_lsetxattr+0xb4/0xd0 fs/xattr.c:649
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

Freed by task 7887:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
kasan_slab_free include/linux/kasan.h:230 [inline]
slab_free_hook mm/slub.c:1705 [inline]
slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
slab_free mm/slub.c:3499 [inline]
kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
free_metapage fs/jfs/jfs_metapage.c:190 [inline]
metapage_releasepage+0x5cb/0x730 fs/jfs/jfs_metapage.c:552
fallback_migrate_page mm/migrate.c:865 [inline]
move_to_new_page+0x5c9/0xde0 mm/migrate.c:908
__unmap_and_move mm/migrate.c:1073 [inline]
unmap_and_move mm/migrate.c:1214 [inline]
migrate_pages+0x1fa1/0x3470 mm/migrate.c:1491
compact_zone+0x1ddb/0x4330 mm/compaction.c:2424
compact_node+0x27d/0x610 mm/compaction.c:2708
compact_nodes mm/compaction.c:2724 [inline]
sysctl_compaction_handler+0xa7/0x150 mm/compaction.c:2766
proc_sys_call_handler+0x541/0x8a0 fs/proc/proc_sysctl.c:587
do_iter_readv_writev+0x594/0x7a0
do_iter_write+0x1ea/0x760 fs/read_write.c:855
iter_file_splice_write+0x806/0xfa0 fs/splice.c:689
do_splice_from fs/splice.c:767 [inline]
direct_splice_actor+0xe3/0x1c0 fs/splice.c:936
splice_direct_to_actor+0x500/0xc10 fs/splice.c:891
do_splice_direct+0x285/0x3d0 fs/splice.c:979
do_sendfile+0x625/0xff0 fs/read_write.c:1249
__do_sys_sendfile64 fs/read_write.c:1311 [inline]
__se_sys_sendfile64+0xfc/0x1e0 fs/read_write.c:1303
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

The buggy address belongs to the object at ffff888022b7daa8
which belongs to the cache jfs_mp of size 184
The buggy address is located 40 bytes inside of
184-byte region [ffff888022b7daa8, ffff888022b7db60)
The buggy address belongs to the page:
page:ffffea00008adf40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22b7d
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff888018b9ab40
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x192800(GFP_NOWAIT|__GFP_NOWARN|__GFP_NORETRY|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 7866, ts 337660237956, free_ts 337558514695
prep_new_page mm/page_alloc.c:2426 [inline]
get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
__alloc_pages+0x272/0x700 mm/page_alloc.c:5421
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
mempool_alloc+0x17f/0x590 mm/mempool.c:393
alloc_metapage fs/jfs/jfs_metapage.c:175 [inline]
__get_metapage+0x672/0x1070 fs/jfs/jfs_metapage.c:652
diReadSpecial+0x259/0x680 fs/jfs/jfs_imap.c:444
jfs_mount+0x71/0x830 fs/jfs/jfs_mount.c:87
jfs_fill_super+0x5ba/0xc70 fs/jfs/super.c:561
mount_bdev+0x2c9/0x3f0 fs/super.c:1387
legacy_get_tree+0xeb/0x180 fs/fs_context.c:611
vfs_get_tree+0x88/0x270 fs/super.c:1517
do_new_mount+0x28b/0xae0 fs/namespace.c:2994
do_mount fs/namespace.c:3337 [inline]
__do_sys_mount fs/namespace.c:3545 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1340 [inline]
free_pcp_prepare mm/page_alloc.c:1391 [inline]
free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
free_slab mm/slub.c:2015 [inline]
discard_slab mm/slub.c:2021 [inline]
__unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
do_slab_free mm/slub.c:3487 [inline]
___cache_free+0xe3/0x100 mm/slub.c:3506
qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
__kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
kasan_slab_alloc include/linux/kasan.h:254 [inline]
slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
slab_alloc_node mm/slub.c:3220 [inline]
slab_alloc mm/slub.c:3228 [inline]
kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
getname_flags+0xb8/0x4e0 fs/namei.c:138
do_sys_openat2+0xd2/0x500 fs/open.c:1205
do_sys_open fs/open.c:1227 [inline]
__do_sys_openat fs/open.c:1243 [inline]
__se_sys_openat fs/open.c:1238 [inline]
__x64_sys_openat+0x243/0x290 fs/open.c:1238
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

Memory state around the buggy address:
ffff888022b7d980: fc fc fc fc fc fc 00 00 00 00 00 00 00 00 00 00
ffff888022b7da00: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
>ffff888022b7da80: fc fc fc fc fc fa fb fb fb fb fb fb fb fb fb fb
^
ffff888022b7db00: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff888022b7db80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


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

syzbot

unread,
Jan 20, 2024, 4:39:11 AMJan 20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages