linux-snapdragon/tools/perf
Namhyung Kim 24a026e4ae perf tools: Allow build-id with trailing zeros
commit 4a86d41404005a3c7e7b6065e8169ac6202887a9 upstream.

Currently perf saves a build-id with size but old versions assumes the
size of 20.  In case the build-id is less than 20 (like for MD5), it'd
fill the rest with 0s.

I saw a problem when old version of perf record saved a binary in the
build-id cache and new version of perf reads the data.  The symbols
should be read from the build-id cache (as the path no longer has the
same binary) but it failed due to mismatch in the build-id.

  symsrc__init: build id mismatch for /home/namhyung/.debug/.build-id/53/e4c2f42a4c61a2d632d92a72afa08f00000000/elf.

The build-id event in the data has 20 byte build-ids, but it saw a
different size (16) when it reads the build-id of the elf file in the
build-id cache.

  $ readelf -n ~/.debug/.build-id/53/e4c2f42a4c61a2d632d92a72afa08f00000000/elf

  Displaying notes found in: .note.gnu.build-id
    Owner                Data size 	Description
    GNU                  0x00000010	NT_GNU_BUILD_ID (unique build ID bitstring)
      Build ID: 53e4c2f42a4c61a2d632d92a72afa08f

Let's fix this by allowing trailing zeros if the size is different.

Fixes: 39be8d0115 ("perf tools: Pass build_id object to dso__build_id_equal()")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210910224630.1084877-1-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-26 14:10:16 +02:00
..
arch tools headers UAPI: Sync files changed by the memfd_secret new syscall 2021-07-14 10:05:35 -03:00
bench perf bench inject-buildid: Handle writen() errors 2021-09-22 12:39:30 +02:00
Documentation perf intel-pt: Add a config for max loops without consuming a packet 2021-07-07 11:40:56 -03:00
examples/bpf perf tools: Fix various typos in comments 2021-03-23 17:13:43 -03:00
include/bpf
jvmti perf tools: Fix various typos in comments 2021-03-23 17:13:43 -03:00
pmu-events perf vendor events power10: Adds 24x7 nest metric events for power10 platform 2021-07-07 11:35:49 -03:00
python tweewide: Fix most Shebang lines 2020-12-08 23:30:04 +09:00
scripts perf scripting python: intel-pt-events.py: Add --insn-trace and --src-trace 2021-06-01 10:05:20 -03:00
tests perf test: Fix bpf test sample mismatch reporting 2021-09-26 14:10:16 +02:00
trace perf beauty: Update copy of linux/socket.h with the kernel sources 2021-06-19 10:09:08 -03:00
ui libperf: Move 'idx' from tools/perf to perf_evsel::idx 2021-07-09 14:04:28 -03:00
util perf tools: Allow build-id with trailing zeros 2021-09-26 14:10:16 +02:00
.gitignore perf: Update .gitignore file 2021-04-20 08:40:20 -03:00
Build perf daemon: Add daemon command 2021-02-09 15:42:57 -03:00
builtin-annotate.c perf annotate: Add itrace options support 2021-06-16 15:07:42 -03:00
builtin-bench.c perf bench: Add build-id injection benchmark 2020-10-13 10:59:42 -03:00
builtin-buildid-cache.c perf buildid-cache: Add --debuginfod option to specify a server to fetch debug files 2020-12-28 12:20:39 -03:00
builtin-buildid-list.c perf buildid-list: Initialize zstd_data 2021-05-17 20:39:17 -03:00
builtin-c2c.c perf c2c: Support record for hybrid platform 2021-06-01 11:06:35 -03:00
builtin-config.c
builtin-daemon.c Merge remote-tracking branch 'torvalds/master' into perf/core 2021-03-29 10:39:10 -03:00
builtin-data.c perf data: Add JSON export 2021-04-29 10:30:58 -03:00
builtin-diff.c libperf: Move 'idx' from tools/perf to perf_evsel::idx 2021-07-09 14:04:28 -03:00
builtin-evlist.c perf evlist: Support pipe mode display 2020-12-17 14:36:17 -03:00
builtin-ftrace.c perf ftrace: Fix access to pid in array when setting a pid filter 2021-04-23 15:58:10 -03:00
builtin-help.c
builtin-inject.c perf inject: Close inject.output on exit 2021-07-15 17:27:52 -03:00
builtin-kallsyms.c
builtin-kmem.c perf evlist: Use the right prefix for 'struct evlist' 'find' methods 2020-11-30 09:48:07 -03:00
builtin-kvm.c perf evlist: Use the right prefix for 'struct evlist' mmap pages parsing method 2020-11-30 15:15:30 -03:00
builtin-list.c
builtin-lock.c perf tools: Fix various typos in comments 2021-03-23 17:13:43 -03:00
builtin-mem.c perf mem: Fix wrong verbose output for recording events 2021-06-01 11:05:30 -03:00
builtin-probe.c perf probe: Do not show @plt function by default 2021-07-07 10:28:10 -03:00
builtin-record.c perf record: Add a dummy event on hybrid systems to collect metadata records 2021-07-09 14:04:32 -03:00
builtin-report.c perf report: Free generated help strings for sort option 2021-07-15 17:27:52 -03:00
builtin-sched.c perf sched: Fix record failure when CONFIG_SCHEDSTATS is not set 2021-07-18 09:36:37 -03:00
builtin-script.c perf script: Fix memory 'threads' and 'cpus' leaks on exit 2021-07-15 17:28:14 -03:00
builtin-stat.c perf stat: Merge uncore events by default for hybrid platform 2021-07-14 10:05:35 -03:00
builtin-timechart.c
builtin-top.c libperf: Move 'leader' from tools/perf to perf_evsel::leader 2021-07-09 14:04:31 -03:00
builtin-trace.c perf trace: Free strings in trace__parse_events_option() 2021-07-15 17:35:57 -03:00
builtin-version.c perf version: Add a feature for libpfm4 2020-11-04 09:42:40 -03:00
builtin.h perf daemon: Add daemon command 2021-02-09 15:42:57 -03:00
check-headers.sh perf tools: Copy uapi/asm/perf_regs.h from the kernel for MIPS 2021-06-01 10:07:46 -03:00
command-list.txt perf stat: Enable iostat mode for x86 platforms 2021-04-20 08:40:20 -03:00
CREDITS
design.txt
Makefile perf tools: Add a build-test variant to use in builds from a tarball 2021-04-20 08:43:58 -03:00
Makefile.config perf unwind: Do not overwrite FEATURE_CHECK_LDFLAGS-libunwind-{x86,aarch64} 2021-09-22 12:39:30 +02:00
Makefile.perf perf trace: Fix the perf trace link location 2021-07-07 10:28:10 -03:00
MANIFEST scripts/bpf: Abstract eBPF API target parameter 2021-03-04 18:39:45 -08:00
perf-archive.sh perf archive: Fix filtering of empty build-ids 2021-03-06 16:54:31 -03:00
perf-completion.sh
perf-iostat.sh perf stat: Enable iostat mode for x86 platforms 2021-04-20 08:40:20 -03:00
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh
perf.c perf debug: Move debug initialization earlier 2021-05-27 13:24:22 -03:00
perf.h