KASAN: null-ptr-deref Write in vhci_shutdown_connection

20 views
Skip to first unread message

syzbot

unread,
Dec 20, 2020, 1:44:13 PM12/20/20
to gre...@linuxfoundation.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, sh...@kernel.org, syzkall...@googlegroups.com, valentin...@gmail.com
Hello,

syzbot found the following issue on:

HEAD commit: 5e60366d Merge tag 'fallthrough-fixes-clang-5.11-rc1' of g..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13f05613500000
kernel config: https://syzkaller.appspot.com/x/.config?x=503d0089cd701d6d
dashboard link: https://syzkaller.appspot.com/bug?extid=a93fba6d384346a761e3
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14d0d8c5500000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1058e41f500000

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

vhci_hcd: stop threads
vhci_hcd: release socket
vhci_hcd: disconnect device
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: null-ptr-deref in atomic_fetch_add_relaxed include/asm-generic/atomic-instrumented.h:142 [inline]
BUG: KASAN: null-ptr-deref in __refcount_add include/linux/refcount.h:193 [inline]
BUG: KASAN: null-ptr-deref in __refcount_inc include/linux/refcount.h:250 [inline]
BUG: KASAN: null-ptr-deref in refcount_inc include/linux/refcount.h:267 [inline]
BUG: KASAN: null-ptr-deref in get_task_struct include/linux/sched/task.h:102 [inline]
BUG: KASAN: null-ptr-deref in kthread_stop+0x90/0x760 kernel/kthread.c:591
Write of size 4 at addr 0000000000000024 by task kworker/u4:2/46

CPU: 0 PID: 46 Comm: kworker/u4:2 Not tainted 5.10.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usbip_event event_handler
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x107/0x163 lib/dump_stack.c:120
__kasan_report mm/kasan/report.c:549 [inline]
kasan_report.cold+0x5/0x37 mm/kasan/report.c:562
check_memory_region_inline mm/kasan/generic.c:186 [inline]
check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
atomic_fetch_add_relaxed include/asm-generic/atomic-instrumented.h:142 [inline]
__refcount_add include/linux/refcount.h:193 [inline]
__refcount_inc include/linux/refcount.h:250 [inline]
refcount_inc include/linux/refcount.h:267 [inline]
get_task_struct include/linux/sched/task.h:102 [inline]
kthread_stop+0x90/0x760 kernel/kthread.c:591
vhci_shutdown_connection+0x17f/0x340 drivers/usb/usbip/vhci_hcd.c:1021
event_handler+0x1f0/0x4f0 drivers/usb/usbip/usbip_event.c:78
process_one_work+0x98d/0x1630 kernel/workqueue.c:2275
worker_thread+0x64c/0x1120 kernel/workqueue.c:2421
kthread+0x3b1/0x4a0 kernel/kthread.c:292
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296
==================================================================
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 46 Comm: kworker/u4:2 Tainted: G B 5.10.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usbip_event event_handler
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x107/0x163 lib/dump_stack.c:120
panic+0x343/0x77f kernel/panic.c:231
end_report+0x58/0x5e mm/kasan/report.c:106
__kasan_report mm/kasan/report.c:552 [inline]
kasan_report.cold+0xd/0x37 mm/kasan/report.c:562
check_memory_region_inline mm/kasan/generic.c:186 [inline]
check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
atomic_fetch_add_relaxed include/asm-generic/atomic-instrumented.h:142 [inline]
__refcount_add include/linux/refcount.h:193 [inline]
__refcount_inc include/linux/refcount.h:250 [inline]
refcount_inc include/linux/refcount.h:267 [inline]
get_task_struct include/linux/sched/task.h:102 [inline]
kthread_stop+0x90/0x760 kernel/kthread.c:591
vhci_shutdown_connection+0x17f/0x340 drivers/usb/usbip/vhci_hcd.c:1021
event_handler+0x1f0/0x4f0 drivers/usb/usbip/usbip_event.c:78
process_one_work+0x98d/0x1630 kernel/workqueue.c:2275
worker_thread+0x64c/0x1120 kernel/workqueue.c:2421
kthread+0x3b1/0x4a0 kernel/kthread.c:292
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
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.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Hillf Danton

unread,
Dec 21, 2020, 5:07:11 AM12/21/20
to syzbot, gre...@linuxfoundation.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, sh...@kernel.org, syzkall...@googlegroups.com, valentin...@gmail.com
Sun, 20 Dec 2020 10:44:12 -0800
> syzbot found the following issue on:
>
> HEAD commit: 5e60366d Merge tag 'fallthrough-fixes-clang-5.11-rc1' of g..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=13f05613500000
> kernel config: https://syzkaller.appspot.com/x/.config?x=503d0089cd701d6d
> dashboard link: https://syzkaller.appspot.com/bug?extid=a93fba6d384346a761e3
> compiler: gcc (GCC) 10.1.0-syz 20200507
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14d0d8c5500000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1058e41f500000
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+a93fba...@syzkaller.appspotmail.com
>
> vhci_hcd: stop threads
> vhci_hcd: release socket
> vhci_hcd: disconnect device
> ==================================================================
> BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
> BUG: KASAN: null-ptr-deref in atomic_fetch_add_relaxed include/asm-generic/atomic-instrumented.h:142 [inline]
> BUG: KASAN: null-ptr-deref in __refcount_add include/linux/refcount.h:193 [inline]
> BUG: KASAN: null-ptr-deref in __refcount_inc include/linux/refcount.h:250 [inline]
> BUG: KASAN: null-ptr-deref in refcount_inc include/linux/refcount.h:267 [inline]
> BUG: KASAN: null-ptr-deref in get_task_struct include/linux/sched/task.h:102 [inline]
> BUG: KASAN: null-ptr-deref in kthread_stop+0x90/0x760 kernel/kthread.c:591
> Write of size 4 at addr 0000000000000024 by task kworker/u4:2/46

The report looks really weird. Lets test if kworker is innocent with
the attached diff. It simply rules the simple case out.
--- a/drivers/usb/usbip/vhci_sysfs.c
+++ b/drivers/usb/usbip/vhci_sysfs.c
@@ -389,7 +389,9 @@ static ssize_t attach_store(struct devic
/* end the lock */

vdev->ud.tcp_rx = kthread_get_run(vhci_rx_loop, &vdev->ud, "vhci_rx");
+ BUG_ON(IS_ERR(vdev->ud.tcp_rx));
vdev->ud.tcp_tx = kthread_get_run(vhci_tx_loop, &vdev->ud, "vhci_tx");
+ BUG_ON(IS_ERR(vdev->ud.tcp_tx));

rh_port_connect(vdev, speed);

慕冬亮

unread,
Jan 19, 2021, 10:08:54 PM1/19/21
to syzkaller-bugs
#syz dup: KASAN: null-ptr-deref Write in event_handler

syzbot

unread,
Jan 19, 2021, 10:08:57 PM1/19/21
to 慕冬亮, mudongl...@gmail.com, syzkall...@googlegroups.com
> #syz dup: KASAN: null-ptr-deref Write in event_handler

I see the command but can't find the corresponding bug.
Please resend the email to syzbo...@syzkaller.appspotmail.com address
that is the sender of the bug report (also present in the Reported-by tag).
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bug...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/f593791d-33c8-4e42-a6aa-b8bc962ff17en%40googlegroups.com.

syzbot

unread,
Jan 19, 2021, 10:12:35 PM1/19/21
to 慕冬亮, mudongl...@gmail.com, syzkall...@googlegroups.com
> #syz dup: KASAN: null-ptr-deref Write in event_handler

Your 'dup:' command is accepted, but please keep syzkall...@googlegroups.com mailing list in CC next time. It serves as a history of what happened with each bug report. Thank you.

>
> --
> My best regards to you.
>
> No System Is Safe!
> Dongliang Mu
Reply all
Reply to author
Forward
0 new messages