Re: [PATCH v6 08/13] arm64: expose user PAC bit positions via ptrace
From: Richard Henderson
Date: Sun Dec 09 2018 - 10:41:51 EST
On 12/7/18 12:39 PM, Kristina Martsenko wrote:
> When pointer authentication is in use, data/instruction pointers have a
> number of PAC bits inserted into them. The number and position of these
> bits depends on the configured TCR_ELx.TxSZ and whether tagging is
> enabled. ARMv8.3 allows tagging to differ for instruction and data
> pointers.
At this point I think it's worth starting a discussion about pointer tagging,
and how we can make it controllable and not mandatory.
With this patch set, we are enabling 7 authentication bits: [54:48].
However, it won't be too long before someone implements support for
ARMv8.2-LVA, at which point, without changes to mandatory pointer tagging, we
will only have 3 authentication bits: [54:52]. This seems useless and easily
brute-force-able.
I assume that pointer tagging is primarily used by Android, since I'm not aware
of anything else that uses it at all.
Unfortunately, there is no obvious path to making this optional that does not
break compatibility with Documentation/arm64/tagged-pointers.txt.
I've been thinking that there ought to be some sort of global setting, akin to
/proc/sys/kernel/randomize_va_space, as well as a prctl which an application
could use to selectively enable TBI/TBID for an application that actually uses
tagging.
The global /proc setting allows the default to remain 1, which would let any
application using tagging to continue working. If there are none, the sysadmin
can set the default to 0. Going forward, applications could be updated to use
the prctl, allowing more systems to set the default to 0.
FWIW, pointer authentication continues to work when enabling TBI, but not the
other way around. Thus the prctl could be used to enable TBI at any point, but
if libc is built with PAuth, there's no way to turn it back off again.
r~