ANDROID: arm64: add vendor hooks for unusal abort cases
Add hooks to gather data of unsual aborts and summarize it with other information. Bug: 222638752 Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com> Change-Id: I74eb36b8551ed9a5e6dc87507939a7f4d81c9c18
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include <asm/sysreg.h>
|
||||
#include <asm/system_misc.h>
|
||||
|
||||
#include <trace/hooks/traps.h>
|
||||
|
||||
/*
|
||||
* Handle IRQ/context state management when entering from kernel mode.
|
||||
* Before this function is called it is not safe to call regular kernel code,
|
||||
@@ -283,6 +285,7 @@ static void noinstr __panic_unhandled(struct pt_regs *regs, const char *vector,
|
||||
vector, smp_processor_id(), esr,
|
||||
esr_get_class_string(esr));
|
||||
|
||||
trace_android_rvh_panic_unhandled(regs, vector, esr);
|
||||
__show_regs(regs);
|
||||
panic("Unhandled exception");
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
#include <asm/system_misc.h>
|
||||
#include <asm/sysreg.h>
|
||||
|
||||
#include <trace/hooks/traps.h>
|
||||
|
||||
static bool __kprobes __check_eq(unsigned long pstate)
|
||||
{
|
||||
return (pstate & PSR_Z_BIT) != 0;
|
||||
@@ -495,6 +497,7 @@ void do_undefinstr(struct pt_regs *regs)
|
||||
if (call_undef_hook(regs) == 0)
|
||||
return;
|
||||
|
||||
trace_android_rvh_do_undefinstr(regs);
|
||||
BUG_ON(!user_mode(regs));
|
||||
force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
|
||||
}
|
||||
@@ -513,6 +516,7 @@ void do_ptrauth_fault(struct pt_regs *regs, unsigned int esr)
|
||||
* Unexpected FPAC exception or pointer authentication failure in
|
||||
* the kernel: kill the task before it does any more harm.
|
||||
*/
|
||||
trace_android_rvh_do_ptrauth_fault(regs, esr);
|
||||
BUG_ON(!user_mode(regs));
|
||||
force_signal_inject(SIGILL, ILL_ILLOPN, regs->pc, esr);
|
||||
}
|
||||
@@ -898,6 +902,8 @@ void __noreturn arm64_serror_panic(struct pt_regs *regs, u32 esr)
|
||||
|
||||
pr_crit("SError Interrupt on CPU%d, code 0x%08x -- %s\n",
|
||||
smp_processor_id(), esr, esr_get_class_string(esr));
|
||||
|
||||
trace_android_rvh_arm64_serror_panic(regs, esr);
|
||||
if (regs)
|
||||
__show_regs(regs);
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <trace/hooks/softlockup.h>
|
||||
#include <trace/hooks/power.h>
|
||||
#include <trace/hooks/fault.h>
|
||||
#include <trace/hooks/traps.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
@@ -237,3 +238,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_die_kernel_fault);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_sea);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_mem_abort);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_sp_pc_abort);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_undefinstr);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_ptrauth_fault);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_panic_unhandled);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_arm64_serror_panic);
|
||||
|
||||
32
include/trace/hooks/traps.h
Normal file
32
include/trace/hooks/traps.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM traps
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
|
||||
#if !defined(_TRACE_HOOK_TRAPS_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_TRAPS_H
|
||||
#include <linux/tracepoint.h>
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
struct pt_regs;
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_do_undefinstr,
|
||||
TP_PROTO(struct pt_regs *regs),
|
||||
TP_ARGS(regs),
|
||||
TP_CONDITION(!user_mode(regs)));
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_do_ptrauth_fault,
|
||||
TP_PROTO(struct pt_regs *regs, unsigned int esr),
|
||||
TP_ARGS(regs, esr),
|
||||
TP_CONDITION(!user_mode(regs)));
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_panic_unhandled,
|
||||
TP_PROTO(struct pt_regs *regs, const char *vector, unsigned int esr),
|
||||
TP_ARGS(regs, vector, esr), 1);
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_arm64_serror_panic,
|
||||
TP_PROTO(struct pt_regs *regs, unsigned int esr),
|
||||
TP_ARGS(regs, esr), 1);
|
||||
|
||||
#endif /* _TRACE_HOOK_TRAPS_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
Reference in New Issue
Block a user