From a77c7112d48d1b74a9f0a4d060fee0f4ab24cdd1 Mon Sep 17 00:00:00 2001 From: Charan Ravela <124630918+c-ravela@users.noreply.github.com> Date: Tue, 9 Apr 2024 11:18:53 -0500 Subject: [PATCH] feat: update self generated event find logic --- tarian/c/utils/filters.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tarian/c/utils/filters.h b/tarian/c/utils/filters.h index 4866cfe..7810202 100644 --- a/tarian/c/utils/filters.h +++ b/tarian/c/utils/filters.h @@ -17,7 +17,15 @@ stain bool can_proceed() { return true; } +// has_same_pid checks if the event has same pid as the current task. stain bool has_same_pid(uint32_t pid) { + struct task_struct *task = (struct task_struct *)bpf_get_current_task(); + uint32_t c_pid = get_task_ns_tgid(task); + + return (c_pid == pid); +} + +stain bool has_same__host_pid(uint32_t pid) { u64 fpid = bpf_get_current_pid_tgid() >> 32; return (fpid == pid);