On 09/04/2018 02:27 PM, Andy Lutomirski wrote: > Also, I doubt it matters right here, but !X86_PF_USER isn't quite the > same thing as "originating from kernel code" -- it can also be user > code that does a CPL0 access due to exception delivery or access to a > descriptor table. Which you saw plenty of times while debugging > PTI... :) I doubt any of those should be spurious, though.
Yeah, you're talking about "implicit supervisor access". Right? I definitely saw those during KAISER/KPTI development. But, it's probably worth noting that the code that we have that _looks_ for these: > /* > * It's safe to allow irq's after cr2 has been saved and the > * vmalloc fault has been handled. > * > * User-mode registers count as a user access even for any > * potential system fault or CPU buglet: > */ > if (user_mode(regs)) { > local_irq_enable(); > error_code |= X86_PF_USER; > flags |= FAULT_FLAG_USER; is in the user address space handling portion of the code. So, it's really not useful for any of the _known_ implicit supervisor-mode accesses. I think it can only get triggered in the case of hardware or software bugs.