mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
ANDROID: arm64: add vendor hooks for kernel fault cases
Add hooks to gather data of kernel fault and summarize it with
other information.
Bug: 273189923
Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I7d6a66837f2e896a413bd8d878f26928669d96e6
(cherry picked from commit 61d7b6c741)
This commit is contained in:
@@ -44,6 +44,8 @@
|
||||
#include <asm/traps.h>
|
||||
#include <asm/virt.h>
|
||||
|
||||
#include <trace/hooks/fault.h>
|
||||
|
||||
struct fault_info {
|
||||
int (*fn)(unsigned long far, unsigned long esr,
|
||||
struct pt_regs *regs);
|
||||
@@ -313,6 +315,7 @@ static void die_kernel_fault(const char *msg, unsigned long addr,
|
||||
|
||||
kasan_non_canonical_hook(addr);
|
||||
|
||||
trace_android_rvh_die_kernel_fault(msg, addr, esr, regs);
|
||||
mem_abort_decode(esr);
|
||||
|
||||
show_pte(addr);
|
||||
@@ -760,6 +763,7 @@ static int do_sea(unsigned long far, unsigned long esr, struct pt_regs *regs)
|
||||
*/
|
||||
siaddr = untagged_addr(far);
|
||||
}
|
||||
trace_android_rvh_do_sea(siaddr, esr, regs);
|
||||
arm64_notify_die(inf->name, regs, inf->sig, inf->code, siaddr, esr);
|
||||
|
||||
return 0;
|
||||
@@ -867,6 +871,8 @@ NOKPROBE_SYMBOL(do_mem_abort);
|
||||
|
||||
void do_sp_pc_abort(unsigned long addr, unsigned long esr, struct pt_regs *regs)
|
||||
{
|
||||
trace_android_rvh_do_sp_pc_abort(addr, esr, regs);
|
||||
|
||||
arm64_notify_die("SP/PC alignment exception", regs, SIGBUS, BUS_ADRALN,
|
||||
addr, esr);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include <trace/hooks/bug.h>
|
||||
#include <trace/hooks/softlockup.h>
|
||||
#include <trace/hooks/power.h>
|
||||
#include <trace/hooks/fault.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
@@ -161,3 +162,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_report_bug);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_watchdog_timer_softlockup);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_freeze_todo_unfrozen);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_die_kernel_fault);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_sea);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_sp_pc_abort);
|
||||
|
||||
26
include/trace/hooks/fault.h
Normal file
26
include/trace/hooks/fault.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM fault
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
|
||||
#if !defined(_TRACE_HOOK_FAULT_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_FAULT_H
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
struct pt_regs;
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_die_kernel_fault,
|
||||
TP_PROTO(const char *msg, unsigned long addr, unsigned long esr, struct pt_regs *regs),
|
||||
TP_ARGS(msg, addr, esr, regs), 1);
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_do_sea,
|
||||
TP_PROTO(unsigned long addr, unsigned long esr, struct pt_regs *regs),
|
||||
TP_ARGS(addr, esr, regs), 1);
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_do_sp_pc_abort,
|
||||
TP_PROTO(unsigned long addr, unsigned long esr, struct pt_regs *regs),
|
||||
TP_ARGS(addr, esr, regs),
|
||||
TP_CONDITION(!user_mode(regs)));
|
||||
|
||||
#endif /* _TRACE_HOOK_FAULT_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
Reference in New Issue
Block a user