Re: [PATCH] x86/pkeys: Explicitly treat PK #PF on kernel address as a bad area

From: Dave Hansen
Date: Thu Aug 30 2018 - 19:33:51 EST


On 08/30/2018 03:40 AM, Thomas Gleixner wrote:
> Given the time span you should be close to ground water with your digging
> by now.

So, turns out that we start our spurious_fault() code with this check:

> if (error_code != (X86_PF_WRITE | X86_PF_PROT) &&
> error_code != (X86_PF_INSTR | X86_PF_PROT))
> return 0;

Which ensures that we only do spurious checking for *very* specific
error_code's. That ends up making the X86_PF_PK check inside of
spurious_fault_check() dead code _anyway_. It's totally unreachable as
far as I can tell.

We could add a comment above the error_code check to make it explicit
that it excludes pkeys.

But, otherwise, I think we can just axe the X86_PF_PK
spurious_fault_check().