Re: [PATCH V8 26/44] x86/fault: Print PKS MSR on fault

From: Edgecombe, Rick P
Date: Fri Feb 18 2022 - 12:29:08 EST


On Thu, 2022-02-17 at 22:01 -0800, Ira Weiny wrote:
> Are you suggesting the PKRU should be printed instead or in addition
> to the
> PKS?

Well I was just thinking that PKRS should only be printed if it's an
access via a supervisor pte. I guess printing PKRU for user faults
could be more complete. I'm not sure how PKRU could be useful though, I
can only think if smap was disabled and there was an errant access.

>
> AFAICS this really should not present a problem even if the fault is
> due to a
> user pkey violation. It is simply extra information.

Yea there is still enough information to decode the fault, but it could
be misleading at a glance. You're right it's not a big deal, but if it
were me I would fix it.

Just looking more, you would have to look up the PTE like is happening
for PF_INSTR. That code would need to be tweaked a little to also
include X86_PF_PK.

On the other hand, someone once told me to avoid touching the oops code
because if it gets broken it makes debugging very hard. It's better to
be reliable than fancy for that stuff.