ANDROID: vendor_hooks:vendor hook for pidfd_open

Add vendor hook when detecting process status through
pidfd_open.

Bug: 238725692
Change-Id: I565988cb8bf6dd44ab4dc15c410c2dcf50703def
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
This commit is contained in:
xiaofeng
2022-07-12 20:43:49 +08:00
committed by Treehugger Robot
parent 571f9fff87
commit 4a84a59cb8
3 changed files with 9 additions and 0 deletions

View File

@@ -409,3 +409,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpumask_any_and_distribute);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_pidfd_open);

View File

@@ -451,6 +451,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_update_rq_clock_pelt,
TP_PROTO(struct rq *rq, s64 delta, bool *ret),
TP_ARGS(rq, delta, ret), 1);
DECLARE_HOOK(android_vh_pidfd_open,
TP_PROTO(struct pid *p),
TP_ARGS(p));
/* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SCHED_H */

View File

@@ -45,6 +45,9 @@
#include <net/sock.h>
#include <uapi/linux/pidfd.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/sched.h>
struct pid init_struct_pid = {
.count = REFCOUNT_INIT(1),
.tasks = {
@@ -602,6 +605,7 @@ SYSCALL_DEFINE2(pidfd_open, pid_t, pid, unsigned int, flags)
else
fd = -EINVAL;
trace_android_vh_pidfd_open(p);
put_pid(p);
return fd;
}