From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Oliver Hartkopp <socketcan@hartkopp.net>,
syzbot <syzbot+b02ff0707a97e4e79ebb@syzkaller.appspotmail.com>,
davem@davemloft.net, glider@google.com,
linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: KMSAN: uninit-value in can_receive
Date: Mon, 18 Nov 2019 21:29:54 +0100 [thread overview]
Message-ID: <deedd609-6f3b-8035-47e1-252ab221faa1@pengutronix.de> (raw)
In-Reply-To: <a5f73d92-fdf2-2590-c863-39a181dca8e1@hartkopp.net>
[-- Attachment #1.1: Type: text/plain, Size: 3526 bytes --]
On 11/18/19 9:25 PM, Oliver Hartkopp wrote:
> On 18/11/2019 20.05, syzbot wrote:
>> Hello,
>>
>> syzbot found the following crash on:
>>
>> HEAD commit: 9c6a7162 kmsan: remove unneeded annotations in bio
>> git tree: https://github.com/google/kmsan.git master
>> console output: https://syzkaller.appspot.com/x/log.txt?x=14563416e00000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=9e324dfe9c7b0360
>> dashboard link:
>> https://syzkaller.appspot.com/bug?extid=b02ff0707a97e4e79ebb
>> compiler: clang version 9.0.0 (/home/glider/llvm/clang
>> 80fee25776c2fb61e74c1ecb1a523375c2500b69)
>>
>> Unfortunately, I don't have any reproducer for this crash yet.
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>> Reported-by: syzbot+b02ff0707a97e4e79ebb@syzkaller.appspotmail.com
>>
>> =====================================================
>> BUG: KMSAN: uninit-value in can_receive+0x23c/0x5e0 net/can/af_can.c:649
>> CPU: 1 PID: 3490 Comm: syz-executor.2 Not tainted 5.4.0-rc5+ #0
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
>> Google 01/01/2011
>> Call Trace:
>> <IRQ>
>> __dump_stack lib/dump_stack.c:77 [inline]
>> dump_stack+0x191/0x1f0 lib/dump_stack.c:113
>> kmsan_report+0x128/0x220 mm/kmsan/kmsan_report.c:108
>> __msan_warning+0x73/0xe0 mm/kmsan/kmsan_instr.c:245
>> can_receive+0x23c/0x5e0 net/can/af_can.c:649
>> can_rcv+0x188/0x3a0 net/can/af_can.c:685
>
> In line 649 of 5.4.0-rc5+ we can find a while() statement:
>
> while (!(can_skb_prv(skb)->skbcnt))
> can_skb_prv(skb)->skbcnt = atomic_inc_return(&skbcounter);
>
> In linux/include/linux/can/skb.h we see:
>
> static inline struct can_skb_priv *can_skb_prv(struct sk_buff *skb)
> {
> return (struct can_skb_priv *)(skb->head);
> }
>
> IMO accessing can_skb_prv(skb)->skbcnt at this point is a valid
> operation which has no uninitialized value.
>
> Can this probably be a false positive of KMSAN?
The packet is injected via the packet socket into the kernel. Where does
skb->head point to in this case? When the skb is a proper
kernel-generated skb containing a CAN-2.0 or CAN-FD frame skb->head is
maybe properly initialized?
> do_softirq kernel/softirq.c:338 [inline]
> __local_bh_enable_ip+0x184/0x1d0 kernel/softirq.c:190
> local_bh_enable+0x36/0x40 include/linux/bottom_half.h:32
> rcu_read_unlock_bh include/linux/rcupdate.h:688 [inline]
> __dev_queue_xmit+0x38e8/0x4200 net/core/dev.c:3900
> dev_queue_xmit+0x4b/0x60 net/core/dev.c:3906
> packet_snd net/packet/af_packet.c:2959 [inline]
> packet_sendmsg+0x82d7/0x92e0 net/packet/af_packet.c:2984
^^^^^^^^^^^^^^^^^^^^^^
> sock_sendmsg_nosec net/socket.c:637 [inline]
> sock_sendmsg net/socket.c:657 [inline]
> ___sys_sendmsg+0x14ff/0x1590 net/socket.c:2311
> __sys_sendmsg net/socket.c:2356 [inline]
> __do_sys_sendmsg net/socket.c:2365 [inline]
> __se_sys_sendmsg+0x305/0x460 net/socket.c:2363
> __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2363
> do_syscall_64+0xb6/0x160 arch/x86/entry/common.c:291
> entry_SYSCALL_64_after_hwframe+0x63/0xe7
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-11-18 20:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-18 19:05 KMSAN: uninit-value in can_receive syzbot
2019-11-18 20:25 ` Oliver Hartkopp
2019-11-18 20:29 ` Marc Kleine-Budde [this message]
2019-11-18 20:49 ` Oliver Hartkopp
2019-11-18 21:15 ` Marc Kleine-Budde
2019-11-19 7:35 ` Oliver Hartkopp
2019-11-19 9:00 ` Oleksij Rempel
2019-11-19 10:08 ` Dmitry Vyukov
2019-11-19 13:06 ` Alexander Potapenko
2019-11-19 16:53 ` Eric Dumazet
2019-11-19 20:24 ` Oliver Hartkopp
2019-11-19 21:09 ` Eric Dumazet
2019-11-20 20:10 ` Oliver Hartkopp
2019-12-03 10:09 ` Marc Kleine-Budde
2019-12-03 10:37 ` Oliver Hartkopp
2019-12-03 10:40 ` Marc Kleine-Budde
2019-11-26 9:00 ` syzbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=deedd609-6f3b-8035-47e1-252ab221faa1@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=davem@davemloft.net \
--cc=glider@google.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=socketcan@hartkopp.net \
--cc=syzbot+b02ff0707a97e4e79ebb@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).