All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Kilroy <andrew.kilroy@arm.com>
To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	acme@kernel.org
Cc: Andrew Kilroy <andrew.kilroy@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>, Tom Rix <trix@redhat.com>,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH 7/8] perf tools: Print ptrauth struct in perf report
Date: Mon,  4 Jul 2022 15:53:31 +0100	[thread overview]
Message-ID: <20220704145333.22557-8-andrew.kilroy@arm.com> (raw)
In-Reply-To: <20220704145333.22557-1-andrew.kilroy@arm.com>

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


WARNING: multiple messages have this Message-ID (diff)
From: Andrew Kilroy <andrew.kilroy@arm.com>
To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	acme@kernel.org
Cc: Andrew Kilroy <andrew.kilroy@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>, Tom Rix <trix@redhat.com>,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, llvm@lists.linux.dev
Subject: [PATCH 7/8] perf tools: Print ptrauth struct in perf report
Date: Mon,  4 Jul 2022 15:53:31 +0100	[thread overview]
Message-ID: <20220704145333.22557-8-andrew.kilroy@arm.com> (raw)
In-Reply-To: <20220704145333.22557-1-andrew.kilroy@arm.com>

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-07-04 14:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-04 14:53 [PATCH 0/8] Perf stack unwinding with pointer authentication Andrew Kilroy
2022-07-04 14:53 ` Andrew Kilroy
2022-07-04 14:53 ` [PATCH 1/8] perf arm64: Send pointer auth masks to ring buffer Andrew Kilroy
2022-07-04 14:53   ` Andrew Kilroy
2022-08-10 13:23   ` Arnaldo Carvalho de Melo
2022-08-10 13:23     ` Arnaldo Carvalho de Melo
2022-09-07 15:21     ` James Clark
2022-09-07 15:21       ` James Clark
2022-07-04 14:53 ` [PATCH 2/8] perf evsel: Do not request ptrauth sample field if not supported Andrew Kilroy
2022-07-04 14:53   ` Andrew Kilroy
2022-07-06 16:01   ` Vince Weaver
2022-07-06 16:01     ` Vince Weaver
2022-07-11  9:25     ` James Clark
2022-07-11  9:25       ` James Clark
2022-07-12 21:30       ` Vince Weaver
2022-07-12 21:30         ` Vince Weaver
2022-07-04 14:53 ` [PATCH 3/8] perf test: Update arm64 tests to expect ptrauth masks Andrew Kilroy
2022-07-04 14:53   ` Andrew Kilroy
2022-07-04 14:53 ` [PATCH 4/8] perf tools: arm64: Read ptrauth data from kernel Andrew Kilroy
2022-07-04 14:53   ` Andrew Kilroy
2022-07-04 14:53 ` [PATCH 5/8] perf libunwind: Feature check for libunwind ptrauth callback Andrew Kilroy
2022-07-04 14:53   ` Andrew Kilroy
2022-07-04 14:53 ` [PATCH 6/8] perf libunwind: arm64 pointer authentication Andrew Kilroy
2022-07-04 14:53   ` Andrew Kilroy
2022-07-04 14:53 ` Andrew Kilroy [this message]
2022-07-04 14:53   ` [PATCH 7/8] perf tools: Print ptrauth struct in perf report Andrew Kilroy
2022-07-04 14:53 ` [PATCH 8/8] perf test arm64: Test unwinding with PACs on gcc & clang compilers Andrew Kilroy
2022-07-04 14:53   ` Andrew Kilroy
2022-09-07 15:00 ` [PATCH 0/8] Perf stack unwinding with pointer authentication James Clark
2022-09-07 15:00   ` James Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220704145333.22557-8-andrew.kilroy@arm.com \
    --to=andrew.kilroy@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bpf@vger.kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=trix@redhat.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.