[Devel] [PATCH RH9 10/26] proc connector: use generic event helper for id event
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Thu Oct 7 15:53:50 MSK 2021
From: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
(cherry picked from vz8 commit fea602611d49dc7b6d006d061e998b183de072ad)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
drivers/connector/cn_proc.c | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 2938b92e8f91..f19d74f9d8ba 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -144,20 +144,11 @@ void proc_exec_connector(struct task_struct *task)
proc_event_connector(task, PROC_EVENT_EXEC, 0, fill_exec_event);
}
-void proc_id_connector(struct task_struct *task, int which_id)
+static bool fill_id_event(struct proc_event *ev, struct task_struct *task,
+ int which_id)
{
- struct cn_msg *msg;
- struct proc_event *ev;
- __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
const struct cred *cred;
- if (atomic_read(&proc_event_num_listeners) < 1)
- return;
-
- msg = buffer_to_cn_msg(buffer);
- ev = (struct proc_event *)msg->data;
- memset(&ev->event_data, 0, sizeof(ev->event_data));
- ev->what = which_id;
ev->event_data.id.process_pid = task->pid;
ev->event_data.id.process_tgid = task->tgid;
rcu_read_lock();
@@ -170,16 +161,15 @@ void proc_id_connector(struct task_struct *task, int which_id)
ev->event_data.id.e.egid = from_kgid_munged(&init_user_ns, cred->egid);
} else {
rcu_read_unlock();
- return;
+ return false;
}
rcu_read_unlock();
- ev->timestamp_ns = ktime_get_ns();
+ return true;
+}
- memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
- msg->ack = 0; /* not used */
- msg->len = sizeof(*ev);
- msg->flags = 0; /* not used */
- send_msg(msg);
+void proc_id_connector(struct task_struct *task, int which_id)
+{
+ proc_event_connector(task, which_id, which_id, fill_id_event);
}
void proc_sid_connector(struct task_struct *task)
--
2.31.1
More information about the Devel
mailing list