[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YC10WPYjps4Z0H8B@krava>
Date: Wed, 17 Feb 2021 20:54:00 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Nicholas Fraser <nfraser@...eweavers.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Ian Rogers <irogers@...gle.com>,
"Frank Ch. Eigler" <fche@...hat.com>,
Song Liu <songliubraving@...com>,
Adrian Hunter <adrian.hunter@...el.com>,
Kim Phillips <kim.phillips@....com>,
Tommi Rantala <tommi.t.rantala@...ia.com>,
Remi Bernon <rbernon@...eweavers.com>,
linux-kernel@...r.kernel.org,
Ulrich Czekalla <uczekalla@...eweavers.com>,
Huw Davies <huw@...eweavers.com>
Subject: Re: [PATCH 1/4] perf buildid-cache: Don't skip 16-byte build-ids
On Wed, Feb 10, 2021 at 02:17:25PM -0500, Nicholas Fraser wrote:
> lsdir_bid_tail_filter() ignored any build-id that wasn't exactly 20
> bytes. This worked only for SHA-1 build-ids. The build-id for a PE file
> is always a 16-byte GUID and ELF files can also have MD5 or UUID
> build-ids.
>
> This fix changes the filter to allow build-ids between 16 and 20 bytes.
>
> Signed-off-by: Nicholas Fraser <nfraser@...eweavers.com>
Acked-by: Jiri Olsa <jolsa@...hat.com>
thanks,
jirka
> ---
> tools/perf/util/build-id.c | 5 +++--
> tools/perf/util/build-id.h | 4 +++-
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
> index 02df36b30ac5..e32e8f2ff3bd 100644
> --- a/tools/perf/util/build-id.c
> +++ b/tools/perf/util/build-id.c
> @@ -448,7 +448,8 @@ static bool lsdir_bid_tail_filter(const char *name __maybe_unused,
> int i = 0;
> while (isxdigit(d->d_name[i]) && i < SBUILD_ID_SIZE - 3)
> i++;
> - return (i == SBUILD_ID_SIZE - 3) && (d->d_name[i] == '\0');
> + return (i >= SBUILD_ID_MIN_SIZE - 3) && (i <= SBUILD_ID_SIZE - 3) &&
> + (d->d_name[i] == '\0');
> }
>
> struct strlist *build_id_cache__list_all(bool validonly)
> @@ -490,7 +491,7 @@ struct strlist *build_id_cache__list_all(bool validonly)
> }
> strlist__for_each_entry(nd2, linklist) {
> if (snprintf(sbuild_id, SBUILD_ID_SIZE, "%s%s",
> - nd->s, nd2->s) != SBUILD_ID_SIZE - 1)
> + nd->s, nd2->s) > SBUILD_ID_SIZE - 1)
> goto err_out;
> if (validonly && !build_id_cache__valid_id(sbuild_id))
> continue;
> diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
> index 02613f4b2c29..c19617151670 100644
> --- a/tools/perf/util/build-id.h
> +++ b/tools/perf/util/build-id.h
> @@ -2,8 +2,10 @@
> #ifndef PERF_BUILD_ID_H_
> #define PERF_BUILD_ID_H_ 1
>
> -#define BUILD_ID_SIZE 20
> +#define BUILD_ID_SIZE 20 /* SHA-1 length in bytes */
> +#define BUILD_ID_MIN_SIZE 16 /* MD5/UUID/GUID length in bytes */
> #define SBUILD_ID_SIZE (BUILD_ID_SIZE * 2 + 1)
> +#define SBUILD_ID_MIN_SIZE (BUILD_ID_MIN_SIZE * 2 + 1)
>
> #include "machine.h"
> #include "tool.h"
> --
> 2.30.0
>
Powered by blists - more mailing lists