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 Suren Baghdasaryan
parent 0e1cb27700
commit 242b11e574
3 changed files with 9 additions and 0 deletions

View File

@@ -431,3 +431,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_swapinfo);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_pages); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_pages);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_shmem_page_flag); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_shmem_page_flag);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_pidfd_open);

View File

@@ -391,6 +391,10 @@ DECLARE_HOOK(android_vh_setscheduler_uclamp,
TP_PROTO(struct task_struct *tsk, int clamp_id, unsigned int value), TP_PROTO(struct task_struct *tsk, int clamp_id, unsigned int value),
TP_ARGS(tsk, clamp_id, value)); TP_ARGS(tsk, clamp_id, value));
DECLARE_HOOK(android_vh_pidfd_open,
TP_PROTO(struct pid *p),
TP_ARGS(p));
/* macro versions of hooks are no longer required */ /* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SCHED_H */ #endif /* _TRACE_HOOK_SCHED_H */

View File

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