lkml.org 
[lkml]   [2022]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 7/8] perf tools: Print ptrauth struct in perf report
Date
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@arm.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
\
 
 \ /
  Last update: 2022-07-04 16:58    [W:0.123 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site