[syzbot] BUG: unable to handle kernel NULL pointer dereference in nci_send_cmd

20 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: 81e7cfa3a9eb Merge tag 'erofs-for-6.1-rc6-fixes' of git://..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=13b7800d880000
kernel config: https://syzkaller.appspot.com/x/.config?x=a2318f9a4fc31ad
dashboard link: https://syzkaller.appspot.com/bug?extid=4adf5ff0f6e6876c6a81
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11f435be880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1134d295880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/54f7533927a5/disk-81e7cfa3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/f3861072b476/vmlinux-81e7cfa3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/c36747ab66fe/bzImage-81e7cfa3.xz

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

general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 0 PID: 3636 Comm: syz-executor551 Not tainted 6.1.0-rc5-syzkaller-00015-g81e7cfa3a9eb #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:__queue_work+0x1f6/0x13b0 kernel/workqueue.c:1459
Code: ff ff 48 89 c3 e8 2a 6b 2e 00 4c 89 e7 e8 f2 59 ff ff 48 85 c0 49 89 c5 0f 84 57 01 00 00 e8 11 6b 2e 00 48 89 d8 48 c1 e8 03 <80> 3c 28 00 0f 85 4a 10 00 00 4c 39 2b 0f 84 51 01 00 00 e8 f2 6a
RSP: 0018:ffffc90003dff388 EFLAGS: 00010056
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff888020e2ba80 RSI: ffffffff8151ae6f RDI: 0000000000000001
RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff888020a890f8
R13: ffff888012069800 R14: ffff888021d5d800 R15: ffff888021d5d800
FS: 00007f11539a4700(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1153a55390 CR3: 0000000077b28000 CR4: 0000000000350ef0
Call Trace:
<TASK>
queue_work_on+0xf2/0x110 kernel/workqueue.c:1545
queue_work include/linux/workqueue.h:503 [inline]
nci_send_cmd+0x247/0x340 net/nfc/nci/core.c:1376
nci_reset_req+0x76/0xa0 net/nfc/nci/core.c:166
__nci_request+0x87/0x280 net/nfc/nci/core.c:107
nci_open_device net/nfc/nci/core.c:502 [inline]
nci_dev_up+0x2af/0x670 net/nfc/nci/core.c:631
nfc_dev_up+0x1aa/0x3b0 net/nfc/core.c:118
nfc_genl_dev_up+0xa6/0xf0 net/nfc/netlink.c:770
genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756
genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
genl_rcv_msg+0x445/0x780 net/netlink/genetlink.c:850
netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
genl_rcv+0x28/0x40 net/netlink/genetlink.c:861
netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
sock_sendmsg_nosec net/socket.c:714 [inline]
sock_sendmsg+0xd3/0x120 net/socket.c:734
____sys_sendmsg+0x712/0x8c0 net/socket.c:2482
___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
__sys_sendmsg+0xf7/0x1c0 net/socket.c:2565
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f1153a142f9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 d1 15 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f11539a4318 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f1153a9d438 RCX: 00007f1153a142f9
RDX: 0000000000000000 RSI: 0000000020000040 RDI: 0000000000000004
RBP: 00007f1153a9d430 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000008 R11: 0000000000000246 R12: 00007f1153a6a134
R13: 00007ffc4c3309cf R14: 00007f11539a4400 R15: 0000000000022000
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__queue_work+0x1f6/0x13b0 kernel/workqueue.c:1459
Code: ff ff 48 89 c3 e8 2a 6b 2e 00 4c 89 e7 e8 f2 59 ff ff 48 85 c0 49 89 c5 0f 84 57 01 00 00 e8 11 6b 2e 00 48 89 d8 48 c1 e8 03 <80> 3c 28 00 0f 85 4a 10 00 00 4c 39 2b 0f 84 51 01 00 00 e8 f2 6a
RSP: 0018:ffffc90003dff388 EFLAGS: 00010056
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: ffff888020e2ba80 RSI: ffffffff8151ae6f RDI: 0000000000000001
RBP: dffffc0000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff888020a890f8
R13: ffff888012069800 R14: ffff888021d5d800 R15: ffff888021d5d800
FS: 00007f11539a4700(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1153a55390 CR3: 0000000077b28000 CR4: 0000000000350ef0
----------------
Code disassembly (best guess), 1 bytes skipped:
0: ff 48 89 decl -0x77(%rax)
3: c3 retq
4: e8 2a 6b 2e 00 callq 0x2e6b33
9: 4c 89 e7 mov %r12,%rdi
c: e8 f2 59 ff ff callq 0xffff5a03
11: 48 85 c0 test %rax,%rax
14: 49 89 c5 mov %rax,%r13
17: 0f 84 57 01 00 00 je 0x174
1d: e8 11 6b 2e 00 callq 0x2e6b33
22: 48 89 d8 mov %rbx,%rax
25: 48 c1 e8 03 shr $0x3,%rax
* 29: 80 3c 28 00 cmpb $0x0,(%rax,%rbp,1) <-- trapping instruction
2d: 0f 85 4a 10 00 00 jne 0x107d
33: 4c 39 2b cmp %r13,(%rbx)
36: 0f 84 51 01 00 00 je 0x18d
3c: e8 .byte 0xe8
3d: f2 repnz
3e: 6a .byte 0x6a


---
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
Message has been deleted

syzbot

unread,
Nov 16, 2022, 8:08:00 AM11/16/22
to Lin Horse, kylin.f...@gmail.com, syzkall...@googlegroups.com
>
>> HEAD commit: 81e7cfa3a9eb Merge tag 'erofs-for-6.1-rc6-fixes' of git://..
>> git tree: upstream
>> console+strace: https://syzkaller.appspot.com/x/log.txt?x=13b7800d880000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=a2318f9a4fc31ad
>> dashboard link:
> https://syzkaller.appspot.com/bug?extid=4adf5ff0f6e6876c6a81
>> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for
> Debian) 2.35.2
>> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11f435be880000
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1134d295880000
>>
>> Downloadable assets:
>> disk image:
> https://storage.googleapis.com/syzbot-assets/54f7533927a5/disk-81e7cfa3.raw.xz
>> vmlinux:
> https://storage.googleapis.com/syzbot-assets/f3861072b476/vmlinux-81e7cfa3.xz
>> kernel image:
> https://storage.googleapis.com/syzbot-assets/c36747ab66fe/bzImage-81e7cfa3.xz
>>
>> IMPORTANT: if you fix the issue, please add the following tag to the
> commit:
>> Reported-by: syzbot+4adf5f...@syzkaller.appspotmail.com
>
> #syz test: https://github.com/f0rm2l1n/linux-forfix.git master

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).

>
> diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
> index 6a193cce2..7e582d79d 100644
> --- a/net/nfc/nci/core.c
> +++ b/net/nfc/nci/core.c
> @@ -542,7 +542,7 @@ static int nci_open_device(struct nci_dev *ndev)
> skb_queue_purge(&ndev->tx_q);
>
> ndev->ops->close(ndev);
> - ndev->flags = 0;
> + ndev->flags &= BIT(NCI_UNREG);;
> }
>
> done:
>
> --
> 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/14f954c1-abb1-4528-b39e-beff7cba8b79n%40googlegroups.com.

Lin Ma

unread,
Nov 16, 2022, 8:11:39 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
> From: syzbot <syzbot+4adf5f...@syzkaller.appspotmail.com>
> Sent Time: 2022-11-16 18:52:37 (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] BUG: unable to handle kernel NULL pointer dereference in nci_send_cmd

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

syzbot

unread,
Nov 16, 2022, 12:05:24 PM11/16/22
to kylin.f...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to checkout kernel repo https://github.com/f0rm2l1n/linux-forfix.git/master: failed to run ["git" "fetch" "--force" "a05da63feb212a2d419746bb923f3efb2163d7c5" "master"]: exit status 128
fatal: could not read Username for 'https://github.com': No such device or address



Tested on:

commit: [unknown
git tree: https://github.com/f0rm2l1n/linux-forfix.git master
Note: no patches were applied.

syzbot

unread,
Nov 16, 2022, 1:00:21 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+4adf5f...@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=12f48735880000
kernel config: https://syzkaller.appspot.com/x/.config?x=a2318f9a4fc31ad
dashboard link: https://syzkaller.appspot.com/bug?extid=4adf5ff0f6e6876c6a81
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Nov 16, 2022, 7:34:17 PM11/16/22
to bongs...@samsung.com, clement.p...@nxp.com, da...@davemloft.net, edum...@google.com, krzysztof...@linaro.org, ku...@kernel.org, kylin.f...@gmail.com, li...@zju.edu.cn, linux-...@vger.kernel.org, michael....@hale.at, net...@vger.kernel.org, pab...@redhat.com, r.ba...@samsung.com, robert...@intel.com, sa...@linux.intel.com, shikha...@st.com, syzkall...@googlegroups.com, thierry...@linux.intel.com
syzbot has bisected this issue to:

commit e624e6c3e777fb3dfed036b9da4d433aee3608a5
Author: Bongsu Jeon <bongs...@samsung.com>
Date: Wed Jan 27 13:08:28 2021 +0000

nfc: Add a virtual nci device driver

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1338e6e9880000
start commit: 81e7cfa3a9eb Merge tag 'erofs-for-6.1-rc6-fixes' of git://..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=10b8e6e9880000
console output: https://syzkaller.appspot.com/x/log.txt?x=1738e6e9880000
Reported-by: syzbot+4adf5f...@syzkaller.appspotmail.com
Fixes: e624e6c3e777 ("nfc: Add a virtual nci device driver")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Dmitry Vyukov

unread,
Nov 30, 2022, 4:30:34 AM11/30/22
to syzbot, 马麟, bongs...@samsung.com, clement.p...@nxp.com, krzysztof...@linaro.org, li...@zju.edu.cn, linux-...@vger.kernel.org, michael....@hale.at, net...@vger.kernel.org, syzkall...@googlegroups.com
#syz dup: WARNING in nci_send_cmd
Reply all
Reply to author
Forward
0 new messages