Re: Minor PKRU bug?

From: Dave Hansen
Date: Tue Jul 12 2016 - 19:00:04 EST


On 07/12/2016 03:55 PM, H. Peter Anvin wrote:
> On 07/12/16 08:32, Dave Hansen wrote:
>> On 07/09/2016 02:27 PM, Andy Lutomirski wrote:
>>> is_prefetch in arch/x86/mm/fault.c can be called on a user address
>>> that's not readable due to PKRU. This could break it. You might need
>>> to add a get_user_exec or similar.
>>
>> Thanks for the heads-up. I think I'll just need a version that does
>> something along the lines of stac/clac, but with PKRU.
>>
>> I think I can do it with an "_exec" variant of probe_kernel_address(),
>> but it's a bit messy.
>
> Can this particular codepath even be executed on a PKRU-equipped
> machine? I thought it was a bug fix for a specific AMD CPU line.

Yeah, I think we hit it unconditionally in the naughty paths of the page
fault handler. I don't see any CPU model detection in the call path. I
think we just assume that everybody has prefetch bugs.