[Devel] [PATCH RH9 23/26] proc connector: send events to both VEs if not in VE#0
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Thu Oct 7 15:54:03 MSK 2021
From: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
This is needed to preserve current behaviour, when process in initial pid and
user namespaces (i.e. in VE#0) can receive events from all the processes in
the system.
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
(cherry picked from vz8 commit cf171d6baf24b967796092bbc482aaddd0104d25)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
drivers/connector/cn_proc.c | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index c795a27e2a98..16091278ebb3 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -105,16 +105,16 @@ static int proc_event_num_listeners(struct ve_struct *ve)
return 0;
}
-static void proc_event_connector(struct task_struct *task,
- int what, int cookie,
- bool (*fill_event)(struct proc_event *ev,
- struct ve_struct *ve,
- struct task_struct *task,
- int cookie))
+static void proc_event_connector_ve(struct task_struct *task,
+ struct ve_struct *ve,
+ int what, int cookie,
+ bool (*fill_event)(struct proc_event *ev,
+ struct ve_struct *ve,
+ struct task_struct *task,
+ int cookie))
{
struct cn_msg *msg;
__u8 buffer[CN_PROC_MSG_SIZE] __aligned(8);
- struct ve_struct *ve = task->task_ve;
if (proc_event_num_listeners(ve) < 1)
return;
@@ -127,6 +127,21 @@ static void proc_event_connector(struct task_struct *task,
send_msg_ve(ve, msg);
}
+static void proc_event_connector(struct task_struct *task,
+ int what, int cookie,
+ bool (*fill_event)(struct proc_event *ev,
+ struct ve_struct *ve,
+ struct task_struct *task,
+ int cookie))
+{
+ struct ve_struct *ve = task->task_ve;
+
+ if (!ve_is_super(ve))
+ proc_event_connector_ve(task, ve, what, cookie, fill_event);
+
+ proc_event_connector_ve(task, get_ve0(), what, cookie, fill_event);
+}
+
static bool fill_fork_event(struct proc_event *ev, struct ve_struct *ve,
struct task_struct *task, int unused)
{
--
2.31.1
More information about the Devel
mailing list