]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf session: Add byte-swap handler for PERF_RECORD_COMPRESSED2
authorArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 2 May 2026 16:22:33 +0000 (13:22 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 29 May 2026 14:44:34 +0000 (11:44 -0300)
commit1c9d2ac2ead70d4d7c70e7f1276d68ca86e15fa4
tree01fc3af5824aacf3d0487c8d8cb57c6c149ab87f
parent3669697bda41c562d90eb38f54881cc02ef3d51c
perf session: Add byte-swap handler for PERF_RECORD_COMPRESSED2

PERF_RECORD_COMPRESSED2 events carry a data_size field that must be
byte-swapped when reading cross-endian perf.data files.  Without a
swap handler, reading COMPRESSED2 events on a different-endian machine
would misinterpret data_size as a garbage value, causing the
decompression path to read the wrong number of bytes.

The compressed payload itself is a raw byte stream and needs no
swapping.

Fixes: 208c0e16834472bb ("perf record: Add 8-byte aligned event type PERF_RECORD_COMPRESSED2")
Reported-by: sashiko-bot@kernel.org # Running on a local machine
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Claude:claude-opus-4.6-1m
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/session.c