OrangePi_CM5/tools/perf
Michael Petlan 204d38dc6a perf symbols: Fix symbol size calculation condition
commit 3cf6a32f3f2a45944dd5be5c6ac4deb46bcd3bee upstream.

Before this patch, the symbol end address fixup to be called, needed two
conditions being met:

  if (prev->end == prev->start && prev->end != curr->start)

Where
  "prev->end == prev->start" means that prev is zero-long
                             (and thus needs a fixup)
and
  "prev->end != curr->start" means that fixup hasn't been applied yet

However, this logic is incorrect in the following situation:

*curr  = {rb_node = {__rb_parent_color = 278218928,
  rb_right = 0x0, rb_left = 0x0},
  start = 0xc000000000062354,
  end = 0xc000000000062354, namelen = 40, type = 2 '\002',
  binding = 0 '\000', idle = 0 '\000', ignore = 0 '\000',
  inlined = 0 '\000', arch_sym = 0 '\000', annotate2 = false,
  name = 0x1159739e "kprobe_optinsn_page\t[__builtin__kprobes]"}

*prev = {rb_node = {__rb_parent_color = 278219041,
  rb_right = 0x109548b0, rb_left = 0x109547c0},
  start = 0xc000000000062354,
  end = 0xc000000000062354, namelen = 12, type = 2 '\002',
  binding = 1 '\001', idle = 0 '\000', ignore = 0 '\000',
  inlined = 0 '\000', arch_sym = 0 '\000', annotate2 = false,
  name = 0x1095486e "optinsn_slot"}

In this case, prev->start == prev->end == curr->start == curr->end,
thus the condition above thinks that "we need a fixup due to zero
length of prev symbol, but it has been probably done, since the
prev->end == curr->start", which is wrong.

After the patch, the execution path proceeds to arch__symbols__fixup_end
function which fixes up the size of prev symbol by adding page_size to
its end offset.

Fixes: 3b01a413c1 ("perf symbols: Improve kallsyms symbol end addr calculation")
Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: http://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-23 09:13:29 +01:00
..
Documentation
…
arch perf tools: Fix arm64 build error with gcc-11 2021-09-03 10:09:29 +02:00
bench perf bench futex: Fix memory leak of perf_cpu_map__new() 2021-11-26 10:39:13 +01:00
examples/bpf
…
include/bpf
…
jvmti
…
pmu-events perf jevents: Tidy error handling 2021-10-13 10:04:27 +02:00
python
…
scripts
…
tests perf tests: Remove bash construct from record+zstd_comp_decomp.sh 2021-11-26 10:39:13 +01:00
trace
…
ui perf hist: Fix memory leak of a perf_hpp_fmt 2021-12-08 09:03:20 +01:00
util perf symbols: Fix symbol size calculation condition 2022-03-23 09:13:29 +01:00
.gitignore
…
Build
…
CREDITS
…
MANIFEST
…
Makefile
…
Makefile.config tools build: Remove needless libpython-version feature check that breaks test-all fast path 2021-12-14 11:32:42 +01:00
Makefile.perf
…
builtin-annotate.c
…
builtin-bench.c
…
builtin-buildid-cache.c
…
builtin-buildid-list.c
…
builtin-c2c.c
…
builtin-config.c
…
builtin-data.c
…
builtin-diff.c
…
builtin-evlist.c
…
builtin-ftrace.c
…
builtin-help.c
…
builtin-inject.c perf inject: Fix itrace space allowed for new attributes 2021-12-17 10:14:41 +01:00
builtin-kallsyms.c
…
builtin-kmem.c
…
builtin-kvm.c
…
builtin-list.c
…
builtin-lock.c
…
builtin-mem.c
…
builtin-probe.c
…
builtin-record.c
…
builtin-report.c perf report: Fix memory leaks around perf_tip() 2021-12-08 09:03:20 +01:00
builtin-sched.c perf sched: Fix record failure when CONFIG_SCHEDSTATS is not set 2021-07-28 14:35:36 +02:00
builtin-script.c perf script: Fix CPU filtering of a script's switch events 2022-01-05 12:40:34 +01:00
builtin-stat.c
…
builtin-timechart.c
…
builtin-top.c
…
builtin-trace.c
…
builtin-version.c
…
builtin.h
…
check-headers.sh
…
command-list.txt
…
design.txt
…
perf-archive.sh
…
perf-completion.sh
…
perf-read-vdso.c
…
perf-sys.h
…
perf-with-kcore.sh
…
perf.c
…
perf.h
…