From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Kajol Jain <kjain@linux.ibm.com>,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
"Steinar H. Gunderson" <sesse@google.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
Hemant Kumar <hemant@linux.vnet.ibm.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Yang Jihong <yangjihong@bytedance.com>,
leo.yan@arm.com
Subject: Re: [PATCH v1 2/3] perf probe: Fix libdw memory leak
Date: Wed, 2 Oct 2024 14:53:59 -0700 [thread overview]
Message-ID: <Zv3A98bZdlmJ8GaW@google.com> (raw)
In-Reply-To: <CAP-5=fWgounnfvSQtOiqZQdpkg00yvT3E-rGNFUKKb8ZksPhjg@mail.gmail.com>
On Wed, Oct 02, 2024 at 12:08:30PM -0700, Ian Rogers wrote:
> On Wed, Oct 2, 2024 at 10:44 AM Namhyung Kim <namhyung@gmail.com> wrote:
> >
> > On Mon, Sep 23, 2024 at 5:37 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > Add missing dwarf_cfi_end to free memory associated with probe_finder
> > > cfi_eh or cfi_dbg. This addresses leak sanitizer issues seen in:
> > > tools/perf/tests/shell/test_uprobe_from_different_cu.sh
> > >
> > > Fixes: 270bde1e76f4 ("perf probe: Search both .eh_frame and .debug_frame sections for probe location")
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > ---
> > > tools/perf/util/probe-finder.c | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > >
> > > diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> > > index 630e16c54ed5..78f34fa0c391 100644
> > > --- a/tools/perf/util/probe-finder.c
> > > +++ b/tools/perf/util/probe-finder.c
> > > @@ -1379,6 +1379,11 @@ int debuginfo__find_trace_events(struct debuginfo *dbg,
> > > if (ret >= 0 && tf.pf.skip_empty_arg)
> > > ret = fill_empty_trace_arg(pev, tf.tevs, tf.ntevs);
> > >
> > > +#if _ELFUTILS_PREREQ(0, 142)
> > > + dwarf_cfi_end(tf.pf.cfi_eh);
> > > + dwarf_cfi_end(tf.pf.cfi_dbg);
> > > +#endif
> >
> > This is causing another problem. Now vfs_getname tests are
> > failing because perf probe aborts.
>
> I wasn't able to reproduce but largely as the test skips. The variable
> is out of scope after the function so I'm struggling to see what the
> issue is.
I'm seeing this.
$ sudo ./perf test -v vfs
91: Add vfs_getname probe to get syscall args filenames:
--- start ---
test child forked, pid 3013362
free(): invalid pointer
linux/tools/perf/tests/shell/lib/probe_vfs_getname.sh: line 13: 3013380 Aborted perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string"
free(): invalid pointer
linux/tools/perf/tests/shell/lib/probe_vfs_getname.sh: line 13: 3013381 Aborted perf probe $add_probe_verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring"
---- end(-1) ----
91: Add vfs_getname probe to get syscall args filenames : FAILED!
93: Use vfs_getname probe to get syscall args filenames:
--- start ---
test child forked, pid 3013479
free(): invalid pointer
linux/tools/perf/tests/shell/lib/probe_vfs_getname.sh: line 13: 3013502 Aborted perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string"
free(): invalid pointer
linux/tools/perf/tests/shell/lib/probe_vfs_getname.sh: line 13: 3013514 Aborted perf probe $add_probe_verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring"
---- end(-1) ----
93: Use vfs_getname probe to get syscall args filenames : FAILED!
127: Check open filename arg using perf trace + vfs_getname:
--- start ---
test child forked, pid 3013528
free(): invalid pointer
linux/tools/perf/tests/shell/lib/probe_vfs_getname.sh: line 13: 3013547 Aborted perf probe -q "vfs_getname=getname_flags:${line} pathname=result->name:string"
free(): invalid pointer
linux/tools/perf/tests/shell/lib/probe_vfs_getname.sh: line 13: 3013548 Aborted perf probe $add_probe_verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring"
---- end(-1) ----
127: Check open filename arg using perf trace + vfs_getname : FAILED!
Dropping the series from tmp.perf-tools-next for now.
Thanks,
Namhyung
next prev parent reply other threads:[~2024-10-02 21:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-24 0:37 [PATCH v1 0/3] 2 memory fixes and a build fix Ian Rogers
2024-09-24 0:37 ` [PATCH v1 1/3] perf disasm: Fix capstone memory leak Ian Rogers
2024-09-24 18:38 ` Namhyung Kim
2024-09-24 19:51 ` Ian Rogers
2024-09-25 5:57 ` Namhyung Kim
2024-09-24 0:37 ` [PATCH v1 2/3] perf probe: Fix libdw " Ian Rogers
2024-09-24 9:17 ` James Clark
2024-09-24 18:39 ` Namhyung Kim
2024-09-24 19:47 ` Ian Rogers
2024-09-25 6:00 ` Namhyung Kim
2024-10-02 17:43 ` Namhyung Kim
2024-10-02 19:08 ` Ian Rogers
2024-10-02 21:53 ` Namhyung Kim [this message]
2024-09-24 0:37 ` [PATCH v1 3/3] perf build: Fix !HAVE_DWARF_GETLOCATIONS_SUPPORT Ian Rogers
2024-09-24 9:18 ` [PATCH v1 0/3] 2 memory fixes and a build fix James Clark
2024-09-24 18:25 ` Namhyung Kim
2024-10-01 5:11 ` Ian Rogers
2024-10-01 23:58 ` Namhyung Kim
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=Zv3A98bZdlmJ8GaW@google.com \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=hemant@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=kjain@linux.ibm.com \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=przemyslaw.kitszel@intel.com \
--cc=sesse@google.com \
--cc=yangjihong@bytedance.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).