kfence: Use pt_regs to generate stack trace on faults 46/281546/1
authorMarco Elver <elver@google.com>
Thu, 5 Nov 2020 09:21:33 +0000 (10:21 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Tue, 20 Sep 2022 02:44:19 +0000 (11:44 +0900)
commitf97a10de5b0b18b914cc1437b1b6e4f8952225d9
tree258243402074c86bb57b8ace38db324701dca34b
parent79c34573c87a196b1e88761495094708884c6b53
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.

Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marco Elver <elver@google.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
[port kfence feature to rpi-5.10.95]
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I58550db6cbed87fd6315df821b2c249f8ab3a330
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