ANDROID: Add vendor hooks to signal.

This hook will allow us to get signal messages so that we can set
limitations for certain tasks and restore them when receiving important signals.

Bug: 184898838
Bug: 281920779

Signed-off-by: Zhuguangqing <zhuguangqing@xiaomi.com>
Change-Id: I83a28b0a6eb413976f4c57f2314d008ad792fa0d
(cherry picked from commit 58e3f869fc3fe84fb7062496ccd049db47f3ed7f)
(cherry picked from commit 265184c21cd9b5314751e641bbc5bbd3b10bd8d5)
This commit is contained in:
Zhuguangqing
2021-03-10 14:56:02 +08:00
committed by Treehugger Robot
parent 92784ab280
commit cbd012971e
3 changed files with 21 additions and 1 deletions
+2
View File
@@ -58,11 +58,13 @@
#include <trace/hooks/softlockup.h>
#include <trace/hooks/power.h>
#include <trace/hooks/dmabuf.h>
#include <trace/hooks/signal.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
* associated with them) to allow external modules to probe them.
*/
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_send_sig_info);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_arch_set_freq_scale);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_transaction_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_set_priority);
+16
View File
@@ -0,0 +1,16 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM signal
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_SIGNAL_H
#include <trace/hooks/vendor_hooks.h>
struct task_struct;
DECLARE_HOOK(android_vh_do_send_sig_info,
TP_PROTO(int sig, struct task_struct *killer, struct task_struct *dst),
TP_ARGS(sig, killer, dst));
#endif /* _TRACE_HOOK_SIGNAL_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
+3 -1
View File
@@ -59,6 +59,8 @@
#include <asm/cacheflush.h>
#include <asm/syscall.h> /* for syscall_get_* */
#undef CREATE_TRACE_POINTS
#include <trace/hooks/signal.h>
/*
* SLAB caches for signal bits.
*/
@@ -1297,7 +1299,7 @@ int do_send_sig_info(int sig, struct kernel_siginfo *info, struct task_struct *p
{
unsigned long flags;
int ret = -ESRCH;
trace_android_vh_do_send_sig_info(sig, current, p);
if (lock_task_sighand(p, &flags)) {
ret = send_signal_locked(sig, info, p, type);
unlock_task_sighand(p, &flags);