Re: [PATCH 2/8] perf evsel: Do not request ptrauth sample field if not supported

From: Vince Weaver
Date: Tue Jul 12 2022 - 17:30:54 EST


On Mon, 11 Jul 2022, James Clark wrote:
> On 06/07/2022 17:01, Vince Weaver wrote:
> > So in this case you are leaking ARM64-specific info into the generic
> > perf_event_open() call? Is there any way the kernel could implement this
> > without userspace having to deal with the issue?
>
> The alternative to this change is just to call it "PERF_SAMPLE_POINTER_AUTH_MASK"
> and then it's not Arm specific, it's just that only Arm implements it for now.
> This is definitely an option.
>
> But if no platform ever implements something similar then that bit is wasted.
> The intention of adding "PERF_SAMPLE_ARCH_1" was to prevent wasting that bit.
> But as you say, maybe making it arch specific isn't the right way either.

I don't know what the current kernel policy is on this kind of thing, but
in the past perf_event_open was meant to be a generic as possible.
Having architecture-specific magic bits is best avoided.
However I'm not the maintainer for this so really my opinion doesn't
really matter.

I'm just speaking up as a userspace coder who is trying to write
cross-platform tools, and having to maintain obscure arch-specific code
paths in every single utility ends up being a huge pain. And isn't the
whole point of an operating system to abstract this away?

> > can tell there haven't been any documentation patches included for the
> > Makefile.
>
> We plan to update the docs for the syscall, but it's in another repo, and
> we'll wait for this change to be finalised first. I'm not sure what you
> mean about the Makefile?

sorry, that was a mis-type. I meant "manpage" not Makefile.

Vince Weaver
vincent.weaver@xxxxxxxxx