From: asmadeus@codewreck.org
To: syzbot <syzbot+06472778c97ed94af66d@syzkaller.appspotmail.com>
Cc: davem@davemloft.net, ericvh@gmail.com, glider@google.com,
kuba@kernel.org, linux-kernel@vger.kernel.org, lucho@ionkov.net,
netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com,
v9fs-developer@lists.sourceforge.net
Subject: Re: [syzbot] KMSAN: uninit-value in p9pdu_readf
Date: Sun, 10 Oct 2021 17:36:21 +0900 [thread overview]
Message-ID: <YWKmBWfBS3oshQ/z@codewreck.org> (raw)
In-Reply-To: <000000000000baddc805cdf928c3@google.com>
Question for people who know about KMSAN: which of the backtrace or the
'Local variable' message should I trust?
syzbot wrote on Sat, Oct 09, 2021 at 10:48:17PM -0700:
> =====================================================
> BUG: KMSAN: uninit-value in p9pdu_vreadf net/9p/protocol.c:147 [inline]
> BUG: KMSAN: uninit-value in p9pdu_readf+0x46cf/0x4fc0 net/9p/protocol.c:526
> p9pdu_vreadf net/9p/protocol.c:147 [inline]
> p9pdu_readf+0x46cf/0x4fc0 net/9p/protocol.c:526
> p9pdu_vreadf net/9p/protocol.c:198 [inline]
> p9pdu_readf+0x2080/0x4fc0 net/9p/protocol.c:526
> p9_client_stat+0x2b3/0x710 net/9p/client.c:1724
> v9fs_mount+0xc14/0x12c0 fs/9p/vfs_super.c:170
would be 'len' in p9pdu_vreadf, which has to be set as far as I can understand:
> uint16_t len;
>
> errcode = p9pdu_readf(pdu, proto_version,
> "w", &len);
> if (errcode)
> break;
>
> *sptr = kmalloc(len + 1, GFP_NOFS);
with relevant part of p9pdu_readf being:
> case 'w':{
> int16_t *val = va_arg(ap, int16_t *);
> __le16 le_val;
> if (pdu_read(pdu, &le_val, sizeof(le_val))) {
> errcode = -EFAULT;
> break;
> }
> *val = le16_to_cpu(le_val);
> }
> ...
> return errcode;
e.g. either len or errcode should be set...
But:
> Local variable ----ecode@p9_check_errors created at:
> p9_check_errors+0x68/0xb90 net/9p/client.c:506
> p9_client_rpc+0xd90/0x1410 net/9p/client.c:801
is something totally different, p9_client_rpc happens before the
p9pdu_readf call in p9_client_stat, and ecode is local to
p9_check_errors, I don't see how it could get that far.
Note that inspecting p9_check_errors manually, there is a case where
ecode is returned (indirectly through err = -ecode) without being
initialized, so I will send a patch for that at least, but I have no
idea if that is what has been reported and it should be trivial to
reproduce so I do not see why syzbot does not have a reproducer -- it
retries running the last program that triggered the error before sending
the report, right?
--
Dominique Martinet | Asmadeus
next prev parent reply other threads:[~2021-10-10 8:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-10 5:48 [syzbot] KMSAN: uninit-value in p9pdu_readf syzbot
2021-10-10 8:36 ` asmadeus [this message]
2021-10-11 5:56 ` Dmitry Vyukov
2021-10-11 6:54 ` asmadeus
2021-10-11 7:02 ` Dmitry Vyukov
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=YWKmBWfBS3oshQ/z@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=davem@davemloft.net \
--cc=ericvh@gmail.com \
--cc=glider@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=netdev@vger.kernel.org \
--cc=syzbot+06472778c97ed94af66d@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=v9fs-developer@lists.sourceforge.net \
/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).