]> www.infradead.org Git - users/jedix/linux-maple.git/commit
kfence: use pt_regs to generate stack trace on faults
authorMarco Elver <elver@google.com>
Thu, 31 Dec 2020 22:04:34 +0000 (22:04 +0000)
committerJohannes Weiner <hannes@cmpxchg.org>
Thu, 31 Dec 2020 22:04:34 +0000 (22:04 +0000)
commitaf784ce277c6cf7624f3fd8a44de54bc433daaca
treecbdb93d48c2864dcb13128daeea255982e9cd066
parent6048363a7817b1ece71d712bf05a26f7ba8141aa
kfence: use pt_regs to generate stack trace on faults

Instead of removing the fault handling portion of the stack trace based on
the fault handler's name, just use struct pt_regs directly.

Change kfence_handle_page_fault() to take a struct pt_regs, and plumb it
through to kfence_report_error() for out-of-bounds, use-after-free, or
invalid access errors, where pt_regs is used to generate the stack trace.

If the kernel is a DEBUG_KERNEL, also show registers for more information.

Link: https://lkml.kernel.org/r/20201105092133.2075331-1-elver@google.com
Signed-off-by: Marco Elver <elver@google.com>
Suggested-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Jann Horn <jannh@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/arm64/include/asm/kfence.h
arch/arm64/mm/fault.c
arch/x86/include/asm/kfence.h
arch/x86/mm/fault.c
include/linux/kfence.h
mm/kfence/core.c
mm/kfence/kfence.h
mm/kfence/report.c