qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Nabih Estefan <nabihestefan@google.com>,
	qemu-devel@nongnu.org, richard.henderson@linaro.org,
	pbonzini@redhat.com, Peter Foley <pefoley@google.com>
Subject: Re: [PATCH 1/2] util: fix msan findings in keyval
Date: Fri, 9 May 2025 08:58:07 +0100	[thread overview]
Message-ID: <aB207Rl-vZxfuJBM@redhat.com> (raw)
In-Reply-To: <87cycibagm.fsf@pond.sub.org>

On Fri, May 09, 2025 at 07:48:57AM +0200, Markus Armbruster wrote:
> Nabih Estefan <nabihestefan@google.com> writes:
> 
> > From: Peter Foley <pefoley@google.com>
> >
> > e.g.
> > I	2025-02-28 09:51:05.240071-0800		624	stream.go:47	qemu: Uninitialized value was created by an allocation of 'key_in_cur.i' in the stack frame
> > I	2025-02-28 09:51:05.240187-0800		624	stream.go:47	qemu: #0 0xaaaac49f489c in keyval_parse_one third_party/qemu/util/keyval.c:190:5
> >
> > Signed-off-by: Peter Foley <pefoley@google.com>
> > Signed-off-by: Nabih Estefan <nabihestefan@google.com>
> > ---
> >  util/keyval.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/util/keyval.c b/util/keyval.c
> > index a70629a481..f33c64079d 100644
> > --- a/util/keyval.c
> > +++ b/util/keyval.c
> > @@ -187,7 +187,7 @@ static const char *keyval_parse_one(QDict *qdict, const char *params,
> >  {
> >      const char *key, *key_end, *val_end, *s, *end;
> >      size_t len;
> > -    char key_in_cur[128];
> > +    char key_in_cur[128] = {};
> >      QDict *cur;
> >      int ret;
> >      QObject *next;
> 
> Prior review of Peter's patch concluded this must be false positive:
> https://lore.kernel.org/qemu-devel/14168384-ecdb-4c05-8267-ac5ef1c46fe9@redhat.com/

While I agree with Paolo's reasoning, I think it is still worth adding an
explicit initializer, because it makes it easier for both humans and machines
to reason about correctless.

To reinforce that we don't have an actual bug though, also note that qemu
unconditionally builds with -ftrivial-auto-var-init=zero. So if we happen
to forget any, it won't cause a bug in the common case of a zero-initializer.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-05-09  7:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 22:21 [PATCH 0/2] Miscellaneous MSan finding Nabih Estefan
2025-05-08 22:21 ` [PATCH 1/2] util: fix msan findings in keyval Nabih Estefan
2025-05-09  5:48   ` Markus Armbruster
2025-05-09  7:58     ` Daniel P. Berrangé [this message]
2025-05-09  8:57       ` Markus Armbruster
2025-05-28  7:55       ` Paolo Bonzini
2025-05-08 22:21 ` [PATCH 2/2] accel/tcg: fix msan findings in translate-all Nabih Estefan

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=aB207Rl-vZxfuJBM@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=nabihestefan@google.com \
    --cc=pbonzini@redhat.com \
    --cc=pefoley@google.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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).