linux/tools/perf/util
Namhyung Kim 4a86d41404 perf tools: Allow build-id with trailing zeros
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>
2021-09-11 16:04:47 -03:00
..
arm-spe-decoder
bpf_skel perf stat: Enable BPF counter with --for-each-cgroup 2021-07-05 14:16:57 -03:00
c++
cs-etm-decoder perf cs-etm: Print the decoder name 2021-09-03 08:17:25 -03:00
include
intel-pt-decoder perf intel-pt: Add a config for max loops without consuming a packet 2021-07-07 11:40:56 -03:00
libunwind
scripting-engines perf script python: Allow reporting the [un]throttle PERF_RECORD_ meta event 2021-09-03 08:18:25 -03:00
affinity.c tools: rename bitmap_alloc() to bitmap_zalloc() 2021-09-08 11:50:27 -07:00
affinity.h
amd-sample-raw.c perf report: Add support to print a textual representation of IBS raw sample data 2021-09-10 18:15:21 -03:00
annotate.c perf bpf: Fix memory leaks relating to BTF. 2021-08-31 15:12:00 -03:00
annotate.h
archinsn.h
arm-spe.c perf arm-spe: Don't wait for PERF_RECORD_EXIT event 2021-07-01 16:14:36 -03:00
arm-spe.h
auxtrace.c perf auxtrace: Add compat_auxtrace_mmap__{read_head|write_tail} 2021-08-31 15:12:00 -03:00
auxtrace.h perf auxtrace: Add compat_auxtrace_mmap__{read_head|write_tail} 2021-08-31 15:12:00 -03:00
block-info.c
block-info.h
block-range.c
block-range.h
bpf-event.c perf bpf: Provide a weak btf__load_from_kernel_by_id() for older libbpf versions 2021-09-10 18:32:04 -03:00
bpf-event.h
bpf-loader.c
bpf-loader.h
bpf-prologue.c
bpf-prologue.h
bpf_counter.c tools: Replace btf__get_from_id() with btf__load_from_kernel_by_id() 2021-07-29 17:23:52 -07:00
bpf_counter.h perf bpf_counter: Move common functions to bpf_counter.h 2021-07-01 16:14:19 -03:00
bpf_counter_cgroup.c libperf: Move 'idx' from tools/perf to perf_evsel::idx 2021-07-09 14:04:28 -03:00
bpf_map.c
bpf_map.h
branch.c
branch.h
Build perf report: Add support to print a textual representation of IBS raw sample data 2021-09-10 18:15:21 -03:00
build-id.c
build-id.h
cache.h
cacheline.c
cacheline.h
call-path.c
call-path.h
callchain.c
callchain.h
cap.c
cap.h
cgroup.c libperf: Move 'leader' from tools/perf to perf_evsel::leader 2021-07-09 14:04:31 -03:00
cgroup.h perf stat: Enable BPF counter with --for-each-cgroup 2021-07-05 14:16:57 -03:00
clockid.c
clockid.h
cloexec.c
cloexec.h
color.c
color.h
color_config.c
comm.c
comm.h
compress.h
config.c perf config: Fix caching and memory leak in perf_home_perfconfig() 2021-08-30 10:06:22 -03:00
config.h
copyfile.c
copyfile.h
counts.c
counts.h
cpu-set-sched.h
cpumap.c
cpumap.h
cputopo.c
cputopo.h
cs-etm.c perf cs-etm: Show a warning for an unknown magic number 2021-09-03 08:18:24 -03:00
cs-etm.h perf cs-etm: Save TRCDEVARCH register 2021-09-03 08:15:10 -03:00
data-convert-bt.c perf tools: Remove repipe argument from perf_session__new() 2021-08-02 10:06:51 -03:00
data-convert-json.c perf tools: Remove repipe argument from perf_session__new() 2021-08-02 10:06:51 -03:00
data-convert.h
data.c perf data: Close all files in close_dir() 2021-07-18 09:27:49 -03:00
data.h
db-export.c perf scripting python: Add 'addr_location' for 'addr' 2021-05-25 10:07:17 -03:00
db-export.h perf scripting python: Add 'addr_location' for 'addr' 2021-05-25 10:07:17 -03:00
debug.c
debug.h perf tools: Add WARN_ONCE equivalent for UI warnings 2021-08-03 17:03:18 -03:00
demangle-java.c
demangle-java.h
demangle-ocaml.c
demangle-ocaml.h
demangle-rust.c
demangle-rust.h
dlfilter.c perf tests: Add dlfilter test 2021-08-11 09:35:44 -03:00
dlfilter.h perf tests: Add dlfilter test 2021-08-11 09:35:44 -03:00
dso.c perf tools: Allow build-id with trailing zeros 2021-09-11 16:04:47 -03:00
dso.h perf tools: Add flag for tracking warnings of missing DSOs 2021-08-03 17:04:08 -03:00
dsos.c
dsos.h
dump-insn.c
dump-insn.h
dwarf-aux.c perf probe: Fix add event failure when running 32-bit perf in a 64-bit kernel 2021-07-18 09:31:15 -03:00
dwarf-aux.h perf probe: Fix add event failure when running 32-bit perf in a 64-bit kernel 2021-07-18 09:31:15 -03:00
dwarf-regs.c
env.c perf env: Add perf_env__cpuid, perf_env__{nr_}pmu_mappings 2021-09-10 11:45:19 -03:00
env.h perf env: Add perf_env__cpuid, perf_env__{nr_}pmu_mappings 2021-09-10 11:45:19 -03:00
event.c
event.h perf script: Add missing PERF_IP_FLAG_CHARS for VM-Entry and VM-Exit 2021-05-21 16:41:37 -03:00
events_stats.h perf session: Report collisions in AUX records 2021-09-03 08:29:55 -03:00
evlist-hybrid.c perf tools: Enable on a list of CPUs for hybrid 2021-08-11 16:07:32 -03:00
evlist-hybrid.h perf tools: Enable on a list of CPUs for hybrid 2021-08-11 16:07:32 -03:00
evlist.c perf tools: Enable on a list of CPUs for hybrid 2021-08-11 16:07:32 -03:00
evlist.h perf evlist: Add evlist__for_each_entry_from() macro 2021-09-01 11:24:43 -03:00
evsel.c perf tools: Factor out copy_config_terms() and free_config_terms() 2021-09-11 16:00:13 -03:00
evsel.h perf tools: Factor out copy_config_terms() and free_config_terms() 2021-09-11 16:00:13 -03:00
evsel_config.h
evsel_fprintf.c
evsel_fprintf.h
evswitch.c
evswitch.h
expr.c
expr.h
expr.l
expr.y
find-map.c
fncache.c
fncache.h
genelf.c
genelf.h
genelf_debug.c
generate-cmdlist.sh
get_current_dir_name.c perf tools: Fixup get_current_dir_name() compilation 2021-08-30 10:06:16 -03:00
get_current_dir_name.h
hashmap.c
hashmap.h
header.c Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
header.h perf tools: Pass a fd to perf_file_header__read_pipe() 2021-08-02 10:09:05 -03:00
help-unknown-cmd.c
help-unknown-cmd.h
hist.c
hist.h
intel-bts.c
intel-bts.h
intel-pt.c perf intel-pt: Add a config for max loops without consuming a packet 2021-07-07 11:40:56 -03:00
intel-pt.h
intlist.c
intlist.h
iostat.c
iostat.h
jit.h
jitdump.c
jitdump.h
kvm-stat.h
levenshtein.c
levenshtein.h
llvm-utils.c perf tools: Fix LLVM download hint link 2021-08-31 15:18:16 -03:00
llvm-utils.h
lzma.c perf lzma: Close lzma stream on exit 2021-07-15 17:30:22 -03:00
machine.c perf machine: Fix refcount usage when processing PERF_RECORD_KSYMBOL 2021-06-19 10:06:46 -03:00
machine.h
map.c Revert "perf map: Fix dso->nsinfo refcounting" 2021-07-30 18:26:22 -03:00
map.h
map_symbol.h
maps.h
mem-events.c perf mem-events: Remove duplicate #undef 2021-06-16 15:05:24 -03:00
mem-events.h perf mem: Support record for hybrid platform 2021-06-01 11:04:59 -03:00
mem2node.c
mem2node.h
memswap.c
memswap.h
metricgroup.c tools: rename bitmap_alloc() to bitmap_zalloc() 2021-09-08 11:50:27 -07:00
metricgroup.h
mmap.c tools: rename bitmap_alloc() to bitmap_zalloc() 2021-09-08 11:50:27 -07:00
mmap.h perf mmap: Add missing bitops.h header 2021-08-31 16:21:17 -03:00
namespaces.c
namespaces.h
ordered-events.c
ordered-events.h
parse-branch-options.c
parse-branch-options.h
parse-events-hybrid.c perf tools: Fix hybrid config terms list corruption 2021-09-11 16:00:34 -03:00
parse-events-hybrid.h
parse-events.c perf tools: Fix hybrid config terms list corruption 2021-09-11 16:00:34 -03:00
parse-events.h
parse-events.l perf tools: Add 'cgroup-switches' software event 2021-05-19 14:23:23 -03:00
parse-events.y perf pmu: Add PMU alias support 2021-09-03 08:33:26 -03:00
parse-regs-options.c
parse-regs-options.h
parse-sublevel-options.c
parse-sublevel-options.h perf tools: Add missing newline at the end of header file 2021-08-24 15:01:31 -03:00
path.c
path.h
perf-hooks-list.h
perf-hooks.c
perf-hooks.h
PERF-VERSION-GEN
perf_api_probe.c perf record: Move probing cgroup sampling support 2021-06-01 10:32:00 -03:00
perf_api_probe.h perf record: Move probing cgroup sampling support 2021-06-01 10:32:00 -03:00
perf_event_attr_fprintf.c perf tools: Fix perf_event_attr__fprintf() missing/dupl. fields 2021-09-11 15:58:36 -03:00
perf_regs.c
perf_regs.h
pfm.c libperf: Fix build error with LIBPFM4=1 2021-07-14 10:05:35 -03:00
pfm.h
pmu-hybrid.c
pmu-hybrid.h
pmu.c perf pmu: Add PMU alias support 2021-09-03 08:33:26 -03:00
pmu.h perf pmu: Add PMU alias support 2021-09-03 08:33:26 -03:00
pmu.l
pmu.y
print_binary.c
print_binary.h
probe-event.c perf probe: Fix add event failure when running 32-bit perf in a 64-bit kernel 2021-07-18 09:31:15 -03:00
probe-event.h perf probe: Fix add event failure when running 32-bit perf in a 64-bit kernel 2021-07-18 09:31:15 -03:00
probe-file.c perf probe-file: Delete namelist in del_events() on the error path 2021-07-18 09:27:37 -03:00
probe-file.h
probe-finder.c perf probe: Fix add event failure when running 32-bit perf in a 64-bit kernel 2021-07-18 09:31:15 -03:00
probe-finder.h perf probe: Fix add event failure when running 32-bit perf in a 64-bit kernel 2021-07-18 09:31:15 -03:00
pstack.c
pstack.h
python-ext-sources
python.c libperf: Move 'idx' from tools/perf to perf_evsel::idx 2021-07-09 14:04:28 -03:00
rb_resort.h
rblist.c
rblist.h
record.c libperf: Move 'leader' from tools/perf to perf_evsel::leader 2021-07-09 14:04:31 -03:00
record.h
rlimit.c
rlimit.h
rwsem.c
rwsem.h
s390-cpumcf-kernel.h
s390-cpumsf-kernel.h
s390-cpumsf.c
s390-cpumsf.h
s390-sample-raw.c
sample-raw.c perf report: Add support to print a textual representation of IBS raw sample data 2021-09-10 18:15:21 -03:00
sample-raw.h perf report: Add support to print a textual representation of IBS raw sample data 2021-09-10 18:15:21 -03:00
session.c perf session: Report collisions in AUX records 2021-09-03 08:29:55 -03:00
session.h perf tools: Pass a fd to perf_file_header__read_pipe() 2021-08-02 10:09:05 -03:00
setns.c
setup.py
sideband_evlist.c
smt.c
smt.h
sort.c perf report: Free generated help strings for sort option 2021-07-15 17:27:52 -03:00
sort.h perf report: Free generated help strings for sort option 2021-07-15 17:27:52 -03:00
spark.c
spark.h
srccode.c perf srccode: Use list_move() instead of equivalent list_del() + list_add() sequence 2021-06-08 09:36:36 -03:00
srccode.h
srcline.c
srcline.h
stat-display.c perf stat: Merge uncore events by default for hybrid platform 2021-07-14 10:05:35 -03:00
stat-shadow.c libperf: Move 'leader' from tools/perf to perf_evsel::leader 2021-07-09 14:04:31 -03:00
stat.c libperf: Move 'leader' from tools/perf to perf_evsel::leader 2021-07-09 14:04:31 -03:00
stat.h
strbuf.c
strbuf.h
stream.c libperf: Move 'idx' from tools/perf to perf_evsel::idx 2021-07-09 14:04:28 -03:00
stream.h
strfilter.c
strfilter.h
string.c
string2.h
strlist.c
strlist.h
svghelper.c
svghelper.h
symbol-elf.c perf top: Fix overflow in elf_sec__is_text() 2021-07-07 10:28:10 -03:00
symbol-minimal.c
symbol.c perf symbol: Look for ImageBase in PE file to compute .text offset 2021-09-10 11:45:19 -03:00
symbol.h
symbol_conf.h
symbol_fprintf.c
symsrc.h
synthetic-events.c perf inject: Fix output from a file to a pipe 2021-08-02 10:14:34 -03:00
synthetic-events.h perf inject: Fix output from a file to a pipe 2021-08-02 10:14:34 -03:00
syscalltbl.c
syscalltbl.h
target.c
target.h perf tools: Create hybrid flag in target 2021-08-11 16:04:33 -03:00
term.c
term.h
thread-stack.c
thread-stack.h
thread.c
thread.h
thread_map.c
thread_map.h
time-utils.c
time-utils.h
tool.h
top.c
top.h
topdown.c
topdown.h
trace-event-info.c
trace-event-parse.c
trace-event-read.c
trace-event-scripting.c perf scripting: Add perf_session to scripting_context 2021-06-01 10:03:17 -03:00
trace-event.c
trace-event.h perf script python: Allow reporting the [un]throttle PERF_RECORD_ meta event 2021-09-03 08:18:25 -03:00
trigger.h
tsc.c
tsc.h
units.c
units.h
unwind-libdw.c
unwind-libdw.h
unwind-libunwind-local.c
unwind-libunwind.c
unwind.h
usage.c
util.c
util.h
values.c
values.h
vdso.c
vdso.h
zlib.c
zstd.c