linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@arm.com>
To: Chaitanya S Prakash <ChaitanyaS.Prakash@arm.com>,
	linux-perf-users@vger.kernel.org
Cc: anshuman.khandual@arm.com
Subject: Re: [PATCH V2 7/8] perf tools: Only treat files as map files when they have the extension .map
Date: Tue, 9 Apr 2024 11:21:55 +0100	[thread overview]
Message-ID: <7ba7a9ee-901c-48a4-bd6c-b59294da7a65@arm.com> (raw)
In-Reply-To: <20240408062230.1949882-8-ChaitanyaS.Prakash@arm.com>



On 08/04/2024 07:22, 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 | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 9ebdb8e13c0b..812684aa42ce 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1792,7 +1792,9 @@ int dso__load(struct dso *dso, struct map *map)
>  	const char *map_path = dso->long_name;
>  
>  	mutex_lock(&dso->lock);
> -	perfmap = strncmp(dso->name, "/tmp/perf-", 10) == 0;
> +	perfmap = strncmp(dso->name, "/tmp/perf-", 10) == 0 &&
> +		  str_has_suffix(dso->name, ".map") != 0;
> +
>  	if (perfmap) {
>  		if (dso->nsinfo && (dso__find_perf_map(newmapname,
>  		    sizeof(newmapname), &dso->nsinfo) == 0)) {

Reviewed-by: James Clark <james.clark@arm.com>

  reply	other threads:[~2024-04-09 10:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08  6:22 [PATCH V2 0/8] perf tools: Fix test "perf probe of function from different CU" Chaitanya S Prakash
2024-04-08  6:22 ` [PATCH V2 1/8] tools lib: adopt str_has_suffix() from bpftool/gen.c Chaitanya S Prakash
2024-04-08 23:32   ` Masami Hiramatsu
2024-04-11 12:15     ` Chaitanya S Prakash
2024-04-11 15:41       ` Arnaldo Carvalho de Melo
2024-04-08  6:22 ` [PATCH V2 2/8] perf util: Delete ends_with() and replace its use with str_has_suffix() Chaitanya S Prakash
2024-04-08  6:22 ` [PATCH V2 3/8] perf util: Replace an instance of strtailcmp() by str_has_suffix() Chaitanya S Prakash
2024-04-08 23:20   ` Masami Hiramatsu
2024-04-08  6:22 ` [PATCH V2 4/8] tools lib: Adopt str_has_prefix() from kernel Chaitanya S Prakash
2024-04-08 23:33   ` Masami Hiramatsu
2024-04-08  6:22 ` [PATCH V2 5/8] tools: Delete strstarts() and replace its usage with str_has_prefix() Chaitanya S Prakash
2024-04-18  7:32   ` kernel test robot
2024-04-08  6:22 ` [PATCH V2 6/8] perf tools: Enable configs required for test_uprobe_from_different_cu.sh Chaitanya S Prakash
2024-04-08 23:11   ` Masami Hiramatsu
2024-04-16 21:19     ` Arnaldo Carvalho de Melo
2024-04-08  6:22 ` [PATCH V2 7/8] perf tools: Only treat files as map files when they have the extension .map Chaitanya S Prakash
2024-04-09 10:21   ` James Clark [this message]
2024-04-08  6:22 ` [PATCH V2 8/8] perf test: Check output of the probe ... --funcs command Chaitanya S Prakash
2024-04-08 23:09   ` Masami Hiramatsu
2024-04-16 21:22     ` Arnaldo Carvalho de Melo
2024-04-17 18:26     ` Arnaldo Carvalho de Melo
2024-04-23 11:53       ` Chaitanya S Prakash
2024-04-09  5:32 ` [PATCH V2 0/8] perf tools: Fix test "perf probe of function from different CU" Alexey Dobriyan
2024-04-11 12:10   ` Chaitanya S Prakash
2024-04-14 11:41     ` Alexey Dobriyan
2024-04-17 13:24       ` James Clark
2024-04-17 13:39         ` Arnaldo Carvalho de Melo
2024-04-10  3:34 ` Chaitanya S Prakash
2024-04-11 18:49 ` Arnaldo Carvalho de Melo

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=7ba7a9ee-901c-48a4-bd6c-b59294da7a65@arm.com \
    --to=james.clark@arm.com \
    --cc=ChaitanyaS.Prakash@arm.com \
    --cc=anshuman.khandual@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 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).