[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220704145333.22557-8-andrew.kilroy@arm.com>
Date: Mon, 4 Jul 2022 15:53:31 +0100
From: Andrew Kilroy <andrew.kilroy@....com>
To: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
acme@...nel.org
Cc: Andrew Kilroy <andrew.kilroy@....com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Tom Rix <trix@...hat.com>,
linux-arm-kernel@...ts.infradead.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, llvm@...ts.linux.dev
Subject: [PATCH 7/8] perf tools: Print ptrauth struct in perf report
This patch prints a perf sample's ptrauth struct so that the PAC masks
can be seen. To aid debugging.
Signed-off-by: Andrew Kilroy <andrew.kilroy@....com>
---
tools/perf/util/session.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 37f833c3c81b..6b56e638d4dd 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1329,6 +1329,13 @@ char *get_page_size_name(u64 size, char *str)
return str;
}
+static void ptrauth__printf(struct ptrauth_info *ptrauth)
+{
+ printf(" . ptrauth enabled keys: 0x%016"PRIx64"\n", ptrauth->enabled_keys);
+ printf(" . ptrauth instruction mask: 0x%016"PRIx64"\n", ptrauth->insn_mask);
+ printf(" . ptrauth data mask: 0x%016"PRIx64"\n", ptrauth->data_mask);
+}
+
static void dump_sample(struct evsel *evsel, union perf_event *event,
struct perf_sample *sample, const char *arch)
{
@@ -1385,6 +1392,14 @@ static void dump_sample(struct evsel *evsel, union perf_event *event,
if (sample_type & PERF_SAMPLE_READ)
sample_read__printf(sample, evsel->core.attr.read_format);
+
+ if (sample_type & PERF_SAMPLE_ARCH_1) {
+ const char *normlzd_arch = perf_env__arch(evsel->evlist->env);
+
+ if (normlzd_arch && strcmp(normlzd_arch, "arm64") == 0)
+ ptrauth__printf(&sample->ptrauth);
+ }
+
}
static void dump_read(struct evsel *evsel, union perf_event *event)
--
2.17.1
Powered by blists - more mailing lists