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

2 views
Skip to first unread message

syzbot

unread,
Sep 20, 2023, 8:55:54 AM9/20/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: a356197db198 Linux 6.1.54
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1137b8f2680000
kernel config: https://syzkaller.appspot.com/x/.config?x=86626d0659ddddaf
dashboard link: https://syzkaller.appspot.com/bug?extid=8b7ccedfe329e7d8e63c
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/c61f5c33e733/disk-a356197d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f3643a8f0c53/vmlinux-a356197d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a3fcbc0d79f3/bzImage-a356197d.xz

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

loop1: detected capacity change from 0 to 32768
==================================================================
BUG: KASAN: use-after-free in drop_metapage fs/jfs/jfs_metapage.c:223 [inline]
BUG: KASAN: use-after-free in release_metapage+0x60a/0x9b0 fs/jfs/jfs_metapage.c:757
Read of size 8 at addr ffff8880a583c6f0 by task syz-executor.1/30402

CPU: 1 PID: 30402 Comm: syz-executor.1 Not tainted 6.1.54-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/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
drop_metapage fs/jfs/jfs_metapage.c:223 [inline]
release_metapage+0x60a/0x9b0 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+0x69f/0xe50 fs/jfs/xattr.c:280
ea_put fs/jfs/xattr.c:610 [inline]
__jfs_setxattr+0xa35/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:309
do_setxattr fs/xattr.c:594 [inline]
setxattr+0x250/0x2b0 fs/xattr.c:617
path_setxattr+0x1bc/0x2a0 fs/xattr.c:636
__do_sys_setxattr fs/xattr.c:652 [inline]
__se_sys_setxattr fs/xattr.c:648 [inline]
__x64_sys_setxattr+0xb7/0xd0 fs/xattr.c:648
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:0x7f4b38a7cae9
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:00007f4b375fe0c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000bc
RAX: ffffffffffffffda RBX: 00007f4b38b9bf80 RCX: 00007f4b38a7cae9
RDX: 00000000200003c0 RSI: 0000000020000400 RDI: 0000000020000340
RBP: 00007f4b38ac847a R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000e407 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f4b38b9bf80 R15: 00007ffc77267ed8
</TASK>

Allocated by task 30402:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
__kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328
kasan_slab_alloc include/linux/kasan.h:201 [inline]
slab_post_alloc_hook+0x50/0x370 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+0x10c/0x2d0 mm/slub.c:3422
mempool_alloc+0x190/0x580 mm/mempool.c:392
alloc_metapage fs/jfs/jfs_metapage.c:176 [inline]
__get_metapage+0x570/0x10e0 fs/jfs/jfs_metapage.c:651
ea_write+0x633/0xe50 fs/jfs/xattr.c:256
ea_put fs/jfs/xattr.c:610 [inline]
__jfs_setxattr+0xa35/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:309
do_setxattr fs/xattr.c:594 [inline]
setxattr+0x250/0x2b0 fs/xattr.c:617
path_setxattr+0x1bc/0x2a0 fs/xattr.c:636
__do_sys_setxattr fs/xattr.c:652 [inline]
__se_sys_setxattr fs/xattr.c:648 [inline]
__x64_sys_setxattr+0xb7/0xd0 fs/xattr.c:648
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

Freed by task 110:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
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+0x292/0x510 mm/slub.c:3683
free_metapage fs/jfs/jfs_metapage.c:191 [inline]
metapage_release_folio+0x5c8/0x730 fs/jfs/jfs_metapage.c:551
shrink_folio_list+0x2872/0x8ee0 mm/vmscan.c:1996
evict_folios+0xb42/0x2810 mm/vmscan.c:5039
lru_gen_shrink_lruvec mm/vmscan.c:5223 [inline]
shrink_lruvec+0xdbf/0x4650 mm/vmscan.c:5918

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

The buggy address belongs to the physical page:
page:ffffea0002960f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xa583c
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0002ad4c00 dead00000000000a ffff888147a9b500
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 7315, tgid 7297 (syz-executor.5), ts 1580407317125, free_ts 1577396105059
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
alloc_slab_page+0x6a/0x150 mm/slub.c:1794
allocate_slab mm/slub.c:1939 [inline]
new_slab+0x84/0x2d0 mm/slub.c:1992
___slab_alloc+0xa71/0x1080 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
slab_alloc mm/slub.c:3406 [inline]
__kmem_cache_alloc_lru mm/slub.c:3413 [inline]
kmem_cache_alloc+0x1a5/0x2d0 mm/slub.c:3422
mempool_alloc+0x190/0x580 mm/mempool.c:392
alloc_metapage fs/jfs/jfs_metapage.c:176 [inline]
__get_metapage+0x570/0x10e0 fs/jfs/jfs_metapage.c:651
ea_write+0x633/0xe50 fs/jfs/xattr.c:256
ea_put fs/jfs/xattr.c:610 [inline]
__jfs_setxattr+0xa35/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:309
do_setxattr fs/xattr.c:594 [inline]
setxattr+0x250/0x2b0 fs/xattr.c:617
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+0x98/0x570 mm/page_alloc.c:3484
__vunmap+0x834/0x9a0 mm/vmalloc.c:2717
free_work+0x57/0x80 mm/vmalloc.c:97
process_one_work+0x8aa/0x11f0 kernel/workqueue.c:2292
worker_thread+0xa5f/0x1210 kernel/workqueue.c:2439
kthread+0x26e/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Memory state around the buggy address:
ffff8880a583c580: fb fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb
ffff8880a583c600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a583c680: fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb
^
ffff8880a583c700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880a583c780: fc fc fc fc fc fc fc fc fa 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 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,
Dec 29, 2023, 7:55:13 AM12/29/23
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