All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf lock contention: Fix msan issue in lock_contention_read()
Date: Fri, 24 Mar 2023 16:54:15 -0300	[thread overview]
Message-ID: <ZB3/52fEm7/5w72q@kernel.org> (raw)
In-Reply-To: <CAP-5=fWPDSy31BLtxvJAsRq2pwnhKHN8T-CYckv=tELGCO9p0w@mail.gmail.com>

Em Thu, Mar 23, 2023 at 11:50:57PM -0700, Ian Rogers escreveu:
> On Thu, Mar 23, 2023 at 5:19 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > I got a report of a msan failure like below:
> >
> >   $ sudo perf lock con -ab -- sleep 1
> >   ...
> >   ==224416==WARNING: MemorySanitizer: use-of-uninitialized-value
> >       #0 0x5651160d6c96 in lock_contention_read  util/bpf_lock_contention.c:290:8
> >       #1 0x565115f90870 in __cmd_contention  builtin-lock.c:1919:3
> >       #2 0x565115f90870 in cmd_lock  builtin-lock.c:2385:8
> >       #3 0x565115f03a83 in run_builtin  perf.c:330:11
> >       #4 0x565115f03756 in handle_internal_command  perf.c:384:8
> >       #5 0x565115f02d53 in run_argv  perf.c:428:2
> >       #6 0x565115f02d53 in main  perf.c:562:3
> >       #7 0x7f43553bc632 in __libc_start_main
> >       #8 0x565115e865a9 in _start
> >
> > It was because the 'key' variable is not initialized.  Actually it'd be set
> > by bpf_map_get_next_key() but msan didn't seem to understand it.  Let's make
> > msan happy by initializing the variable.
> >
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> 
> Acked-by: Ian Rogers <irogers@google.com>

Thanks, applied.

- Arnaldo

 
> Thanks,
> Ian
> 
> > ---
> >  tools/perf/util/bpf_lock_contention.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/bpf_lock_contention.c b/tools/perf/util/bpf_lock_contention.c
> > index 235fc7150545..5927bf0bd92b 100644
> > --- a/tools/perf/util/bpf_lock_contention.c
> > +++ b/tools/perf/util/bpf_lock_contention.c
> > @@ -249,7 +249,7 @@ static const char *lock_contention_get_name(struct lock_contention *con,
> >  int lock_contention_read(struct lock_contention *con)
> >  {
> >         int fd, stack, err = 0;
> > -       struct contention_key *prev_key, key;
> > +       struct contention_key *prev_key, key = {};
> >         struct contention_data data = {};
> >         struct lock_stat *st = NULL;
> >         struct machine *machine = con->machine;
> > --
> > 2.40.0.348.gf938b09366-goog
> >

-- 

- Arnaldo

      reply	other threads:[~2023-03-24 19:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24  0:19 [PATCH] perf lock contention: Fix msan issue in lock_contention_read() Namhyung Kim
2023-03-24  6:50 ` Ian Rogers
2023-03-24 19:54   ` Arnaldo Carvalho de Melo [this message]

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=ZB3/52fEm7/5w72q@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.