Re: [PATCH v2 1/1] perf arm64: Send pointer auth masks to ring buffer

From: Peter Zijlstra
Date: Thu Oct 20 2022 - 13:01:12 EST


On Thu, Oct 20, 2022 at 06:49:17PM +0200, Peter Zijlstra wrote:
> On Thu, Oct 20, 2022 at 11:19:20AM +0100, James Clark wrote:
> > From: Andrew Kilroy <andrew.kilroy@xxxxxxx>
> >
> > Perf report cannot produce callgraphs using dwarf on arm64 where pointer
> > authentication is enabled. This is because libunwind and libdw cannot
> > unmangle instruction pointers that have a pointer authentication code
> > (PAC) embedded in them.
> >
> > libunwind and libdw need to be given an instruction mask which they can
> > use to arrive at the correct return address that does not contain the
> > PAC.
> >
> > The bits in the return address that contain the PAC can differ by
> > process, so this patch adds a new sample field PERF_SAMPLE_ARCH_1
> > to allow the kernel to send the masks up to userspace perf.
> >
> > This field can be used in a architecture specific fashion, but on
> > arm64, it contains the ptrauth mask information. The event will
> > currently fail to open on architectures other than arm64 if
> > PERF_SAMPLE_ARCH_1 is set. It will also fail to open on arm64 if
> > CONFIG_ARM64_PTR_AUTH isn't set, as the data would always be zeros.
>
> A little more information please; wth is pointer authentication? Are we

Mark got me: https://events.static.linuxfound.org/sites/events/files/slides/slides_23.pdf

> going to be having the same thing with x86 LAM where only a subset of
> the available bits have meaning to the hardware?
>
> Why do we want the same mask repeated over and over with each sample;
> should this not be part of the address space (side-band) data?