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

0 views
Skip to first unread message

syzbot

unread,
Apr 6, 2024, 6:58:25 PMApr 6
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 347385861c50 Linux 6.1.84
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14a28339180000
kernel config: https://syzkaller.appspot.com/x/.config?x=40dfd13b04bfc094
dashboard link: https://syzkaller.appspot.com/bug?extid=017af8f97c88bb5fff58
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/73d2a8622b6e/disk-34738586.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e7bc2e0101a7/vmlinux-34738586.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7b96d1168608/bzImage-34738586.xz

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

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

CPU: 0 PID: 15 Comm: ksoftirqd/0 Not tainted 6.1.84-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
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
lbmIODone+0x135b/0x1750 fs/jfs/jfs_logmgr.c:2179
req_bio_endio block/blk-mq.c:777 [inline]
blk_update_request+0x53b/0x1010 block/blk-mq.c:922
blk_mq_end_request+0x3a/0x70 block/blk-mq.c:1051
blk_complete_reqs block/blk-mq.c:1131 [inline]
blk_done_softirq+0xf8/0x140 block/blk-mq.c:1136
__do_softirq+0x2e9/0xa4c kernel/softirq.c:571
run_ksoftirqd+0xc1/0x120 kernel/softirq.c:934
smpboot_thread_fn+0x52c/0xa30 kernel/smpboot.c:164
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:307
</TASK>

Allocated by task 3945:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:556 [inline]
lbmLogInit fs/jfs/jfs_logmgr.c:1822 [inline]
lmLogInit+0x3b0/0x1c90 fs/jfs/jfs_logmgr.c:1270
open_inline_log fs/jfs/jfs_logmgr.c:1175 [inline]
lmLogOpen+0x552/0x1030 fs/jfs/jfs_logmgr.c:1069
jfs_mount_rw+0xe3/0x640 fs/jfs/jfs_mount.c:253
jfs_fill_super+0x67d/0xc40 fs/jfs/super.c:565
mount_bdev+0x2c9/0x3f0 fs/super.c:1432
legacy_get_tree+0xeb/0x180 fs/fs_context.c:632
vfs_get_tree+0x88/0x270 fs/super.c:1562
do_new_mount+0x2ba/0xb40 fs/namespace.c:3051
do_mount fs/namespace.c:3394 [inline]
__do_sys_mount fs/namespace.c:3602 [inline]
__se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3579
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 3568:
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+0x25c/0x3c0 mm/slub.c:3674
lbmLogShutdown fs/jfs/jfs_logmgr.c:1865 [inline]
lmLogShutdown+0x500/0x960 fs/jfs/jfs_logmgr.c:1684
lmLogClose+0x293/0x530 fs/jfs/jfs_logmgr.c:1460
jfs_umount+0x298/0x370 fs/jfs/jfs_umount.c:116
jfs_put_super+0x86/0x180 fs/jfs/super.c:194
generic_shutdown_super+0x130/0x340 fs/super.c:501
kill_block_super+0x7a/0xe0 fs/super.c:1459
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+0xde/0x100 kernel/entry/common.c:177
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x63/0xcd

Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
insert_work+0x54/0x3d0 kernel/workqueue.c:1361
__queue_work+0xb4b/0xf90 kernel/workqueue.c:1520
queue_work_on+0x14b/0x250 kernel/workqueue.c:1548
queue_work include/linux/workqueue.h:512 [inline]
netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:659 [inline]
netdevice_event+0x8ed/0xa00 drivers/infiniband/core/roce_gid_mgmt.c:802
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
call_netdevice_notifiers_info net/core/dev.c:1970 [inline]
call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
call_netdevice_notifiers+0x145/0x1b0 net/core/dev.c:2022
register_netdevice+0x12f2/0x1720 net/core/dev.c:10132
veth_newlink+0x7fc/0xc70 drivers/net/veth.c:1775
rtnl_newlink_create net/core/rtnetlink.c:3390 [inline]
__rtnl_newlink net/core/rtnetlink.c:3610 [inline]
rtnl_newlink+0x14e3/0x2050 net/core/rtnetlink.c:3623
rtnetlink_rcv_msg+0x818/0xff0 net/core/rtnetlink.c:6121
netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508
netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352
netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
__sys_sendto+0x480/0x600 net/socket.c:2148
__do_sys_sendto net/socket.c:2160 [inline]
__se_sys_sendto net/socket.c:2156 [inline]
__x64_sys_sendto+0xda/0xf0 net/socket.c:2156
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888015ae3300
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 8 bytes inside of
192-byte region [ffff888015ae3300, ffff888015ae33c0)

The buggy address belongs to the physical page:
page:ffffea000056b8c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x15ae3
flags: 0xfff80000000200(slab|node=0|zone=1|lastcpupid=0xfff)
raw: 00fff80000000200 dead000000000100 dead000000000122 ffff888012441a00
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, tgid 1 (swapper/0), ts 3601051091, free_ts 0
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
prep_new_page mm/page_alloc.c:2520 [inline]
get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
__alloc_pages+0x28d/0x770 mm/page_alloc.c:5547
alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2115
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+0xc20/0x1270 mm/slub.c:3180
__slab_alloc mm/slub.c:3279 [inline]
slab_alloc_node mm/slub.c:3364 [inline]
__kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
kmalloc_trace+0x26/0xe0 mm/slab_common.c:1045
kmalloc include/linux/slab.h:556 [inline]
kzalloc include/linux/slab.h:692 [inline]
call_usermodehelper_setup+0x8a/0x260 kernel/umh.c:366
kobject_uevent_env+0x688/0x8c0 lib/kobject_uevent.c:614
kernel_add_sysfs_param+0x106/0x126 kernel/params.c:816
param_sysfs_builtin+0x16a/0x1e2 kernel/params.c:851
param_sysfs_init+0x66/0x6a kernel/params.c:970
do_one_initcall+0x265/0x8f0 init/main.c:1297
do_initcall_level+0x157/0x207 init/main.c:1370
page_owner free stack trace missing

Memory state around the buggy address:
ffff888015ae3200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888015ae3280: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888015ae3300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888015ae3380: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888015ae3400: 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 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