From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
Disha Goel <disgoel@linux.vnet.ibm.com>,
Jiri Olsa <jolsa@kernel.org>, Kajol Jain <kjain@linux.ibm.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Namhyung Kim <namhyung@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] perf dlfilter: Initialize addr_location before passing it to thread__find_symbol_fb()
Date: Mon, 24 Jul 2023 18:31:43 -0300 [thread overview]
Message-ID: <ZL7tv45K3zKqkHhZ@kernel.org> (raw)
In-Reply-To: <CAP-5=fVy8cYrYH5EmdrJo0+q0CHj=chTxWYkieLi6LwTSjFCAQ@mail.gmail.com>
Em Mon, Jul 24, 2023 at 02:16:05PM -0700, Ian Rogers escreveu:
> On Mon, Jul 24, 2023 at 2:09 PM Arnaldo Carvalho de Melo
> <acme@kernel.org> wrote:
> >
> > As thread__find_symbol_fb() will end up calling thread__find_map() and
> > it in turn will call these on uninitialized memory:
> >
> > maps__zput(al->maps);
> > map__zput(al->map);
> > thread__zput(al->thread);
>
> Normally there would be a addr_location__exit. It looks here like most
> values are copied in al_to_d_al, which copies reference counted values
> without doing appropriate gets. Perhaps add the gets in al_to_d_al and
> add the exit to make it clear there can't be addr_location related
> leaks here.
I'll do that as well and add the addr_location__exit() then send a V2.
- Arnaldo
> Thanks,
> Ian
>
> > Fixes: 0dd5041c9a0eaf8c ("perf addr_location: Add init/exit/copy functions")
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> > Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> > Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
> > Cc: Ian Rogers <irogers@google.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Kajol Jain <kjain@linux.ibm.com>
> > Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Link: https://lore.kernel.org/lkml/
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > ---
> > tools/perf/util/dlfilter.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/perf/util/dlfilter.c b/tools/perf/util/dlfilter.c
> > index 46f74b2344dbb34c..798a53d7e6c9dfc5 100644
> > --- a/tools/perf/util/dlfilter.c
> > +++ b/tools/perf/util/dlfilter.c
> > @@ -166,6 +166,7 @@ static __s32 dlfilter__resolve_address(void *ctx, __u64 address, struct perf_dlf
> > if (!thread)
> > return -1;
> >
> > + addr_location__init(&al);
> > thread__find_symbol_fb(thread, d->sample->cpumode, address, &al);
> >
> > al_to_d_al(&al, &d_al);
> > --
> > 2.37.1
> >
--
- Arnaldo
next prev parent reply other threads:[~2023-07-24 21:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 21:09 [PATCH 1/1] perf dlfilter: Initialize addr_location before passing it to thread__find_symbol_fb() Arnaldo Carvalho de Melo
2023-07-24 21:16 ` Ian Rogers
2023-07-24 21:31 ` Arnaldo Carvalho de Melo [this message]
2023-07-25 11:51 ` Adrian Hunter
2023-07-27 14:13 ` Arnaldo Carvalho de Melo
2023-07-28 19:18 ` Adrian Hunter
2023-07-31 9:26 ` Adrian Hunter
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=ZL7tv45K3zKqkHhZ@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=disgoel@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kjain@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maddy@linux.ibm.com \
--cc=namhyung@kernel.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.