[PATCH v2] arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS)

Dave Martin Dave.Martin at arm.com
Wed Nov 18 13:18:22 EST 2020


On Wed, Nov 18, 2020 at 06:31:21PM +0100, Florian Weimer wrote:
> * Dave Martin:
> 
> > IIUC the default compiler options when using PAC will only use the
> > A key, and only use the PAC instructions that execute as NOPs when the
> > affected key is disabled (precisely so that the code still runs on non-
> > PAC supporting hardware).  But you can't simply flip it on and off while
> > there are function frames on the stack that assume it's either on or off.
> 
> I think we can do the switch at the top-most frame, at least in ld.so.
> I have not thought about statically linked binaries. 8-/

I guess that's one argument for doing this in the kernel, if it can be
done in a compatible way.

We might want an antiproperty for this: so ..._PAC means that PAC is
used and _PAC|_NOIBKEY|_NODBKEY etc. disables specific keys.  
(With no flags, we could keep the legacy behaviour of just enabling all
the keys, but the program might not use PAC at all.)

Alternatively, if the linker provides symbols for the property section,
maybe the libc startup could inspect it?  I think this section is mapped
to PT_LOAD segment in practice.

Cheers
--Dave



More information about the linux-arm-kernel mailing list