diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index c98fa4f0cab2..340ba2eca40d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -45,6 +45,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -225,3 +226,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_util_est_update); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_setscheduler_uclamp); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_wake_up_sync); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_wake_flags); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_report_bug); diff --git a/include/trace/hooks/bug.h b/include/trace/hooks/bug.h new file mode 100644 index 000000000000..ddb1b9d595ad --- /dev/null +++ b/include/trace/hooks/bug.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM bug +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_BUG_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_BUG_H +#include +#include + +DECLARE_RESTRICTED_HOOK(android_rvh_report_bug, + TP_PROTO(const char *file, unsigned int line, unsigned long bugaddr), + TP_ARGS(file, line, bugaddr), 1); + +#endif /* _TRACE_HOOK_BUG_H */ +/* This part must be outside protection */ +#include diff --git a/lib/bug.c b/lib/bug.c index 45a0584f6541..b42b6c712304 100644 --- a/lib/bug.c +++ b/lib/bug.c @@ -49,6 +49,8 @@ #include #include +#include + extern struct bug_entry __start___bug_table[], __stop___bug_table[]; static inline unsigned long bug_addr(const struct bug_entry *bug) @@ -207,6 +209,8 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) pr_crit("Kernel BUG at %pB [verbose debug info unavailable]\n", (void *)bugaddr); + trace_android_rvh_report_bug(file, line, bugaddr); + return BUG_TRAP_TYPE_BUG; }