From: Alexander Potapenko <glider@xxxxxxxxxx> Subject: kfence: use error_report_end tracepoint Make it possible to trace KFENCE error reporting. A good usecase is watching for trace events from the userspace to detect and process memory corruption reports from the kernel. Link: https://lkml.kernel.org/r/20210121131915.1331302-3-glider@xxxxxxxxxx Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx> Suggested-by: Marco Elver <elver@xxxxxxxxxx> Cc: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Petr Mladek <pmladek@xxxxxxxx> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx> Cc: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/kfence/report.c | 2 ++ 1 file changed, 2 insertions(+) --- a/mm/kfence/report.c~kfence-use-error_report_end-tracepoint +++ a/mm/kfence/report.c @@ -14,6 +14,7 @@ #include <linux/seq_file.h> #include <linux/stacktrace.h> #include <linux/string.h> +#include <trace/events/error_report.h> #include <asm/kfence.h> @@ -248,6 +249,7 @@ void kfence_report_error(unsigned long a show_regs(regs); else dump_stack_print_info(KERN_ERR); + trace_error_report_end(ERROR_DETECTOR_KFENCE, address); pr_err("==================================================================\n"); lockdep_on(); _