Re: [PATCH] x86/fault: Decode and print #PF oops in human readable form

From: Sean Christopherson
Date: Fri Dec 07 2018 - 14:18:51 EST


On Fri, Dec 07, 2018 at 10:52:49AM -0800, Linus Torvalds wrote:
> On Fri, Dec 7, 2018 at 10:44 AM Sean Christopherson
> <sean.j.christopherson@xxxxxxxxx> wrote:
> >
> > Remove the per-bit decoding of the error code and instead print the raw
> > error code followed by a brief description of what caused the fault, the
> > effective privilege level of the faulting access, and whether the fault
> > originated in user code or kernel code.
>
> This doesn't quite work as-is, though.
>
> For example, at least the PK bit is independent of the other bits and
> would be interesting in the human-legible version, but doesn't show up
> there at all.

Heh, I actually intentionally omitted protection keys thinking it'd be
superfluous, i.e. "go look at the error code bits if you care that much".

> That said, I think the end result might be more legible than the
> previous version, so this approach may well be good, it just needs at
> least that "permissions violation" part to be extended with whether
> it was PK or not.
>
> Also, shouldn't we show the SGX bit too as some kind of "during SGX"
> extension on the "in user/kernel space" part?

The SGX bit isn't defined in mainline yet. But yeah, I can see how
printing e.g. "SGX EPCM violation" would be a lot more helpful than
a vanilla "permissions violation". I'll send a v2 with the PK bit
added and a slightly reworded changelog.