[Devel] [PATCH RHEL7 COMMIT] proc connector: send events to both VEs if not in VE#0

Konstantin Khorenko khorenko at virtuozzo.com
Thu Aug 31 17:40:43 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.35.5
------>
commit 4ba0afbe02d33bf2e906209521bb59e7fa0def73
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Thu Aug 31 17:40:43 2017 +0300

    proc connector: send events to both VEs if not in VE#0
    
    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>
---
 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 17e0247..81f2e56 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -96,16 +96,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;
@@ -118,6 +118,21 @@ static void proc_event_connector(struct task_struct *task,
 	cn_netlink_send_ve(ve, msg, CN_IDX_PROC, GFP_KERNEL);
 }
 
+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)
 {


More information about the Devel mailing list