Re: [PATCH] x86/mm: determine whether the fault address is canonical

2019-10-07 Thread Sean Christopherson
On Mon, Oct 07, 2019 at 04:44:23PM +0200, Ingo Molnar wrote: > > * Ingo Molnar 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,

Re: [PATCH] x86/mm: determine whether the fault address is canonical

2019-10-07 Thread Ingo Molnar
* Ingo Molnar 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

Re: [PATCH] x86/mm: determine whether the fault address is canonical

2019-10-07 Thread Ingo Molnar
* Sean Christopherson wrote: > On Fri, Oct 04, 2019 at 07:39:08AM -0700, Dave Hansen wrote: > > On 10/4/19 6:45 AM, Changbin Du wrote: > > > +static inline bool is_canonical_addr(u64 addr) > > > +{ > > > +#ifdef CONFIG_X86_64 > > > + int shift = 64 - boot_cpu_data.x86_phys_bits; > > > > I

Re: [PATCH] x86/mm: determine whether the fault address is canonical

2019-10-05 Thread Changbin Du
On Fri, Oct 04, 2019 at 08:14:25AM -0700, Dave Hansen wrote: > On 10/4/19 7:59 AM, Andy Lutomirski wrote: > >> @@ -123,7 +125,8 @@ __visible bool ex_handler_uaccess(const struct > >> exception_table_entry *fixup, > >> unsigned long error_code, > >>

Re: [PATCH] x86/mm: determine whether the fault address is canonical

2019-10-04 Thread Sean Christopherson
On Fri, Oct 04, 2019 at 07:39:08AM -0700, Dave Hansen wrote: > On 10/4/19 6:45 AM, Changbin Du wrote: > > +static inline bool is_canonical_addr(u64 addr) > > +{ > > +#ifdef CONFIG_X86_64 > > + int shift = 64 - boot_cpu_data.x86_phys_bits; > > I think you mean to check the virtual bits member,

Re: [PATCH] x86/mm: determine whether the fault address is canonical

2019-10-04 Thread Dave Hansen
On 10/4/19 7:59 AM, Andy Lutomirski wrote: >> @@ -123,7 +125,8 @@ __visible bool ex_handler_uaccess(const struct >> exception_table_entry *fixup, >> unsigned long error_code, >> unsigned long fault_addr) >> { >> -

Re: [PATCH] x86/mm: determine whether the fault address is canonical

2019-10-04 Thread Andy Lutomirski
On Fri, Oct 4, 2019 at 6:45 AM Changbin Du wrote: > > We know the answer, so don't ask the user. > > Signed-off-by: Changbin Du > --- > arch/x86/mm/extable.c | 5 - > arch/x86/mm/mm_internal.h | 11 +++ > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git

Re: [PATCH] x86/mm: determine whether the fault address is canonical

2019-10-04 Thread Dave Hansen
On 10/4/19 6:45 AM, Changbin Du wrote: > +static inline bool is_canonical_addr(u64 addr) > +{ > +#ifdef CONFIG_X86_64 > + int shift = 64 - boot_cpu_data.x86_phys_bits; I think you mean to check the virtual bits member, not "phys_bits". BTW, I also prefer the IS_ENABLED(CONFIG_) checks to

[PATCH] x86/mm: determine whether the fault address is canonical

2019-10-04 Thread Changbin Du
We know the answer, so don't ask the user. Signed-off-by: Changbin Du --- arch/x86/mm/extable.c | 5 - arch/x86/mm/mm_internal.h | 11 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index