aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-inject.c
diff options
context:
space:
mode:
authorRaul Silvera <rsilvera@google.com>2022-06-21 15:27:25 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-06-26 12:32:55 -0300
commit37ed2cddcbf1b52b03b9b2344c752ed867fa3539 (patch)
tree4ad4defb508f0c18e06469bf1528c917b9e28d4d /tools/perf/builtin-inject.c
parentperf trace beauty: Fix generation of errno id->str table on ALT Linux (diff)
downloadlinux-dev-37ed2cddcbf1b52b03b9b2344c752ed867fa3539.tar.xz
linux-dev-37ed2cddcbf1b52b03b9b2344c752ed867fa3539.zip
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>
Diffstat (limited to 'tools/perf/builtin-inject.c')
-rw-r--r--tools/perf/builtin-inject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 063f74f5b8db..54d4e508a092 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -918,7 +918,7 @@ static int __cmd_inject(struct perf_inject *inject)
inject->tool.tracing_data = perf_event__repipe_tracing_data;
}
- output_data_offset = session->header.data_offset;
+ output_data_offset = perf_session__data_offset(session->evlist);
if (inject->build_id_all) {
inject->tool.mmap = perf_event__repipe_buildid_mmap;