* [Devel] [PATCH hci-8.1 1/6] net/ip6_tunnel: fix a host panic deleting ip6tnl moved into a CT without ipip
2026-11-10 16:31 [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT Denis V. Lunev
@ 2026-11-10 16:31 ` Denis V. Lunev
2026-11-10 16:35 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 2/6] net/sit: fix a host panic deleting sit moved into a CT without sit Denis V. Lunev
` (6 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Denis V. Lunev @ 2026-11-10 16:31 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Denis V. Lunev <den@openvz.org>
ip6_tnl_init_net() frees the ip6_tnl_net of a netns whose VE lacks
VE_FEATURE_IPIP. Only the fallback ip6tnl0 is netns_immutable, so the
host can move any other ip6tnl tunnel into such a container with
"ip link set t6 netns <CT>". ip6_tnl_dellink() looks ip6n up in
dev_net(dev) and reads ip6n->fb_tnl_dev, so the node panics on a NULL
pointer dereference when container root deletes the tunnel, when the
container stops and cleanup_net() deletes it, or when ip6_tunnel is
unloaded.
Take ip6n from t->net, the netns the tunnel was created in and is
hashed in, as changelink, uninit and the ioctl path already do. The
fallback device cannot leave its netns, so the fb_tnl_dev comparison
keeps its meaning.
Fixes: 94e61c310587 ("net/ip6ip: Consider VE_FEATURE_IPIP on new net creation")
https://virtuozzo.atlassian.net/browse/VSTOR-154346
Feature: ve: per-CT features management
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv6/ip6_tunnel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 9694480cdaff..a7667de2c451 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -2095,8 +2095,8 @@ static int ip6_tnl_changelink(struct net_device *dev, struct nlattr *tb[],
static void ip6_tnl_dellink(struct net_device *dev, struct list_head *head)
{
- struct net *net = dev_net(dev);
- struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
+ struct ip6_tnl *t = netdev_priv(dev);
+ struct ip6_tnl_net *ip6n = net_generic(t->net, ip6_tnl_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
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Devel] [PATCH hci-8.1 1/6] net/ip6_tunnel: fix a host panic deleting ip6tnl moved into a CT without ipip
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 1/6] net/ip6_tunnel: fix a host panic deleting ip6tnl moved into a CT without ipip Denis V. Lunev
@ 2026-11-10 16:35 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
1 sibling, 0 replies; 21+ messages in thread
From: no-reply @ 2026-11-10 16:35 UTC (permalink / raw)
To: Denis V. Lunev, khorenko; +Cc: devel
> From: Denis V. Lunev <den@openvz.org>
>
> ip6_tnl_init_net() frees the ip6_tnl_net of a netns whose VE lacks
> VE_FEATURE_IPIP. Only the fallback ip6tnl0 is netns_immutable, so the
> host can move any other ip6tnl tunnel into such a container with
> "ip link set t6 netns <CT>". ip6_tnl_dellink() looks ip6n up in
> dev_net(dev) and reads ip6n->fb_tnl_dev, so the node panics on a NULL
> pointer dereference when container root deletes the tunnel, when the
> container stops and cleanup_net() deletes it, or when ip6_tunnel is
> unloaded.
>
> Take ip6n from t->net, the netns the tunnel was created in and is
> hashed in, as changelink, uninit and the ioctl path already do. The
> fallback device cannot leave its netns, so the fb_tnl_dev comparison
> keeps its meaning.
>
> Fixes: 94e61c310587 ("net/ip6ip: Consider VE_FEATURE_IPIP on new net creation")
>
> https://virtuozzo.atlassian.net/browse/VSTOR-154346
> Feature: ve: per-CT features management
> Signed-off-by: Denis V. Lunev <den@openvz.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261110163130.2776687-1-den@openvz.org?part=1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Devel] [PATCH hci-8.1 1/6] net/ip6_tunnel: fix a host panic deleting ip6tnl moved into a CT without ipip
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 1/6] net/ip6_tunnel: fix a host panic deleting ip6tnl moved into a CT without ipip Denis V. Lunev
2026-11-10 16:35 ` no-reply
@ 2026-11-12 13:01 ` Konstantin Khorenko
1 sibling, 0 replies; 21+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 13:01 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying with these fixes on my side:
- the Jira URL moved next to the Fixes tag, a blank line before
Feature, as in the vz commit template
On Tue, 10 Nov 2026 17:31:25 +0100, Denis V. Lunev wrote:
> Fixes: 94e61c310587 ("net/ip6ip: Consider VE_FEATURE_IPIP on new net creation")
>
> https://virtuozzo.atlassian.net/browse/VSTOR-154346
> Feature: ve: per-CT features management
The same layout fix as on the ip6gre dellink patch.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Devel] [PATCH hci-8.1 2/6] net/sit: fix a host panic deleting sit moved into a CT without sit
2026-11-10 16:31 [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT Denis V. Lunev
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 1/6] net/ip6_tunnel: fix a host panic deleting ip6tnl moved into a CT without ipip Denis V. Lunev
@ 2026-11-10 16:31 ` Denis V. Lunev
2026-11-10 16:36 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 3/6] ms/ip6: vti: Use ip6_tnl.net in vti6_changelink() Denis V. Lunev
` (5 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Denis V. Lunev @ 2026-11-10 16:31 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Denis V. Lunev <den@openvz.org>
sit_init_net() frees the sit_net of a netns whose VE lacks
VE_FEATURE_SIT. Only the fallback sit0 is netns_immutable, so the host
can move any other sit tunnel into such a container with
"ip link set s6 netns <CT>". ipip6_dellink() looks sitn up in
dev_net(dev) and reads sitn->fb_tunnel_dev, so the node panics on a
NULL pointer dereference when container root deletes the tunnel, when
the container stops and cleanup_net() deletes it, or when sit is
unloaded.
Take sitn from t->net, the netns the tunnel was created in and is
hashed in, as changelink, uninit and the ioctl handlers already do. The
fallback device cannot leave its netns, so the fb_tunnel_dev comparison
keeps its meaning.
Fixes: 5aed376d130d ("net: Make sit feature optional")
https://virtuozzo.atlassian.net/browse/VSTOR-154347
Feature: ve: per-CT features management
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv6/sit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 36c6c7704f84..6aec5177fa4a 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1772,8 +1772,8 @@ static const struct nla_policy ipip6_policy[IFLA_IPTUN_MAX + 1] = {
static void ipip6_dellink(struct net_device *dev, struct list_head *head)
{
- struct net *net = dev_net(dev);
- struct sit_net *sitn = net_generic(net, sit_net_id);
+ struct ip_tunnel *t = netdev_priv(dev);
+ struct sit_net *sitn = net_generic(t->net, sit_net_id);
if (dev != sitn->fb_tunnel_dev)
unregister_netdevice_queue(dev, head);
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Devel] [PATCH hci-8.1 2/6] net/sit: fix a host panic deleting sit moved into a CT without sit
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 2/6] net/sit: fix a host panic deleting sit moved into a CT without sit Denis V. Lunev
@ 2026-11-10 16:36 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
1 sibling, 0 replies; 21+ messages in thread
From: no-reply @ 2026-11-10 16:36 UTC (permalink / raw)
To: khorenko, Denis V. Lunev; +Cc: devel
> From: Denis V. Lunev <den@openvz.org>
>
> sit_init_net() frees the sit_net of a netns whose VE lacks
> VE_FEATURE_SIT. Only the fallback sit0 is netns_immutable, so the host
> can move any other sit tunnel into such a container with
> "ip link set s6 netns <CT>". ipip6_dellink() looks sitn up in
> dev_net(dev) and reads sitn->fb_tunnel_dev, so the node panics on a
> NULL pointer dereference when container root deletes the tunnel, when
> the container stops and cleanup_net() deletes it, or when sit is
> unloaded.
>
> Take sitn from t->net, the netns the tunnel was created in and is
> hashed in, as changelink, uninit and the ioctl handlers already do. The
> fallback device cannot leave its netns, so the fb_tunnel_dev comparison
> keeps its meaning.
>
> Fixes: 5aed376d130d ("net: Make sit feature optional")
>
> https://virtuozzo.atlassian.net/browse/VSTOR-154347
> Feature: ve: per-CT features management
> Signed-off-by: Denis V. Lunev <den@openvz.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261110163130.2776687-1-den@openvz.org?part=2
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Devel] [PATCH hci-8.1 2/6] net/sit: fix a host panic deleting sit moved into a CT without sit
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 2/6] net/sit: fix a host panic deleting sit moved into a CT without sit Denis V. Lunev
2026-11-10 16:36 ` no-reply
@ 2026-11-12 13:01 ` Konstantin Khorenko
1 sibling, 0 replies; 21+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 13:01 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying with these fixes on my side:
- the Jira URL moved next to the Fixes tag, a blank line before
Feature, as in the vz commit template
On Tue, 10 Nov 2026 17:31:26 +0100, Denis V. Lunev wrote:
> Fixes: 5aed376d130d ("net: Make sit feature optional")
>
> https://virtuozzo.atlassian.net/browse/VSTOR-154347
> Feature: ve: per-CT features management
The same layout fix as in 1/6.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Devel] [PATCH hci-8.1 3/6] ms/ip6: vti: Use ip6_tnl.net in vti6_changelink().
2026-11-10 16:31 [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT Denis V. Lunev
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 1/6] net/ip6_tunnel: fix a host panic deleting ip6tnl moved into a CT without ipip Denis V. Lunev
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 2/6] net/sit: fix a host panic deleting sit moved into a CT without sit Denis V. Lunev
@ 2026-11-10 16:31 ` Denis V. Lunev
2026-11-10 16:38 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 4/6] ms/ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate() Denis V. Lunev
` (4 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Denis V. Lunev @ 2026-11-10 16:31 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Kuniyuki Iwashima <kuniyu@google.com>
ip netns add ns1
ip netns add ns2
ip -n ns1 link add vti6_test type vti6 remote ::1 local ::2 key 7
ip -n ns1 link set vti6_test netns ns2
ip -n ns2 link set vti6_test type vti6 remote ::3 local ::4 key 9
ip netns del ns2
ip netns del ns1
[ 132.495484] ------------[ cut here ]------------
[ 132.497609] kernel BUG at net/core/dev.c:12376!
Commit 61220ab34948 ("vti6: Enable namespace changing") dropped
NETIF_F_NETNS_LOCAL from vti6 devices. A vti6 tunnel can then
move through IFLA_NET_NS_FD. After the move dev_net(dev) points
at the new netns while t->net stays at the creation netns.
vti6_changelink() and vti6_update() still use dev_net(dev) and
dev_net(t->dev). They unlink from one per netns hash and relink
into another. The creation netns is left with a stale entry.
cleanup_net() of that netns later walks freed memory.
Reachable from an unprivileged user namespace (unshare --user
--map-root-user --net). Cross tenant scope on container hosts.
Fixes: 61220ab34948 ("vti6: Enable namespace changing")
Reported-by: Maoyi Xie <maoyi.xie@ntu.edu.sg>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Cc: stable@vger.kernel.org # v5.15+
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260521130555.3421684-2-maoyixie.tju@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
(cherry picked from commit 11b326fb0a374f4654f9be22d0f0f7abd9f7d3fe)
https://virtuozzo.atlassian.net/browse/VSTOR-154348
Feature: fix ms/net
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv6/ip6_vti.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 0081650fae0c..6cf5d8f01c31 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -728,10 +728,11 @@ vti6_tnl_change(struct ip6_tnl *t, const struct __ip6_tnl_parm *p,
static int vti6_update(struct ip6_tnl *t, struct __ip6_tnl_parm *p,
bool keep_mtu)
{
- struct net *net = dev_net(t->dev);
- struct vti6_net *ip6n = net_generic(net, vti6_net_id);
+ struct net *net = t->net;
+ struct vti6_net *ip6n;
int err;
+ ip6n = net_generic(net, vti6_net_id);
vti6_tnl_unlink(ip6n, t);
synchronize_net();
err = vti6_tnl_change(t, p, keep_mtu);
@@ -1037,11 +1038,12 @@ static int vti6_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[],
struct netlink_ext_ack *extack)
{
- struct ip6_tnl *t;
+ struct ip6_tnl *t = netdev_priv(dev);
+ struct net *net = t->net;
struct __ip6_tnl_parm p;
- struct net *net = dev_net(dev);
- struct vti6_net *ip6n = net_generic(net, vti6_net_id);
+ struct vti6_net *ip6n;
+ ip6n = net_generic(net, vti6_net_id);
if (dev == ip6n->fb_tnl_dev)
return -EINVAL;
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread* [Devel] [PATCH hci-8.1 4/6] ms/ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate().
2026-11-10 16:31 [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT Denis V. Lunev
` (2 preceding siblings ...)
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 3/6] ms/ip6: vti: Use ip6_tnl.net in vti6_changelink() Denis V. Lunev
@ 2026-11-10 16:31 ` Denis V. Lunev
2026-11-10 16:41 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 5/6] ms/ip6_vti: set netns_immutable on the fallback device Denis V. Lunev
` (3 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Denis V. Lunev @ 2026-11-10 16:31 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Maoyi Xie <maoyixie.tju@gmail.com>
After patch 1/2 in this series, vti6_update() unlinks and relinks
the tunnel through t->net. vti6_siocdevprivate() still uses
dev_net(dev) for the collision lookup. For a tunnel moved through
IFLA_NET_NS_FD, dev_net(dev) is the new netns, not t->net.
SIOCCHGTUNNEL on a migrated tunnel then runs:
net = dev_net(dev) /* migrated netns */
t = vti6_locate(net, &p1, false) /* misses target in t->net */
...
t = netdev_priv(dev)
vti6_update(t, &p1, false) /* mutates t->net's hash */
A caller in the migrated netns picks params that match a tunnel
in the creation netns. The lookup in dev_net(dev) finds nothing.
vti6_update() prepends the migrated tunnel at the head of the
creation netns hash bucket for those params. Later lookups in
the creation netns resolve to the migrated device. xfrm receive
delivers the matched packets through a device the caller controls.
Reachable from an unprivileged user namespace (unshare --user
--map-root-user --net). Cross tenant scope on container hosts.
Switch the SIOCCHGTUNNEL path on a non fallback device to use
t->net for the lookup. The lookup now matches the netns
vti6_update() operates on.
Also add ns_capable(self->net->user_ns, CAP_NET_ADMIN) before
the lookup. The check at the top of the case is against
dev_net(dev)->user_ns, which after migration is the attacker's
netns. A caller there can pick params absent from self->net,
the lookup returns NULL, t becomes self, and vti6_update()
inserts the device into the creation netns hash. The new check
requires CAP_NET_ADMIN in the creation netns user_ns too.
SIOCADDTUNNEL and SIOCCHGTUNNEL on the fallback device keep
dev_net(dev), which equals init_net there.
Fixes: 61220ab34948 ("vti6: Enable namespace changing")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Suggested-by: Xiao Liang <shaw.leon@gmail.com>
Cc: stable@vger.kernel.org # v5.15+
Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
Link: https://patch.msgid.link/20260521130555.3421684-3-maoyixie.tju@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
(cherry picked from commit 8b484efd5cb4eeef9021a661e198edc5349dacf6)
https://virtuozzo.atlassian.net/browse/VSTOR-154348
Feature: fix ms/net
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv6/ip6_vti.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 6cf5d8f01c31..06fa55ddddca 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -841,17 +841,24 @@ vti6_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __user *data
if (p.proto != IPPROTO_IPV6 && p.proto != 0)
break;
vti6_parm_from_user(&p1, &p);
- t = vti6_locate(net, &p1, cmd == SIOCADDTUNNEL);
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;
+ t = vti6_locate(self->net, &p1, false);
if (t) {
if (t->dev != dev) {
err = -EEXIST;
break;
}
} else
- t = netdev_priv(dev);
+ t = self;
err = vti6_update(t, &p1, false);
+ } else {
+ t = vti6_locate(net, &p1, cmd == SIOCADDTUNNEL);
}
if (t) {
err = 0;
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Devel] [PATCH hci-8.1 4/6] ms/ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate().
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 4/6] ms/ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate() Denis V. Lunev
@ 2026-11-10 16:41 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
1 sibling, 0 replies; 21+ messages in thread
From: no-reply @ 2026-11-10 16:41 UTC (permalink / raw)
To: khorenko, Denis V. Lunev; +Cc: devel
> From: Maoyi Xie <maoyixie.tju@gmail.com>
>
> After patch 1/2 in this series, vti6_update() unlinks and relinks
> the tunnel through t->net. vti6_siocdevprivate() still uses
> dev_net(dev) for the collision lookup. For a tunnel moved through
> IFLA_NET_NS_FD, dev_net(dev) is the new netns, not t->net.
>
> SIOCCHGTUNNEL on a migrated tunnel then runs:
>
> net = dev_net(dev) /* migrated netns */
> t = vti6_locate(net, &p1, false) /* misses target in t->net */
> ...
> t = netdev_priv(dev)
> vti6_update(t, &p1, false) /* mutates t->net's hash */
>
> [ ... ]
>
> https://virtuozzo.atlassian.net/browse/VSTOR-154348
>
> Feature: fix ms/net
> Signed-off-by: Denis V. Lunev <den@openvz.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261110163130.2776687-1-den@openvz.org?part=4
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Devel] [PATCH hci-8.1 4/6] ms/ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate().
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 4/6] ms/ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate() Denis V. Lunev
2026-11-10 16:41 ` no-reply
@ 2026-11-12 13:01 ` Konstantin Khorenko
1 sibling, 0 replies; 21+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 13:01 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying as is.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread
* [Devel] [PATCH hci-8.1 5/6] ms/ip6_vti: set netns_immutable on the fallback device.
2026-11-10 16:31 [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT Denis V. Lunev
` (3 preceding siblings ...)
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 4/6] ms/ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate() Denis V. Lunev
@ 2026-11-10 16:31 ` Denis V. Lunev
2026-11-10 16:41 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 6/6] net/ip6_vti: fix host panics on a vti6 tunnel moved into a CT Denis V. Lunev
` (2 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Denis V. Lunev @ 2026-11-10 16:31 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Eric Dumazet <edumazet@google.com>
john1988 and Noam Rathaus reported that vti6_init_net() does not set the
netns_immutable flag on the per-netns fallback tunnel device (ip6_vti0).
Other similar tunnel drivers (like ip6_tunnel, sit, ip6_gre, and ip_tunnel)
correctly set this flag during their fallback device initialization to
prevent them from being moved to another network namespace.
Fixes: 61220ab34948 ("vti6: Enable namespace changing")
Reported-by: Noam Rathaus <noamr@ssd-disclosure.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Link: https://patch.msgid.link/20260608155918.787644-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit d289d5307762d1838aaece22c6b6fcad9e8865f9)
https://virtuozzo.atlassian.net/browse/VSTOR-154348
Feature: fix ms/net
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
net/ipv6/ip6_vti.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 06fa55ddddca..420830c5e064 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -1171,6 +1171,7 @@ static int __net_init vti6_init_net(struct net *net)
goto err_alloc_dev;
dev_net_set(ip6n->fb_tnl_dev, net);
ip6n->fb_tnl_dev->rtnl_link_ops = &vti6_link_ops;
+ ip6n->fb_tnl_dev->netns_immutable = true;
err = vti6_fb_tnl_dev_init(ip6n->fb_tnl_dev);
if (err < 0)
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread* [Devel] [PATCH hci-8.1 6/6] net/ip6_vti: fix host panics on a vti6 tunnel moved into a CT
2026-11-10 16:31 [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT Denis V. Lunev
` (4 preceding siblings ...)
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 5/6] ms/ip6_vti: set netns_immutable on the fallback device Denis V. Lunev
@ 2026-11-10 16:31 ` Denis V. Lunev
2026-11-10 16:42 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
2026-11-12 13:01 ` [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels " Konstantin Khorenko
2026-11-12 13:01 ` Konstantin Khorenko
7 siblings, 2 replies; 21+ messages in thread
From: Denis V. Lunev @ 2026-11-10 16:31 UTC (permalink / raw)
To: khorenko; +Cc: devel
From: Denis V. Lunev <den@openvz.org>
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 <CT>". 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 <den@openvz.org>
---
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
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Devel] [PATCH hci-8.1 6/6] net/ip6_vti: fix host panics on a vti6 tunnel moved into a CT
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 6/6] net/ip6_vti: fix host panics on a vti6 tunnel moved into a CT Denis V. Lunev
@ 2026-11-10 16:42 ` no-reply
2026-11-12 13:01 ` Konstantin Khorenko
1 sibling, 0 replies; 21+ messages in thread
From: no-reply @ 2026-11-10 16:42 UTC (permalink / raw)
To: Denis V. Lunev, khorenko; +Cc: devel
> From: Denis V. Lunev <den@openvz.org>
>
> 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 <CT>". 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 <den@openvz.org>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261110163130.2776687-1-den@openvz.org?part=6
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Devel] [PATCH hci-8.1 6/6] net/ip6_vti: fix host panics on a vti6 tunnel moved into a CT
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 6/6] net/ip6_vti: fix host panics on a vti6 tunnel moved into a CT Denis V. Lunev
2026-11-10 16:42 ` no-reply
@ 2026-11-12 13:01 ` Konstantin Khorenko
1 sibling, 0 replies; 21+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 13:01 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying with these fixes on my side:
- "container root deletes the tunnel or issues a tunnel ioctl on it" ->
"container root deletes the tunnel, when any process in the
container issues a tunnel ioctl on it (SIOCGETTUNNEL needs no
capability)"
- dropped "SIOCADDTUNNEL on such a device also walks the NULL hash in
vti6_locate()."
- added after "ip link del" keeps working: "A tunnel moved between two
host netns now has its ioctls served in the creation netns too, so
SIOCADDTUNNEL on it creates the new tunnel there, as for ip6tnl and
sit."
- the Jira URL moved next to the Fixes tag, a blank line before
Feature
On Tue, 10 Nov 2026 17:31:30 +0100, Denis V. Lunev wrote:
> 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
dev_ioctl() passes SIOCDEVPRIVATE commands to the driver without a
capability check, and SIOCGETTUNNEL has none in vti6_siocdevprivate()
either. Any process in the CT could panic the node, not only root.
> unloaded. SIOCADDTUNNEL on such a device also walks the NULL hash in
> vti6_locate().
Not after 4/6: the ADD path now reads ip6n->fb_tnl_dev first and faults
there, before vti6_locate().
> 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.
With net = self->net for all commands, a vti6 moved between two host
netns changes too: SIOCADDTUNNEL issued on it creates the new tunnel in
the creation netns, and ADD and DEL check CAP_NET_ADMIN there. Mainline
vti6 still uses dev_net(dev) for these. ip6tnl and sit already behave
this way, so this is fine, but the message should say it.
Also note: this EPERM holds for the ioctls only, changelink is still
open to container root. See the reply to the cover letter.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT
2026-11-10 16:31 [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT Denis V. Lunev
` (5 preceding siblings ...)
2026-11-10 16:31 ` [Devel] [PATCH hci-8.1 6/6] net/ip6_vti: fix host panics on a vti6 tunnel moved into a CT Denis V. Lunev
@ 2026-11-12 13:01 ` Konstantin Khorenko
2026-11-12 13:01 ` Konstantin Khorenko
7 siblings, 0 replies; 21+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 13:01 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
Applying the series, with the commit message fixes listed in the replies
to 1/6, 2/6 and 6/6. The code is fine as is.
On Tue, 10 Nov 2026 17:31:24 +0100, Denis V. Lunev wrote:
> Patches 1 and 2 take the pernet struct from t->net in ip6_tunnel and
> sit. Patches 3-5 backport the mainline vti6 fixes for moved tunnels,
> patch 6 is the vz-only rest for vti6.
Separate patches, not needed for this series; I created a task for
it:
1. Please backport the mainline v7.2-rc1 series "require CAP_NET_ADMIN
in the device netns for changelink":
- 8165f7ff57d96 net: ip_gre (adds rtnl_dev_link_net_capable())
- 8211a26324667 net: ipip
- 95cceadbfd52d net: ip_vti
- 2496fa0b7d180 net: ip6_tunnel
- f00a50876d281 net: ip6_gre
- e2ac3b242c37d net: ip6_vti
- 095515d89b19b xfrm: xfrm_interface
- 27ccb68e7ccce net: sit
https://virtuozzo.atlassian.net/browse/VSTOR-154864
Why: the ioctls of a moved tunnel now check CAP_NET_ADMIN in the
creation netns, but changelink does not. rtnetlink checks it only in
the CT user namespace, and changelink then rehashes the tunnel in the
host netns. So container root can run
ip link set v6 type vti6 local A remote B ikey K okey K
on a vti6 the host moved in and take host IPsec traffic that matches
these addresses and mark into its own device. Until 3/6 this was a
panic for vti6. For ip6tnl, sit and ip6gre it is possible today.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT
2026-11-10 16:31 [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels moved into a CT Denis V. Lunev
` (6 preceding siblings ...)
2026-11-12 13:01 ` [Devel] [PATCH hci-8.1 0/6] net/ipv6: fix host panics on tunnels " Konstantin Khorenko
@ 2026-11-12 13:01 ` Konstantin Khorenko
7 siblings, 0 replies; 21+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 13:01 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: devel
On Tue, 10 Nov 2026 17:31:24 +0100, Denis V. Lunev wrote:
> net/ipv6: fix host panics on tunnels moved into a CT
>
> The host can move an ip6tnl, sit or vti6 tunnel into a container whose
> VE lacks the tunnel feature, or into any container for vti6. The driver
> frees its pernet struct in such a netns, and the dellink, changelink and
> ioctl handlers that look it up through dev_net(dev) dereference NULL:
> container root deleting or reconfiguring the tunnel, the container stop
> and a module unload all panic the node. "net/ip6_gre: fix a host panic
> deleting ip6gre moved into a CT without ipgre" fixes the same in ip6_gre.
>
> [...]
Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.21.vz10, thanks!
[1/6] net/ip6_tunnel: fix a host panic deleting ip6tnl moved into a CT without ipip
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/5d362b62b01a
[2/6] net/sit: fix a host panic deleting sit moved into a CT without sit
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/2a22f1e0e53c
[3/6] ms/ip6: vti: Use ip6_tnl.net in vti6_changelink().
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/d37b639025e3
[4/6] ms/ip6: vti: Use ip6_tnl.net in vti6_siocdevprivate().
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/2eedf7336f50
[5/6] ms/ip6_vti: set netns_immutable on the fallback device.
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/beb771d146fc
[6/6] net/ip6_vti: fix host panics on a vti6 tunnel moved into a CT
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/bdaf6e4515ce
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 21+ messages in thread