linux-stable/tools/perf/util
Raul Silvera 37ed2cddcb perf inject: Adjust output data offset for backward compatibility
When 'perf inject' creates a new file, it reuses the data offset from
the input file. If there has been a change on the size of the header, as
happened in v5.12 -> v5.13, the new offsets will be wrong, resulting in
a corrupted output file.

This change adds the function perf_session__data_offset to compute the
data offset based on the current header size, and uses that instead of
the offset from the original input file.

Signed-off-by: Raul Silvera <rsilvera@google.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Colin Ian King <colin.king@intel.com>
Cc: Dave Marchevsky <davemarchevsky@fb.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220621152725.2668041-1-rsilvera@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2022-06-26 12:32:55 -03:00
..
arm-spe-decoder
bpf_skel perf record: Add cgroup support for off-cpu profiling 2022-05-26 12:36:58 -03:00
c++ perf clang: Fix header include for LLVM >= 14 2022-04-22 18:39:34 -03:00
cs-etm-decoder
include linkage: remove SYM_FUNC_{START,END}_ALIAS() 2022-02-22 16:21:34 +00:00
intel-pt-decoder perf intel-pt: Add support for emulated ptwrite 2022-05-17 11:55:49 -03:00
libunwind perf unwind arm64: Use perf's copy of kernel headers 2022-05-26 12:36:58 -03:00
scripting-engines perf scripting python: Expose dso and map information 2022-05-27 13:22:13 -03:00
affinity.c
affinity.h
amd-sample-raw.c
annotate.c perf annotate: Drop objdump stderr to avoid getting stuck waiting for stdout output 2022-04-09 14:21:00 -03:00
annotate.h
archinsn.h
arm-spe.c perf arm-spe: Don't set data source if it's not a memory operation 2022-06-19 10:41:43 -03:00
arm-spe.h
arm64-frame-pointer-unwind-support.c perf unwind: Don't show unwind error messages when augmenting frame pointer stack 2022-04-09 12:34:29 -03:00
arm64-frame-pointer-unwind-support.h
auxtrace.c perf tools: Allow all_cpus to be a superset of user_requested_cpus 2022-05-26 12:36:57 -03:00
auxtrace.h perf auxtrace: Remove auxtrace_mmap_params__set_idx() per_cpu parameter 2022-05-26 12:36:57 -03:00
block-info.c
block-info.h
block-range.c
block-range.h
bpf-event.c perf build: Stop using __weak btf__raw_data() to handle older libbpf versions 2022-05-26 11:02:02 -03:00
bpf-event.h
bpf-loader.c perf tools: Move libbpf init in libbpf_init function 2022-04-22 14:02:15 -03:00
bpf-loader.h
bpf-prologue.c
bpf-prologue.h
bpf-utils.c
bpf-utils.h
bpf_counter.c perf build: Stop using __weak bpf_map_create() to handle older libbpf versions 2022-05-26 12:36:56 -03:00
bpf_counter.h
bpf_counter_cgroup.c perf cpumap: Switch to using perf_cpu_map API 2022-05-05 14:07:27 -03:00
bpf_ftrace.c perf evlist: Rename cpus to user_requested_cpus 2022-04-01 16:19:35 -03:00
bpf_map.c
bpf_map.h
bpf_off_cpu.c perf record: Add cgroup support for off-cpu profiling 2022-05-26 12:36:58 -03:00
branch.c perf: Add irq and exception return branch types 2022-03-01 16:19:01 +01:00
branch.h
Build perf record: Enable off-cpu analysis with BPF 2022-05-26 12:36:57 -03:00
build-id.c perf build-id: Fix caching files with a wrong build ID 2022-06-26 12:32:55 -03:00
build-id.h
cache.h
cacheline.c
cacheline.h
call-path.c
call-path.h
callchain.c perf maps: Use a pointer for kmaps 2022-02-14 16:47:13 -03:00
callchain.h
cap.c
cap.h
cgroup.c
cgroup.h
clockid.c
clockid.h
cloexec.c
cloexec.h
color.c
color.h
color_config.c
comm.c
comm.h
compress.h
config.c
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: Fix corrupt inject files when only last branch option is enabled 2022-02-16 13:49:25 -03:00
cs-etm.h
data-convert-bt.c
data-convert-json.c
data-convert.h
data.c perf data: Add has_kcore_dir() 2022-05-23 10:11:39 -03:00
data.h perf data: Add has_kcore_dir() 2022-05-23 10:11:39 -03:00
db-export.c
db-export.h
debug.c
debug.h
demangle-java.c
demangle-java.h
demangle-ocaml.c
demangle-ocaml.h
demangle-rust.c
demangle-rust.h
dlfilter.c
dlfilter.h
dso.c
dso.h perf unwind: Fix segbase for ld.lld linked objects 2022-06-03 21:20:25 +02:00
dsos.c
dsos.h
dump-insn.c
dump-insn.h
dwarf-aux.c
dwarf-aux.h
dwarf-regs.c
env.c
env.h
event.c perf tools: Add guest_code support 2022-05-23 10:18:38 -03:00
event.h perf intel-pt: Synthesize CFE (Control Flow Event) / EVD (Event Data) event 2022-02-15 17:12:13 -03:00
events_stats.h
evlist-hybrid.c perf evlist: Fix failed to use cpu list for uncore events 2022-02-18 09:59:26 -03:00
evlist-hybrid.h
evlist.c perf evlist: Add evlist__add_dummy_on_all_cpus() 2022-05-26 12:36:57 -03:00
evlist.h perf evlist: Add evlist__add_dummy_on_all_cpus() 2022-05-26 12:36:57 -03:00
evsel.c perf unwind: Use dynamic register set for DWARF unwind 2022-05-26 12:41:36 -03:00
evsel.h perf stat: Always keep perf metrics topdown events in a group 2022-05-20 11:11:13 -03:00
evsel_config.h
evsel_fprintf.c
evsel_fprintf.h
evswitch.c
evswitch.h
expr.c
expr.h
expr.l perf expr: Allow exponents on floating point values 2022-06-19 10:41:43 -03:00
expr.y
find-map.c
fncache.c
fncache.h
ftrace.h perf ftrace latency: Add -n/--use-nsec option 2022-03-22 17:43:46 -03:00
genelf.c
genelf.h perf jitdump: Add riscv64 support 2022-04-11 16:37:26 -03:00
genelf_debug.c
generate-cmdlist.sh
get_current_dir_name.c
get_current_dir_name.h
hashmap.c perf tools: Update copy of libbpf's hashmap.c 2022-04-01 16:19:34 -03:00
hashmap.h
header.c perf inject: Adjust output data offset for backward compatibility 2022-06-26 12:32:55 -03:00
header.h perf inject: Adjust output data offset for backward compatibility 2022-06-26 12:32:55 -03:00
help-unknown-cmd.c
help-unknown-cmd.h
hist.c perf report: Add "addr_from" and "addr_to" sort dimensions 2022-02-16 11:21:22 -03:00
hist.h perf report: Add "addr_from" and "addr_to" sort dimensions 2022-02-16 11:21:22 -03:00
intel-bts.c
intel-bts.h
intel-pt.c perf intel-pt: Add guest_code support 2022-05-23 10:19:24 -03:00
intel-pt.h
intlist.c
intlist.h
iostat.c
iostat.h
jit.h
jitdump.c perf namespaces: Add functions to access nsinfo 2022-02-11 14:31:22 -03:00
jitdump.h
kvm-stat.h
levenshtein.c
levenshtein.h
llvm-utils.c
llvm-utils.h
lzma.c
machine.c perf tools: Add guest_code support 2022-05-23 10:18:38 -03:00
machine.h perf tools: Add guest_code support 2022-05-23 10:18:38 -03:00
map.c perf tools: Set build-id using build-id header on new mmap records 2022-03-12 11:01:12 -03:00
map.h perf map: Make map__contains_symbol() args const 2022-02-14 16:59:55 -03:00
map_symbol.h
maps.c perf maps: Move maps code to own C file 2022-02-14 16:56:32 -03:00
maps.h perf maps: Reduce scope of init and exit 2022-02-14 16:52:14 -03:00
mem-events.c perf mem: Add stats for store operation with no available memory level 2022-05-23 09:36:12 -03:00
mem-events.h perf mem: Add stats for store operation with no available memory level 2022-05-23 09:36:12 -03:00
mem2node.c
mem2node.h
memswap.c
memswap.h
metricgroup.c perf metrics: Ensure at least 1 id per metric 2022-06-19 11:24:05 -03:00
metricgroup.h
mmap.c perf auxtrace: Remove auxtrace_mmap_params__set_idx() per_cpu parameter 2022-05-26 12:36:57 -03:00
mmap.h perf record: Introduce compressor at mmap buffer object 2022-02-10 16:26:24 -03:00
namespaces.c perf namespaces: Add functions to access nsinfo 2022-02-11 14:31:22 -03:00
namespaces.h perf namespaces: Add functions to access nsinfo 2022-02-11 14:31:22 -03:00
off_cpu.h perf record: Add cgroup support for off-cpu profiling 2022-05-26 12:36:58 -03:00
ordered-events.c perf report: Output data file name in raw trace dump 2022-02-10 16:27:34 -03:00
ordered-events.h perf report: Output data file name in raw trace dump 2022-02-10 16:27:34 -03:00
parse-branch-options.c
parse-branch-options.h
parse-events-hybrid.c
parse-events-hybrid.h
parse-events.c perf stat: Add requires_cpu flag for uncore 2022-05-26 12:36:57 -03:00
parse-events.h
parse-events.l perf stat: Add user_time and system_time events 2022-04-20 13:44:56 -03:00
parse-events.y
parse-regs-options.c
parse-regs-options.h
parse-sublevel-options.c
parse-sublevel-options.h
path.c perf test: Shell - Limit to only run executable scripts in tests 2022-04-11 16:39:49 -03:00
path.h perf test: Shell - Limit to only run executable scripts in tests 2022-04-11 16:39:49 -03:00
perf-hooks-list.h
perf-hooks.c
perf-hooks.h
PERF-VERSION-GEN perf tools: Fix version kernel tag 2022-03-22 17:12:40 -03:00
perf_api_probe.c
perf_api_probe.h
perf_event_attr_fprintf.c
perf_regs.c perf tools arm64: Add support for VG register 2022-05-27 13:21:33 -03:00
perf_regs.h
pfm.c
pfm.h
pmu-hybrid.c
pmu-hybrid.h
pmu.c perf cpumap: Use for each loop 2022-02-11 14:05:49 -03:00
pmu.h
pmu.l
pmu.y
print_binary.c
print_binary.h
probe-event.c perf maps: Use a pointer for kmaps 2022-02-14 16:47:13 -03:00
probe-event.h
probe-file.c
probe-file.h
probe-finder.c
probe-finder.h
pstack.c
pstack.h
python-ext-sources perf unwind: Use dynamic register set for DWARF unwind 2022-05-26 12:41:36 -03:00
python.c perf python: Add perf_env stubs that will be needed in evsel__open_strerror() 2022-03-26 10:55:57 -03:00
rb_resort.h
rblist.c
rblist.h
record.c perf evlist: Rename cpus to user_requested_cpus 2022-04-01 16:19:35 -03:00
record.h perf record: Extend --threads command line option 2022-02-10 16:27:00 -03:00
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
sample-raw.h
session.c perf tools: Add guest_code support 2022-05-23 10:18:38 -03:00
session.h perf report: Output data file name in raw trace dump 2022-02-10 16:27:34 -03:00
setns.c
setup.py perf build: Don't use -ffat-lto-objects in the python feature test when building with clang-13 2022-04-09 12:34:29 -03:00
sideband_evlist.c perf evlist: Rename cpus to user_requested_cpus 2022-04-01 16:19:35 -03:00
smt.c
smt.h
sort.c perf report: Add "addr_from" and "addr_to" sort dimensions 2022-02-16 11:21:22 -03:00
sort.h perf report: Add "addr_from" and "addr_to" sort dimensions 2022-02-16 11:21:22 -03:00
spark.c
spark.h
srccode.c
srccode.h
srcline.c
srcline.h
stat-display.c perf stat: Make use of index clearer with perf_counts 2022-05-23 09:54:02 -03:00
stat-shadow.c perf metrics: Support all tool events 2022-05-09 10:16:49 -03:00
stat.c perf stat: Make use of index clearer with perf_counts 2022-05-23 09:54:02 -03:00
stat.h perf stat: Merge event counts from all hybrid PMUs 2022-04-22 14:23:35 -03:00
strbuf.c
strbuf.h
stream.c
stream.h
strfilter.c
strfilter.h
string.c
string2.h
strlist.c
strlist.h
svghelper.c
svghelper.h
symbol-elf.c perf symbol: Pass is_kallsyms to symbols__fixup_end() 2022-04-28 10:51:20 -03:00
symbol-minimal.c
symbol.c perf symbol: Remove arch__symbols__fixup_end() 2022-04-28 10:51:40 -03:00
symbol.h perf symbol: Remove arch__symbols__fixup_end() 2022-04-28 10:51:40 -03:00
symbol_conf.h perf tools: Add guest_code support 2022-05-23 10:18:38 -03:00
symbol_fprintf.c
symsrc.h
synthetic-events.c perf evlist: Rename cpus to user_requested_cpus 2022-04-01 16:19:35 -03:00
synthetic-events.h
syscalltbl.c
syscalltbl.h
target.c
target.h
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 perf report: Output data file name in raw trace dump 2022-02-10 16:27:34 -03:00
top.c perf evlist: Rename cpus to user_requested_cpus 2022-04-01 16:19:35 -03:00
top.h perf tui: Only support --tui with slang 2022-02-15 17:15:29 -03:00
topdown.c perf stat: Support hybrid --topdown option 2022-04-24 07:50:18 -03:00
topdown.h perf stat: Support hybrid --topdown option 2022-04-24 07:50:18 -03:00
trace-event-info.c
trace-event-parse.c perf tools: Use ARRAY_SIZE() instead of ad hoc equivalent, spotted by array_size.cocci 2022-03-07 14:54:54 -03:00
trace-event-read.c
trace-event-scripting.c
trace-event.c
trace-event.h
trigger.h
tsc.c
tsc.h
units.c
units.h
unwind-libdw.c perf unwind: Don't show unwind error messages when augmenting frame pointer stack 2022-04-09 12:34:29 -03:00
unwind-libdw.h perf unwind: Don't show unwind error messages when augmenting frame pointer stack 2022-04-09 12:34:29 -03:00
unwind-libunwind-local.c perf unwind: Fix uninitialized variable 2022-06-19 10:41:43 -03:00
unwind-libunwind.c perf unwind: Don't show unwind error messages when augmenting frame pointer stack 2022-04-09 12:34:29 -03:00
unwind.h perf unwind: Don't show unwind error messages when augmenting frame pointer stack 2022-04-09 12:34:29 -03:00
usage.c
util.c perf tools: Print warning when HAVE_DEBUGINFOD_SUPPORT is not set and user tries to use debuginfod support 2022-04-20 13:36:36 -03:00
util.h
values.c
values.h
vdso.c
vdso.h
zlib.c
zstd.c