On Fri, Oct 4, 2019 at 6:45 AM Changbin Du <[email protected]> wrote:
>
> We know the answer, so don't ask the user.
>
> Signed-off-by: Changbin Du <[email protected]>
> ---
>  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 4d75bc656f97..5196e586756f 100644
> --- a/arch/x86/mm/extable.c
> +++ b/arch/x86/mm/extable.c
> @@ -8,6 +8,8 @@
>  #include <asm/traps.h>
>  #include <asm/kdebug.h>
>
> +#include "mm_internal.h"
> +
>  typedef bool (*ex_handler_t)(const struct exception_table_entry *,
>                             struct pt_regs *, int, unsigned long,
>                             unsigned long);
> @@ -123,7 +125,8 @@ __visible bool ex_handler_uaccess(const struct 
> exception_table_entry *fixup,
>                                   unsigned long error_code,
>                                   unsigned long fault_addr)
>  {
> -       WARN_ONCE(trapnr == X86_TRAP_GP, "General protection fault in user 
> access. Non-canonical address?");
> +       WARN_ONCE(trapnr == X86_TRAP_GP, "General protection fault at %s 
> address in user access.",
> +                 is_canonical_addr(fault_addr) ? "canonical" : 
> "non-canonical");

Unless the hardware behaves rather differently from the way I think it
does, fault_addr is garbage for anything other than #PF and sometimes
for #DF.  (And maybe the virtualization faults?)  I don't believe that
#GP fills in CR2.

Reply via email to