[PATCH 6/5] x86/fault: Clean up the page fault oops decoder a bit

From: Ingo Molnar
Date: Thu Nov 22 2018 - 03:41:27 EST



* Andy Lutomirski <luto@xxxxxxxxxx> wrote:

> One of Linus' favorite hobbies seems to be looking at OOPSes and
> decoding the error code in his head. This is not one of my favorite
> hobbies :)
>
> Teach the page fault OOPS hander to decode the error code. If it's
> a !USER fault from user mode, print an explicit note to that effect
> and print out the addresses of various tables that might cause such
> an error.
>
> With this patch applied, if I intentionally point the LDT at 0x0 and
> run the x86 selftests, I get:
>
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
> HW error: normal kernel read fault
> This was a system access from user code
> IDT: 0xfffffe0000000000 (limit=0xfff) GDT: 0xfffffe0000001000 (limit=0x7f)
> LDTR: 0x50 -- base=0x0 limit=0xfff7
> TR: 0x40 -- base=0xfffffe0000003000 limit=0x206f
> PGD 800000000456e067 P4D 800000000456e067 PUD 4623067 PMD 0
> SMP PTI
> CPU: 0 PID: 153 Comm: ldt_gdt_64 Not tainted 4.19.0+ #1317
> Hardware name: ...
> RIP: 0033:0x401454

I've applied your series, with one small edit, the following message:

> HW error: normal kernel read fault

will IMHO confuse the heck out of users, thinking that their hardware is
broken...

Yes, the message is accurate, in MM pagefault language it's indeed the HW
error code, but it's a language very few people speak.

So I edited it over to say '#PF error code'. I also applied a few other
minor cleanups - see the changelog below.

Let me know if you have any objections.

Thanks,

Ingo

===============>