From: Namhyung Kim <namhyung@kernel.org>
To: James Clark <james.clark@arm.com>
Cc: Chaitanya S Prakash <ChaitanyaS.Prakash@arm.com>,
linux-perf-users@vger.kernel.org, anshuman.khandual@arm.com
Subject: Re: [PATCH V3 09/10] perf tools: Only treat files as map files when they have the extension .map
Date: Mon, 24 Jun 2024 16:29:54 -0700 [thread overview]
Message-ID: <ZnoBcgVcEwPFsH5Z@google.com> (raw)
In-Reply-To: <371abb9c-41a5-4bf0-928f-a60848776bfc@arm.com>
Hello,
On Mon, Jun 17, 2024 at 02:52:52PM +0100, James Clark wrote:
>
>
> On 01/06/2024 13:59, Chaitanya S Prakash wrote:
> > From: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
> >
> > Strengthen the check to locate symbol map files in the tool's /tmp
> > directory. As the existing check allows non map files named in
> > "/tmp/perf-" pattern, it leads to possible dwarf library corruption
> > when perf is built with NO_DWARF=1. The try_to_find_probe_trace_events()
> > function behaves differently when built in that manner. Extending the
> > current check condition using the str_has_suffix() function to not only
> > validate the pattern but also ensure the file is of ".map" type allows
> > test perf probe of function from different CU to pass when built with
> > NO_DWARF=1.
> >
> > Signed-off-by: Chaitanya S Prakash <chaitanyas.prakash@arm.com>
> > ---
> > tools/perf/util/symbol.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> > index 9e5940b5bc59..fbcc189edd8d 100644
> > --- a/tools/perf/util/symbol.c
> > +++ b/tools/perf/util/symbol.c
> > @@ -1799,7 +1799,8 @@ int dso__load(struct dso *dso, struct map *map)
> > const char *map_path = dso__long_name(dso);
> >
> > mutex_lock(dso__lock(dso));
> > - perfmap = strncmp(dso__name(dso), "/tmp/perf-", 10) == 0;
> > + perfmap = strncmp(dso__name(dso), "/tmp/perf-", 10) == 0 &&
> > + str_has_prefix(dso__name(dso), ".map") != 0;
>
> Does this work? Shouldn't it be str_has_suffix()?
Yep, I think it should be
perfmap = str_has_prefix(dso__name(dso), "/tmp/perf-") &&
str_has_suffix(dso__name(dso), ".map"));
>
> For reference, there's another fix for the same issue here:
> https://lore.kernel.org/linux-perf-users/20240617130332.13427-1-atrajeev@linux.vnet.ibm.com/T/#m9b1e62f0cdbcd4caf019f2ad97d69b29df568522
Right, it seems this patchset is posted earlier than the above. But I
prefer Athira's fix as it touches less codes basically and contains more
fixes.
Thanks,
Namhyung
>
> > if (perfmap) {
> > if (dso__nsinfo(dso) &&
> > (dso__find_perf_map(newmapname, sizeof(newmapname),
next prev parent reply other threads:[~2024-06-24 23:29 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-01 12:59 [PATCH V3 00/10] perf tools: Fix test "perf probe of function from different CU" Chaitanya S Prakash
2024-06-01 12:59 ` Chaitanya S Prakash
2024-06-01 12:59 ` [PATCH V3 01/10] tools lib: adopt str_has_suffix() from bpftool/gen.c Chaitanya S Prakash
2024-06-01 12:59 ` [PATCH V3 02/10] perf util: Delete ends_with() and replace its use with str_has_suffix() Chaitanya S Prakash
2024-06-01 12:59 ` [PATCH V3 03/10] perf util: Replace an instance of strtailcmp() by str_has_suffix() Chaitanya S Prakash
2024-06-01 12:59 ` [PATCH V3 04/10] tools lib: Adopt str_has_prefix() from kernel Chaitanya S Prakash
2024-06-01 12:59 ` [PATCH V3 05/10] libsubcmd: Replace strstarts() usage with str_has_prefix() Chaitanya S Prakash
2024-06-01 12:59 ` [PATCH V3 06/10] objtool: " Chaitanya S Prakash
2024-06-01 12:59 ` [PATCH V3 07/10] perf tools: " Chaitanya S Prakash
2024-06-01 12:59 ` [PATCH V3 08/10] tools lib: Remove strstarts() as all its usecases have been replaced by str_has_prefix() Chaitanya S Prakash
2024-06-01 12:59 ` [PATCH V3 09/10] perf tools: Only treat files as map files when they have the extension .map Chaitanya S Prakash
2024-06-17 13:52 ` James Clark
2024-06-24 23:29 ` Namhyung Kim [this message]
2024-06-01 12:59 ` [PATCH V3 10/10] perf test: Check output of the probe ... --funcs command Chaitanya S Prakash
2024-06-24 23:30 ` Namhyung Kim
2024-06-25 12:40 ` James Clark
2024-06-25 19:08 ` Namhyung Kim
2024-06-26 3:57 ` Namhyung Kim
2024-07-10 7:39 ` [PATCH V3 00/10] perf tools: Fix test "perf probe of function from different CU" Chaitanya S Prakash
2024-07-12 19:55 ` Namhyung Kim
2024-07-15 9:34 ` James Clark
2024-07-15 9:35 ` James Clark
2024-07-15 10:27 ` James Clark
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=ZnoBcgVcEwPFsH5Z@google.com \
--to=namhyung@kernel.org \
--cc=ChaitanyaS.Prakash@arm.com \
--cc=anshuman.khandual@arm.com \
--cc=james.clark@arm.com \
--cc=linux-perf-users@vger.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.