Re: [PATCH 33/33] x86, pkeys: execute-only support

From: Andy Lutomirski
Date: Wed Feb 17 2016 - 19:47:09 EST


On Wed, Feb 17, 2016 at 2:53 PM, Dave Hansen <dave@xxxxxxxx> wrote:
> On 02/17/2016 02:17 PM, Andy Lutomirski wrote:
>>> > Is there a way to detect this feature's availability without userspace
>>> > having to set up a segv handler and attempting to read a
>>> > PROT_EXEC-only region? (i.e. cpu flag for protection keys, or a way to
>>> > check the protection to see if PROT_READ got added automatically,
>>> > etc?)
>>> >
>> We could add an HWCAP.
>
> I'll bite. What's an HWCAP?

It's a CPU capability vector that's passed to every program as an auxv
entry. On x86, ELF_HWCAP is useless (it's already fully used up for
pointless purposes for CPUID stuff), but ELF_HWCAP2 could be added and
a bit could be defined like HWCAP2_PROT_EXEC_ONLY.

Some day, WRFSBASE, etc will be advertised via ELF_HWCAP2, I suspect.

--Andy

--
Andy Lutomirski
AMA Capital Management, LLC