The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at 
https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 997e08bc1862187452bd756a09eb2c991a71a0b1
Author: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com>
Date:   Fri Sep 24 14:56:34 2021 +0300

    ve/kobj: Send events per VE instead of all net-namespaces broadcasting
    
    Currently uevents are sending broadcastly to all net-namespaces present
    in the system which is leading to problem of C/R'ing systemd based
    containers (netlink socket sees data from the node and we can't dump
    until the data is read).
    So let's send broadcast events to net namespaces of the particular VE only.
    
    Signed-off-by: Cyrill Gorcunov <gorcu...@virtuozzo.com>
    
    Rebased to RHEL8 beta kernel:
    Signed-off-by: Konstantin Khorenko <khore...@virtuozzo.com>
    
    https://jira.sw.ru/browse/PSBM-133986
    
    (cherry picked from commit 5cba05d6f334ac07ffdd9563ac9e2099477fe167)
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalit...@virtuozzo.com>
---
 lib/kobject_uevent.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index db150f72ba9a..08b56d8a1836 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -29,6 +29,7 @@
 #include <net/netlink.h>
 #include <net/net_namespace.h>
 
+#include <linux/ve.h>
 
 u64 uevent_seqnum;
 #ifdef CONFIG_UEVENT_HELPER
@@ -317,10 +318,15 @@ static int uevent_net_broadcast_untagged(struct 
kobj_uevent_env *env,
        /* send netlink message */
        list_for_each_entry(ue_sk, &uevent_sock_list, list) {
                struct sock *uevent_sock = ue_sk->sk;
+               struct ve_struct *owner_ve;
 
                if (!netlink_has_listeners(uevent_sock, 1))
                        continue;
 
+               owner_ve = sock_net(uevent_sock)->owner_ve;
+               if (!ve_is_super(owner_ve) && owner_ve != get_exec_env())
+                       continue;
+
                if (!skb) {
                        retval = -ENOMEM;
                        skb = alloc_uevent_skb(env, action_string, devpath);
@@ -347,6 +353,11 @@ static int uevent_net_broadcast_tagged(struct sock *usk,
        struct user_namespace *owning_user_ns = sock_net(usk)->user_ns;
        struct sk_buff *skb = NULL;
        int ret = 0;
+       struct ve_struct *owner_ve;
+
+       owner_ve = sock_net(usk)->owner_ve;
+       if (!ve_is_super(owner_ve) && owner_ve != get_exec_env())
+               return -EINVAL;
 
        skb = alloc_uevent_skb(env, action_string, devpath);
        if (!skb)
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to