From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 3D2438017D for ; Tue, 10 Nov 2026 16:33:21 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AAGVxBO016273; Tue, 10 Nov 2026 19:32:00 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AAGVxBO016273 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794328321; bh=6giu3n5jfHpDwjiDSgfSk+C/2138zyjbwFFL8BjtvDo=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=UDqI9C5MyYhpu52j4cmL6fPbchZm4ah7l/1u+fXDQjMBK8rVByXD+mBDPwshww9O2 FFrUCXABC42DU9MjwDiGsLSo2o3zHZETV6yZDIgAeIjX45spSBCI+MuPcj6437uI5o MxO04vlT65P3ixi2Kbn23MVXuZ0ZJUofhKH3quXyy8GETvBGftqH2Ai8euRtBlySOU ffZeBVIsXWjYEza/ZaykvnjsDSwUZR8xT+ttEvl+445hkz0YBlJou7QZpCXiyMTpgu tNong5F6I8v5r+9El3tvKuGqYmYk2p9exly19Gm5UjjuzCRkEqyEWTbv/Avfr8zED2 cP8xFOx3I6O5A== Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AAGVdTR016224 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 10 Nov 2026 19:31:39 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AAGVdTR016224 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="AUuLM4gb" Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-49febef74e3so15228755e9.0 for ; Tue, 10 Nov 2026 08:31:39 -0800 (PST) X-Gm-Message-State: APuU4Z9PSwIgev6xg5Jb2t70sHTdngVdxtR5bguHOL9THmVXmFmunLhm cZ25Mqd2sU9PKZ+RnTd7/I6suQTmY6aiEd17rA1ghT9Iduq2ZQtIokcWYq2xXVLmaQ1L8JKlNI1 2Jlmwoyovvdvq+6G6IrSh4WoN4w+YqpwnwmMUIKqnFVCXyG7Pv9O4GQ== X-Gm-Gg: AYBFou3m/gsxfYIKpPdv0O+rkeUItNe8chSOWW3WIL/U6kgOiKonmZjn629/tgtwM4F VN0qsQSe7yzU3Xx9jrdn2gwKhgvJFhrwIRPAopzmr6Spnkeni193k0+n0xvy9MCrmC1sJzT+Nh9 WMuTN+8tng8q5nrONGJhj8GN/qGmUdS06qFFZC8U2zjuhu6/+KEmbTIWBxxv6yDltCeCDFOcqq0 2eG4wHMYGiLuiAHa6g4v2fPKjAnk8cM3BYWVHkQCvrTHOZqRbAnvoColiUnRYMPuOprJq8JvC0p CtEDu7GGQA== X-Received: by 2002:a05:600c:6087:b0:4b4:a551:681a with SMTP id 5b1f17b1804b1-4ba0233cbbbmr53581555e9.3.1794328299069; Tue, 10 Nov 2026 08:31:39 -0800 (PST) X-Received: by 2002:a05:600c:6087:b0:4b4:a551:681a with SMTP id 5b1f17b1804b1-4ba0233cbbbmr53581245e9.3.1794328298670; Tue, 10 Nov 2026 08:31:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794328298; cv=none; d=google.com; s=arc-20260327; b=BmEqzGFLKjnvdEm4UsegB9V33Vff5UHvotrBdbhzT2SW15sqTUUrPFL4A4vj4sJU3h s8qEe+MQo6piloKilvkYoDDr67mxRYA80hJ9zmsQR7qy9MvaKfNLV+HtvsppmLEkyzjX l2mtYTyMktKgPLWGqHCidb5LVH9h9CZvmIgZtjEujnB9+SPIF+GpJobSoIi30UT3cY2A AR0JzO8OsokZ0Wt6a5RMD3zaH5C5D8TrlOcqwXlnD0sOdrINW1UD81Xxow//KBGkm2yq 6H0Am9vUXd/PPWysvT8jgljGpoJ/hHFI46fYtDDjr3ecUzmBMI3luGj4vWLhbqP4pv3s yNiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=m2b38rhJZieasfBCowHJ8iPpeWdIkF/yHPN3tuaZMXU=; fh=ozrYJQ1t3QIP6s65KBq5xgJxiFM2qf+5wwn3ABTusyU=; b=IIIpWn/xKNeTUWdCkL/JF6dH46WFp3JosVbnbu2z8Gs0044TQQo16Zv+M/WFiIkQia eTHa+mvhmfzTieTsI9J/uPGiaNC3X9inHLxjNElcqbhK2jnWjuHqOXaXeMSdniA45wgd JQ/8fMtfQT1cctgDUVLrw9/0kQiMJxF4RTf9dhvA5RDdGXXCyXKsPzah5YXUPxhSmKiN WeUYh7RArYpoegCY+itIg3b3WEy/3zXTBCNCQB7LNQkp8jN43bRB4L4NGKlWEii3EUCk 8ffjR0FH12du/o/SyXgeFj79b15aYvWYOy9v07TDCUc5xnpFAIAzSCz2r0yxrR1/p7Zs hnaw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=AUuLM4gb; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:4f78:6441:d0f1:22af as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-4ba01fec6f1sor4197965e9.8.2026.11.10.08.31.38 for (Google Transport Security); Tue, 10 Nov 2026 08:31:38 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:4f78:6441:d0f1:22af as permitted sender) client-ip=2a06:5b06:b600:300:4f78:6441:d0f1:22af; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=AUuLM4gb; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:4f78:6441:d0f1:22af as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1794328298; x=1794933098; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=m2b38rhJZieasfBCowHJ8iPpeWdIkF/yHPN3tuaZMXU=; b=AUuLM4gbYxD8bXinL2KcqNOac2QSmI4V+pE6zBfpGJqjb+MJyyGPNkmsJgM5FVtuu4 g8+vZ0pKS3pg4rxorjLyxMfNTVVnWicSqNVc3FpN8m+GYRV93ir76JzYmRubhd6L0RtQ EODl2K1dCOWsWbsgPPGXlVUpHFBf/nC9ZQeuYgTU/mR1hQ/FnaIzU7kj8JbnmdqZMSRd Jbv/HecpfE+QRhsKk8Q0cYFYWzvaLL8PAc5z9z2Zpcer0kmvkKNgc6sj3EEvfXauNoY6 2NM/wZkziC/Oa6OxvKR314zFVxH1SttdB6IxPm1Wr/f4n5rvfM7RPMnnQyYgZ/s5YLSm XlKw== X-Received: by 2002:a05:600c:4688:b0:4a2:10f9:37db with SMTP id 5b1f17b1804b1-4ba02342520mr57766625e9.7.1794328298154; Tue, 10 Nov 2026 08:31:38 -0800 (PST) Received: from athena.sw.ru ([2a06:5b06:b600:300:4f78:6441:d0f1:22af]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba01fdac9csm108580235e9.0.2026.11.10.08.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 08:31:37 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com Date: Tue, 10 Nov 2026 17:31:30 +0100 Message-ID: <20261110163130.2776687-7-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261110163130.2776687-1-den@openvz.org> References: <20261110163130.2776687-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 6/6] net/ip6_vti: fix host panics on a vti6 tunnel moved into a CT X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org From: Denis V. Lunev vti6_init_net() frees the vti6_net of every container netns. vti6 tunnels cannot be created in a container, but the host can move one in with "ip link set v6 netns ". vti6_dellink() and vti6_siocdevprivate() look ip6n up in dev_net(dev) and read ip6n->fb_tnl_dev, so the node panics on a NULL pointer dereference when container root deletes the tunnel or issues a tunnel ioctl on it, when the container stops and cleanup_net() deletes it, or when ip6_vti is unloaded. SIOCADDTUNNEL on such a device also walks the NULL hash in vti6_locate(). Take the netns from t->net in both, as ip6_tunnel and sit do. For a tunnel that was not moved t->net is dev_net(dev), so the host sees no change. For a moved one the CAP_NET_ADMIN checks of the ioctls now run against the creation netns and container root gets EPERM, as it does for ip6tnl and sit; "ip link del" keeps working. This relies on the backports of mainline 11b326fb0a37 ("ip6: vti: Use ip6_tnl.net in vti6_changelink()."), which moves vti6_changelink() and vti6_update() to t->net, and d289d5307762 ("ip6_vti: set netns_immutable on the fallback device."), which keeps ip6_vti0 in its netns so the fb_tnl_dev comparisons keep their meaning. Fixes: b03d021d2fd6 ("ve/net: ip6_vti: skip per net init in ve") https://virtuozzo.atlassian.net/browse/VSTOR-154348 Feature: net: whitelist allowed Container network devices Signed-off-by: Denis V. Lunev --- net/ipv6/ip6_vti.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index 420830c5e064..40c6298c8b13 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c @@ -805,8 +805,9 @@ vti6_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __user *data int err = 0; struct ip6_tnl_parm2 p; struct __ip6_tnl_parm p1; + struct ip6_tnl *self = netdev_priv(dev); struct ip6_tnl *t = NULL; - struct net *net = dev_net(dev); + struct net *net = self->net; struct vti6_net *ip6n = net_generic(net, vti6_net_id); memset(&p1, 0, sizeof(p1)); @@ -842,8 +843,6 @@ vti6_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __user *data break; vti6_parm_from_user(&p1, &p); if (dev != ip6n->fb_tnl_dev && cmd == SIOCCHGTUNNEL) { - struct ip6_tnl *self = netdev_priv(dev); - err = -EPERM; if (!ns_capable(self->net->user_ns, CAP_NET_ADMIN)) break; @@ -1034,8 +1033,8 @@ static int vti6_newlink(struct net *src_net, struct net_device *dev, static void vti6_dellink(struct net_device *dev, struct list_head *head) { - struct net *net = dev_net(dev); - struct vti6_net *ip6n = net_generic(net, vti6_net_id); + struct ip6_tnl *t = netdev_priv(dev); + struct vti6_net *ip6n = net_generic(t->net, vti6_net_id); if (dev != ip6n->fb_tnl_dev) unregister_netdevice_queue(dev, head); -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel