lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250407162211.172951-1-james.o.hunt@intel.com>
Date: Mon,  7 Apr 2025 17:22:11 +0100
From: "James O. D. Hunt" <james.o.hunt@...el.com>
To: linux-perf-users@...r.kernel.org,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
	Jiri Olsa <jolsa@...nel.org>,
	Ian Rogers <irogers@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>,
	"Liang, Kan" <kan.liang@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org,
	"James O . D . Hunt" <james.o.hunt@...el.com>
Subject: [PATCH] perf: Fix JSON output crash with intel_pt// samples

Current behaviour:

```bash
$ perf record -e intel_pt// true
$ perf data convert --to-json /tmp/perf.json
Segmentation fault (core dumped)
```

With fix applied:

```bash
$ perf record -e intel_pt// true
$ perf data convert --to-json /tmp/perf.json
$ jq < /tmp/perf.json &>/dev/null && echo ok
ok
```

The crash actually occurs in `intel_pt_process_auxtrace_info()` where
`session->itrace_synth_opts->set` is unconditionally dereferenced. This
platform-specific code could be changed to fix the issue, but this patch
fixes the problem generally.

Fixes: f6986c95af84ff2a76847910b4322f542b793bbf ("perf session: Add instruction tracing options")
Signed-off-by: James O. D. Hunt <james.o.hunt@...el.com>
---
 tools/perf/util/data-convert-json.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/data-convert-json.c b/tools/perf/util/data-convert-json.c
index d9f805bf6fb0..b0aaa23659a0 100644
--- a/tools/perf/util/data-convert-json.c
+++ b/tools/perf/util/data-convert-json.c
@@ -326,6 +326,10 @@ int bt_convert__perf2json(const char *input_name, const char *output_name,
 		.force = opts->force,
 	};
 
+	struct itrace_synth_opts itrace_synth_opts = {
+		.set = 0,
+	};
+
 	perf_tool__init(&c.tool, /*ordered_events=*/true);
 	c.tool.sample         = process_sample_event;
 	c.tool.mmap           = perf_event__process_mmap;
@@ -377,6 +381,8 @@ int bt_convert__perf2json(const char *input_name, const char *output_name,
 		goto err_fclose;
 	}
 
+	session->itrace_synth_opts = &itrace_synth_opts;
+
 	if (symbol__init(&session->header.env) < 0) {
 		fprintf(stderr, "Symbol init error!\n");
 		goto err_session_delete;
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ