ANDROID: vendor_hooks: Add hooks for debugging exception context

When some processes crashed, we want to save cpu regs(x0-x30、pc、sp),
and context(task_struct、thread_info) to log for debugging

Bug: 166228327

Signed-off-by: yong qian <qianyong@oppo.com>
Change-Id: I4f49ffed583a0e20f1aaa7e445e85a0cbb603bbe
This commit is contained in:
yong qian 2020-09-15 21:14:57 +08:00 committed by Todd Kjos
parent 40f057fb2d
commit 802f342713
3 changed files with 28 additions and 0 deletions

View file

@ -55,6 +55,7 @@
#include <asm/pointer_auth.h>
#include <asm/scs.h>
#include <asm/stacktrace.h>
#include <trace/hooks/minidump.h>
#if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK)
#include <linux/stackprotector.h>
@ -254,6 +255,7 @@ void __show_regs(struct pt_regs *regs)
top_reg = 29;
}
trace_android_vh_show_regs(regs);
show_regs_print_info(KERN_DEFAULT);
print_pstate(regs);

View file

@ -17,6 +17,7 @@
#include <trace/hooks/fpsimd.h>
#include <trace/hooks/topology.h>
#include <trace/hooks/debug.h>
#include <trace/hooks/minidump.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@ -56,3 +57,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_futex_plist_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_is_fpsimd_save);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ipi_stop);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_store);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_regs);

View file

@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM minidump
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_MINIDUMP_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_MINIDUMP_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
struct pt_regs;
DECLARE_HOOK(android_vh_show_regs,
TP_PROTO(struct pt_regs *regs),
TP_ARGS(regs));
#else
#define trace_android_vh_show_regs(regs)
#endif
#endif /* _TRACE_HOOK_MINIDUMP_H */
/* This part must be outside protection */
#include <trace/define_trace.h>