[v5.15] KASAN: use-after-free Read in siw_query_port (2)

0 views
Skip to first unread message

syzbot

unread,
Dec 13, 2023, 5:42:26 PM12/13/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d0fc081c6241 Linux 5.15.143
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=109337fae80000
kernel config: https://syzkaller.appspot.com/x/.config?x=ffd22c928742e176
dashboard link: https://syzkaller.appspot.com/bug?extid=15a94a0531011bda93cc
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/c315e9d55a2d/disk-d0fc081c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/0543a2c39d86/vmlinux-d0fc081c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b6820cee1703/bzImage-d0fc081c.xz

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

netdevsim0 speed is unknown, defaulting to 1000
==================================================================
BUG: KASAN: use-after-free in siw_query_port+0x342/0x430 drivers/infiniband/sw/siw/siw_verbs.c:175
Read of size 4 at addr ffff88802a3480d8 by task kworker/0:8/3611

CPU: 0 PID: 3611 Comm: kworker/0:8 Not tainted 5.15.143-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Workqueue: infiniband ib_cache_event_task
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
siw_query_port+0x342/0x430 drivers/infiniband/sw/siw/siw_verbs.c:175
ib_cache_update+0x1a8/0xaf0 drivers/infiniband/core/cache.c:1481
ib_cache_event_task+0xef/0x1e0 drivers/infiniband/core/cache.c:1555
process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
kthread+0x3f6/0x4f0 kernel/kthread.c:319
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
</TASK>

Allocated by task 3537:
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]
__kmalloc_node+0x199/0x390 mm/slub.c:4455
kmalloc_node include/linux/slab.h:614 [inline]
kvmalloc_node+0x80/0x140 mm/util.c:619
kvmalloc include/linux/mm.h:805 [inline]
kvzalloc include/linux/mm.h:813 [inline]
alloc_netdev_mqs+0x85/0xc10 net/core/dev.c:10837
nsim_create+0x78/0x3e0 drivers/net/netdevsim/netdev.c:350
__nsim_dev_port_add+0x6de/0xb90 drivers/net/netdevsim/dev.c:1312
nsim_dev_port_add_all+0x35/0x110 drivers/net/netdevsim/dev.c:1372
nsim_dev_probe+0x752/0x9f0 drivers/net/netdevsim/dev.c:1513
really_probe+0x24e/0xb60 drivers/base/dd.c:595
__driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:755
driver_probe_device+0x50/0x420 drivers/base/dd.c:785
__device_attach_driver+0x2b9/0x500 drivers/base/dd.c:907
bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
__device_attach+0x359/0x570 drivers/base/dd.c:979
bus_probe_device+0xba/0x1e0 drivers/base/bus.c:487
device_add+0xb48/0xfd0 drivers/base/core.c:3394
nsim_bus_dev_new drivers/net/netdevsim/bus.c:435 [inline]
new_device_store+0x471/0x910 drivers/net/netdevsim/bus.c:302
kernfs_fop_write_iter+0x3a2/0x4f0 fs/kernfs/file.c:296
call_write_iter include/linux/fs.h:2146 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0xacf/0xe50 fs/read_write.c:594
ksys_write+0x1a2/0x2c0 fs/read_write.c:647
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 7623:
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
device_release+0x91/0x1c0
kobject_cleanup lib/kobject.c:713 [inline]
kobject_release lib/kobject.c:744 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x224/0x460 lib/kobject.c:761
__nsim_dev_port_del+0x153/0x1b0 drivers/net/netdevsim/dev.c:1349
nsim_dev_port_del_all drivers/net/netdevsim/dev.c:1362 [inline]
nsim_dev_reload_destroy+0x15e/0x240 drivers/net/netdevsim/dev.c:1561
nsim_dev_remove+0x59/0x100 drivers/net/netdevsim/dev.c:1577
__device_release_driver drivers/base/dd.c:1227 [inline]
device_release_driver_internal+0x4cb/0x7f0 drivers/base/dd.c:1262
bus_remove_device+0x2e5/0x400 drivers/base/bus.c:529
device_del+0x6e2/0xbd0 drivers/base/core.c:3582
device_unregister+0x1c/0xc0 drivers/base/core.c:3615
nsim_bus_dev_del drivers/net/netdevsim/bus.c:454 [inline]
del_device_store+0x321/0x470 drivers/net/netdevsim/bus.c:354
kernfs_fop_write_iter+0x3a2/0x4f0 fs/kernfs/file.c:296
call_write_iter include/linux/fs.h:2146 [inline]
new_sync_write fs/read_write.c:507 [inline]
vfs_write+0xacf/0xe50 fs/read_write.c:594
ksys_write+0x1a2/0x2c0 fs/read_write.c:647
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 ffff88802a348000
which belongs to the cache kmalloc-cg-8k of size 8192
The buggy address is located 216 bytes inside of
8192-byte region [ffff88802a348000, ffff88802a34a000)
The buggy address belongs to the page:
page:ffffea0000a8d200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2a348
head:ffffea0000a8d200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888011c4c3c0
raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3537, ts 100684034693, 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: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]
__kmalloc_node+0x1fa/0x390 mm/slub.c:4451
kmalloc_node include/linux/slab.h:614 [inline]
kvmalloc_node+0x80/0x140 mm/util.c:619
kvmalloc include/linux/mm.h:805 [inline]
kvzalloc include/linux/mm.h:813 [inline]
alloc_netdev_mqs+0x85/0xc10 net/core/dev.c:10837
nsim_create+0x78/0x3e0 drivers/net/netdevsim/netdev.c:350
__nsim_dev_port_add+0x6de/0xb90 drivers/net/netdevsim/dev.c:1312
nsim_dev_port_add_all+0x35/0x110 drivers/net/netdevsim/dev.c:1372
nsim_dev_probe+0x752/0x9f0 drivers/net/netdevsim/dev.c:1513
really_probe+0x24e/0xb60 drivers/base/dd.c:595
__driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:755
driver_probe_device+0x50/0x420 drivers/base/dd.c:785
__device_attach_driver+0x2b9/0x500 drivers/base/dd.c:907
bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
page_owner free stack trace missing

Memory state around the buggy address:
ffff88802a347f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88802a348000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802a348080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88802a348100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802a348180: 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