lkml.org 
[lkml]   [2019]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] x86/mm: determine whether the fault address is canonical

* Ingo Molnar <mingo@kernel.org> wrote:

> > All the other reasons would require a fairly egregious kernel bug, hence
> > the speculation that the #GP is due to a non-canonical address. Something
> > like the following would be more precise, though highly unlikely to ever
> > be exercised, e.g. KVM had a fatal bug related to injecting a non-zero
> > error code that went unnoticed for years.
> >
> > WARN_ONCE(trapnr == X86_TRAP_GP, "General protection fault in user access. %s?\n",
> > (IS_ENABLED(CONFIG_X86_64) && !error_code) ? "Non-canonical address" :
> > "Segmentation bug");
>
> Instead of trying to guess the reason of the #GPF (which guess might be
> wrong), please just state it as the reason if we are sure that the cause
> is a non-canonical address - and provide a best-guess if it's not but
> clearly signal that it's a guess.
>
> I.e. if I understood all the cases correctly we'd have three types of
> messages generated:
>
> !error_code:
> "General protection fault in user access, due to non-canonical address."
>
> error_code && !is_canonical_addr(fault_addr):
> "General protection fault in user access. Non-canonical address?"
>
> error_code && is_canonical_addr(fault_addr):
> "General protection fault in user access. Segmentation bug?"

Now that I've read the rest of the thread, since fault_addr is always 0
we can ignore most of this I suspect ...

Thanks,

Ingo

\
 
 \ /
  Last update: 2019-10-07 16:45    [W:0.644 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site