linux-perf-users.vger.kernel.org archive mirror
 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 6/8] perf libunwind: arm64 pointer authentication
Date: Mon,  4 Jul 2022 15:53:30 +0100	[thread overview]
Message-ID: <20220704145333.22557-7-andrew.kilroy@arm.com> (raw)
In-Reply-To: <20220704145333.22557-1-andrew.kilroy@arm.com>

Make use of new changes in libunwind to decode a pointer which has a
pointer authentication code (PAC) in it.

Before this patch, perf is not able to produce stack traces where the
instruction addresses had PACs in them.

This commit has a dependency on a libunwind pull request:

  https://github.com/libunwind/libunwind/pull/360

Signed-off-by: Andrew Kilroy <andrew.kilroy@arm.com>
---
 tools/perf/util/unwind-libunwind-local.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tools/perf/util/unwind-libunwind-local.c b/tools/perf/util/unwind-libunwind-local.c
index 6e5b8cce47bf..6983a3e76a71 100644
--- a/tools/perf/util/unwind-libunwind-local.c
+++ b/tools/perf/util/unwind-libunwind-local.c
@@ -652,6 +652,15 @@ static void display_error(int err)
 	}
 }
 
+#ifndef NO_LIBUNWIND_ARM64_PTRAUTH
+static unw_word_t get_insn_mask(unw_addr_space_t addr_space __maybe_unused, void *unwind_info_ptr)
+{
+	struct unwind_info *ui = unwind_info_ptr;
+	unw_word_t mask = ui->sample->ptrauth.insn_mask;
+	return mask;
+}
+#endif
+
 static unw_accessors_t accessors = {
 	.find_proc_info		= find_proc_info,
 	.put_unwind_info	= put_unwind_info,
@@ -661,6 +670,9 @@ static unw_accessors_t accessors = {
 	.access_fpreg		= access_fpreg,
 	.resume			= resume,
 	.get_proc_name		= get_proc_name,
+#ifndef NO_LIBUNWIND_ARM64_PTRAUTH
+	.ptrauth_insn_mask	= get_insn_mask,
+#endif
 };
 
 static int _unwind__prepare_access(struct maps *maps)
-- 
2.17.1


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

Thread overview: 15+ 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 ` [PATCH 1/8] perf arm64: Send pointer auth masks to ring buffer Andrew Kilroy
2022-08-10 13:23   ` Arnaldo Carvalho de Melo
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-06 16:01   ` Vince Weaver
2022-07-11  9:25     ` James Clark
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 ` [PATCH 4/8] perf tools: arm64: Read ptrauth data from kernel 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 [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-09-07 15:00 ` [PATCH 0/8] Perf stack unwinding with pointer authentication 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-7-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).