[syzbot] WARNING in nci_send_cmd

15 views
Skip to first unread message

syzbot

unread,
Nov 16, 2022, 5:52:39 AM11/16/22
to da...@davemloft.net, edum...@google.com, krzysztof...@linaro.org, ku...@kernel.org, li...@zju.edu.cn, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 9500fc6e9e60 Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=16ebd49e880000
kernel config: https://syzkaller.appspot.com/x/.config?x=b25c9f218686dd5e
dashboard link: https://syzkaller.appspot.com/bug?extid=43475bf3cfbd6e41f5b7
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=150027ae880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=141717ae880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1363e60652f7/disk-9500fc6e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/fcc4da811bb6/vmlinux-9500fc6e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0b554298f1fa/Image-9500fc6e.gz.xz

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

------------[ cut here ]------------
WARNING: CPU: 1 PID: 3079 at kernel/workqueue.c:1438 is_chained_work kernel/workqueue.c:1382 [inline]
WARNING: CPU: 1 PID: 3079 at kernel/workqueue.c:1438 __queue_work+0x878/0x8b4 kernel/workqueue.c:1438
Modules linked in:
CPU: 1 PID: 3079 Comm: syz-executor103 Not tainted 6.1.0-rc5-syzkaller-32269-g9500fc6e9e60 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __queue_work+0x878/0x8b4 kernel/workqueue.c:1382
lr : is_chained_work kernel/workqueue.c:1382 [inline]
lr : __queue_work+0x878/0x8b4 kernel/workqueue.c:1438
sp : ffff80000ffcb710
x29: ffff80000ffcb710 x28: ffff0000c22b8000 x27: 0000000000000000
x26: ffff0000ca031a10 x25: ffff0000c22b8000 x24: 0000000000000100
x23: 0000000100000000 x22: 00000000000f000a x21: ffff0000ca152400
x20: 0000000000000008 x19: ffff0000cb1e20f8 x18: 00000000000001ac
x17: 0000000000000000 x16: ffff80000dc18158 x15: ffff0000c22b8000
x14: 00000000000000c0 x13: 00000000ffffffff x12: ffff0000c22b8000
x11: ff808000081306bc x10: 0000000000000000 x9 : ffff8000081306bc
x8 : ffff0000c22b8000 x7 : ffff80000b25d5e8 x6 : 0000000000000000
x5 : 0000000000000080 x4 : 0000000000000001 x3 : 0000000000000000
x2 : ffff0000cb1e20f8 x1 : 0000000000000000 x0 : 0000000000000000
Call trace:
is_chained_work kernel/workqueue.c:1382 [inline]
__queue_work+0x878/0x8b4 kernel/workqueue.c:1438
queue_work_on+0xb0/0x15c kernel/workqueue.c:1545
queue_work include/linux/workqueue.h:503 [inline]
nci_send_cmd+0xe8/0x154 net/nfc/nci/core.c:1376
nci_reset_req net/nfc/nci/core.c:166 [inline]
__nci_request net/nfc/nci/core.c:107 [inline]
nci_open_device+0x168/0x518 net/nfc/nci/core.c:502
nci_dev_up+0x20/0x30 net/nfc/nci/core.c:631
nfc_dev_up+0xcc/0x1b0 net/nfc/core.c:118
nfc_genl_dev_up+0x40/0x78 net/nfc/netlink.c:770
genl_family_rcv_msg_doit net/netlink/genetlink.c:756 [inline]
genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
genl_rcv_msg+0x458/0x4f4 net/netlink/genetlink.c:850
netlink_rcv_skb+0xe8/0x1d4 net/netlink/af_netlink.c:2540
genl_rcv+0x38/0x50 net/netlink/genetlink.c:861
netlink_unicast_kernel+0xfc/0x1dc net/netlink/af_netlink.c:1319
netlink_unicast+0x164/0x248 net/netlink/af_netlink.c:1345
netlink_sendmsg+0x484/0x584 net/netlink/af_netlink.c:1921
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg net/socket.c:734 [inline]
____sys_sendmsg+0x2f8/0x440 net/socket.c:2482
___sys_sendmsg net/socket.c:2536 [inline]
__sys_sendmsg+0x1ac/0x228 net/socket.c:2565
__do_sys_sendmsg net/socket.c:2574 [inline]
__se_sys_sendmsg net/socket.c:2572 [inline]
__arm64_sys_sendmsg+0x2c/0x3c net/socket.c:2572
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:584
irq event stamp: 42
hardirqs last enabled at (41): [<ffff80000c0b7c04>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
hardirqs last enabled at (41): [<ffff80000c0b7c04>] _raw_spin_unlock_irqrestore+0x48/0x8c kernel/locking/spinlock.c:194
hardirqs last disabled at (42): [<ffff80000812fd60>] queue_work_on+0x78/0x15c kernel/workqueue.c:1542
softirqs last enabled at (8): [<ffff80000801c38c>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32
softirqs last disabled at (6): [<ffff80000801c358>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19
---[ end trace 0000000000000000 ]---
nci: __nci_request: wait_for_completion_interruptible_timeout failed 0


---
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,
Nov 16, 2022, 7:10:09 AM11/16/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On 16 Nov 2022 02:52:38 -0800
> syzbot found the following issue on:
>
> HEAD commit: 9500fc6e9e60 Merge branch 'for-next/core' into for-kernelci
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
> console output: https://syzkaller.appspot.com/x/log.txt?x=16ebd49e880000
> kernel config: https://syzkaller.appspot.com/x/.config?x=b25c9f218686dd5e
> dashboard link: https://syzkaller.appspot.com/bug?extid=43475bf3cfbd6e41f5b7
Serialize the open and close patches with req_lock wrt NCI_UNREG.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 9500fc6e9e60

--- x/net/nfc/nci/core.c
+++ n/net/nfc/nci/core.c
@@ -559,6 +559,8 @@ static int nci_close_device(struct nci_d
*/
mutex_lock(&ndev->req_lock);

+ set_bit(NCI_UNREG, &ndev->flags);
+
if (!test_and_clear_bit(NCI_UP, &ndev->flags)) {
/* Need to flush the cmd wq in case
* there is a queued/running cmd_work
@@ -598,9 +600,6 @@ static int nci_close_device(struct nci_d

del_timer_sync(&ndev->cmd_timer);

- /* Clear flags except NCI_UNREG */
- ndev->flags &= BIT(NCI_UNREG);
-
mutex_unlock(&ndev->req_lock);

return 0;
@@ -1282,12 +1281,6 @@ void nci_unregister_device(struct nci_de
{
struct nci_conn_info *conn_info, *n;

- /* This set_bit is not protected with specialized barrier,
- * However, it is fine because the mutex_lock(&ndev->req_lock);
- * in nci_close_device() will help to emit one.
- */
- set_bit(NCI_UNREG, &ndev->flags);
-
nci_close_device(ndev);

destroy_workqueue(ndev->cmd_wq);
--

Lin Ma

unread,
Nov 16, 2022, 8:09:18 AM11/16/22
to syzbot, da...@davemloft.net, edum...@google.com, krzysztof...@linaro.org, ku...@kernel.org, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com


> -----Original Messages-----
> From: syzbot <syzbot+43475b...@syzkaller.appspotmail.com>
> Sent Time: 2022-11-16 18:52:38 (Wednesday)
> To: da...@davemloft.net, edum...@google.com, krzysztof...@linaro.org, ku...@kernel.org, li...@zju.edu.cn, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
> Cc:
> Subject: [syzbot] WARNING in nci_send_cmd

#syz test: https://github.com/f0rm2l1n/linux-fix.git master

syzbot

unread,
Nov 16, 2022, 12:04:16 PM11/16/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+43475b...@syzkaller.appspotmail.com

Tested on:

commit: 9500fc6e Merge branch 'for-next/core' into for-kernelci
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=171cb89e880000
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=16aed579880000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Nov 16, 2022, 12:36:18 PM11/16/22
to da...@davemloft.net, edum...@google.com, krzysztof...@linaro.org, ku...@kernel.org, li...@zju.edu.cn, linux-...@vger.kernel.org, net...@vger.kernel.org, pab...@redhat.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+43475b...@syzkaller.appspotmail.com

Tested on:

commit: 1c96c97c nfc/nci: fix race with opening and closing
git tree: https://github.com/f0rm2l1n/linux-fix.git master
console output: https://syzkaller.appspot.com/x/log.txt?x=17699f35880000
kernel config: https://syzkaller.appspot.com/x/.config?x=c42faa14acb6dc7f
dashboard link: https://syzkaller.appspot.com/bug?extid=43475bf3cfbd6e41f5b7
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64

Note: no patches were applied.
Reply all
Reply to author
Forward
0 new messages