linux-stable/arch
Jann Horn 2f004eea0f x86/kasan: Print original address on #GP
Make #GP exceptions caused by out-of-bounds KASAN shadow accesses easier
to understand by computing the address of the original access and
printing that. More details are in the comments in the patch.

This turns an error like this:

  kasan: CONFIG_KASAN_INLINE enabled
  kasan: GPF could be caused by NULL-ptr deref or user memory access
  general protection fault, probably for non-canonical address
      0xe017577ddf75b7dd: 0000 [#1] PREEMPT SMP KASAN PTI

into this:

  general protection fault, probably for non-canonical address
      0xe017577ddf75b7dd: 0000 [#1] PREEMPT SMP KASAN PTI
  KASAN: maybe wild-memory-access in range
      [0x00badbeefbadbee8-0x00badbeefbadbeef]

The hook is placed in architecture-independent code, but is currently
only wired up to the X86 exception handler because I'm not sufficiently
familiar with the address space layout and exception handling mechanisms
on other architectures.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrey Konovalov <andreyknvl@google.com>
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: kasan-dev@googlegroups.com
Cc: linux-mm <linux-mm@kvack.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20191218231150.12139-4-jannh@google.com
2019-12-31 13:15:38 +01:00
..
alpha alpha: use pgtable-nopud instead of 4level-fixup 2019-12-04 19:44:14 -08:00
arc treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
arm KVM/arm fixes for .5.5, take #1 2019-12-18 17:47:38 +01:00
arm64 PPC: 2019-12-22 10:26:59 -08:00
c6x c6x: use pgtable-nopud instead of 4level-fixup 2019-12-04 19:44:15 -08:00
csky dma-mapping updates for 5.5-rc1 2019-11-28 11:16:43 -08:00
h8300
hexagon Kbuild updates for v5.5 2019-12-02 17:35:04 -08:00
ia64 drm msm + fixes for 5.5-rc1 2019-12-06 10:28:09 -08:00
m68k Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu 2019-12-05 12:20:42 -08:00
microblaze microblaze: use pgtable-nopmd instead of 4level-fixup 2019-12-04 19:44:15 -08:00
mips Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-12-22 09:54:33 -08:00
nds32 nds32: use pgtable-nopmd instead of 4level-fixup 2019-12-04 19:44:15 -08:00
nios2 nios2: Fix ioremap 2019-12-12 16:34:33 +08:00
openrisc OpenRISC updates for 5.5 2019-12-02 17:18:43 -08:00
parisc parisc: Fix compiler warnings in debug_core.c 2019-12-20 21:01:42 +01:00
powerpc PPC: 2019-12-22 10:26:59 -08:00
riscv riscv: export flush_icache_all to modules 2019-12-27 21:51:01 -08:00
s390 s390/ftrace: save traced function caller 2019-12-18 23:29:26 +01:00
sh Wimplicit-fallthrough patches for 5.5-rc2 2019-12-14 16:10:22 -08:00
sparc treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
um um: add support for folded p4d page tables 2019-12-04 19:44:15 -08:00
unicore32 generic ioremap support 2019-11-28 10:57:12 -08:00
x86 x86/kasan: Print original address on #GP 2019-12-31 13:15:38 +01:00
xtensa arch: sembuf.h: make uapi asm/sembuf.h self-contained 2019-12-04 19:44:14 -08:00
.gitignore
Kconfig arch/Kconfig: fix indentation 2019-12-04 19:44:12 -08:00