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

0 views
Skip to first unread message

syzbot

unread,
May 14, 2024, 6:14:33 AMMay 14
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 284087d4f7d5 Linux 5.15.158
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13e290cc980000
kernel config: https://syzkaller.appspot.com/x/.config?x=b0dd54e4b5171ebc
dashboard link: https://syzkaller.appspot.com/bug?extid=06188e6668171e84a55e
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/c2e33c1db6bf/disk-284087d4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d9f77284af1d/vmlinux-284087d4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a600323dd149/bzImage-284087d4.xz

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

==================================================================
BUG: KASAN: use-after-free in lbmIODone+0x135b/0x1750 fs/jfs/jfs_logmgr.c:2194
Read of size 4 at addr ffff888015bc2108 by task ksoftirqd/1/20

CPU: 1 PID: 20 Comm: ksoftirqd/1 Not tainted 5.15.158-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 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
lbmIODone+0x135b/0x1750 fs/jfs/jfs_logmgr.c:2194
req_bio_endio block/blk-core.c:261 [inline]
blk_update_request+0x87c/0x1470 block/blk-core.c:1441
blk_mq_end_request+0x3a/0x70 block/blk-mq.c:575
blk_complete_reqs block/blk-mq.c:587 [inline]
blk_done_softirq+0xf2/0x130 block/blk-mq.c:592
__do_softirq+0x3b3/0x93a kernel/softirq.c:558
run_ksoftirqd+0xc1/0x120 kernel/softirq.c:921
smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300
</TASK>

Allocated by task 7456:
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_kmalloc+0xba/0xf0 mm/kasan/common.c:513
kasan_kmalloc include/linux/kasan.h:264 [inline]
kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247
kmalloc include/linux/slab.h:591 [inline]
lbmLogInit fs/jfs/jfs_logmgr.c:1830 [inline]
lmLogInit+0x3b0/0x1c90 fs/jfs/jfs_logmgr.c:1278
open_inline_log fs/jfs/jfs_logmgr.c:1183 [inline]
lmLogOpen+0x552/0x1030 fs/jfs/jfs_logmgr.c:1077
jfs_mount_rw+0xe3/0x640 fs/jfs/jfs_mount.c:253
jfs_fill_super+0x69f/0xc70 fs/jfs/super.c:570
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+0x2ba/0xb40 fs/namespace.c:3005
do_mount fs/namespace.c:3348 [inline]
__do_sys_mount fs/namespace.c:3556 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3533
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 6638:
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]
kfree+0xf1/0x270 mm/slub.c:4559
lbmLogShutdown fs/jfs/jfs_logmgr.c:1873 [inline]
lmLogShutdown+0x500/0x960 fs/jfs/jfs_logmgr.c:1692
lmLogClose+0x293/0x530 fs/jfs/jfs_logmgr.c:1468
jfs_umount+0x298/0x370 fs/jfs/jfs_umount.c:116
jfs_put_super+0x86/0x180 fs/jfs/super.c:194
generic_shutdown_super+0x136/0x2c0 fs/super.c:475
kill_block_super+0x7a/0xe0 fs/super.c:1414
deactivate_locked_super+0xa0/0x110 fs/super.c:335
cleanup_mnt+0x44e/0x500 fs/namespace.c:1143
task_work_run+0x129/0x1a0 kernel/task_work.c:164
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
__syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x66/0xd0

Last potentially related work creation:
kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
kvfree_call_rcu+0x118/0x8a0 kernel/rcu/tree.c:3596
ipmr_rules_exit+0x1d5/0x1f0 net/ipv4/ipmr.c:281
ops_exit_list net/core/net_namespace.c:169 [inline]
cleanup_net+0x6ce/0xb60 net/core/net_namespace.c:596
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:334
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300

The buggy address belongs to the object at ffff888015bc2100
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 8 bytes inside of
192-byte region [ffff888015bc2100, ffff888015bc21c0)
The buggy address belongs to the page:
page:ffffea000056f080 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x15bc2
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888011c41a00
raw: 0000000000000000 0000000000100010 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 2309092990, free_ts 0
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:5423
alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2031
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]
__kmalloc_track_caller+0x1c7/0x300 mm/slub.c:4925
__do_krealloc mm/slab_common.c:1217 [inline]
krealloc+0x4b/0xc0 mm/slab_common.c:1250
add_sysfs_param+0xca/0x7f0 kernel/params.c:651
kernel_add_sysfs_param+0xb0/0x130 kernel/params.c:812
param_sysfs_builtin+0x16a/0x1f0 kernel/params.c:851
param_sysfs_init+0x66/0x70 kernel/params.c:970
do_one_initcall+0x22b/0x7a0 init/main.c:1302
do_initcall_level+0x157/0x210 init/main.c:1375
do_initcalls+0x49/0x90 init/main.c:1391
kernel_init_freeable+0x425/0x5c0 init/main.c:1615
kernel_init+0x19/0x290 init/main.c:1506
page_owner free stack trace missing

Memory state around the buggy address:
ffff888015bc2000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888015bc2080: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888015bc2100: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888015bc2180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888015bc2200: fa 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