Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] vxlan, geneve: require CAP_NET_ADMIN in the device netns for changelink
@ 2026-07-16 20:34 Doruk Tan Ozturk
  2026-07-16 20:34 ` [PATCH net v2 1/2] vxlan: " Doruk Tan Ozturk
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Doruk Tan Ozturk @ 2026-07-16 20:34 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, andrew+netdev
  Cc: fmancera, sd, linville, mschiffer, maoyixie.tju, netdev,
	linux-kernel, stable

The recent series "require CAP_NET_ADMIN in the device netns for
changelink" (8165f7ff57d9..27ccb68e7ccc) added rtnl_dev_link_net_capable()
and gated the eight IP tunnel drivers (ip_gre, ipip, ip_vti, ip6_tunnel,
ip6_gre, ip6_vti, sit, xfrm_interface). VXLAN and GENEVE share the exact
same shape but were not covered: both store the underlay netns sticky at
newlink (vxlan->net / geneve->net) and their changelink() operates on that
netns, while the generic RTM_NEWLINK path only checks CAP_NET_ADMIN against
dev_net(dev). Once such a device is created in or moved to another netns,
a caller privileged in dev_net(dev) but not in the underlay netns can
reconfigure the tunnel'"'"'s underlay.

This completes that series for the two UDP tunnel drivers that were left
out. Same helper, same placement (top of changelink, before any attribute
is parsed).

Verified on next-20260714 in QEMU with CONFIG_VXLAN=y + CONFIG_USER_NS=y:
an unprivileged user namespace holding CAP_NET_ADMIN only in a child netns
issues an IFLA_INFO_DATA changelink on a vxlan device whose underlay lives
in init_net. Before: returns 0 (reconfigures the init_net underlay).
After: returns -EPERM.

v2:
 - Correct the Fixes: tag on both patches to the commit that added
   changelink support (8bcdc4f3a20b for vxlan, 5b861f6baa3a for geneve),
   as pointed out by Fernando Mancera. No code changes.

Doruk Tan Ozturk (2):
  vxlan: require CAP_NET_ADMIN in the device netns for changelink
  geneve: require CAP_NET_ADMIN in the device netns for changelink

 drivers/net/geneve.c           | 3 +++
 drivers/net/vxlan/vxlan_core.c | 3 +++
 2 files changed, 6 insertions(+)


base-commit: cc2b5f627e8ccbae1188ef2d8be3e451d7f933a5
-- 
2.43.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net v2 1/2] vxlan: require CAP_NET_ADMIN in the device netns for changelink
  2026-07-16 20:34 [PATCH net v2 0/2] vxlan, geneve: require CAP_NET_ADMIN in the device netns for changelink Doruk Tan Ozturk
@ 2026-07-16 20:34 ` Doruk Tan Ozturk
  2026-07-16 21:37   ` Fernando Fernandez Mancera
  2026-07-16 20:35 ` [PATCH net v2 2/2] geneve: " Doruk Tan Ozturk
  2026-07-23 15:20 ` [PATCH net v2 0/2] vxlan, " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Doruk Tan Ozturk @ 2026-07-16 20:34 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, andrew+netdev
  Cc: fmancera, sd, linville, mschiffer, maoyixie.tju, netdev,
	linux-kernel, stable

A tunnel changelink() operates on at most two netns, dev_net(dev) and
the sticky underlay netns vxlan->net. They differ once the device is
created in or moved to a netns other than the one the request runs in.
The rtnl changelink path checks CAP_NET_ADMIN only against dev_net(dev),
so a caller privileged there but not in vxlan->net can rewrite a vxlan
device whose underlay lives in vxlan->net.

vxlan_changelink() validates and applies the new configuration against
vxlan->net (vxlan_config_validate(vxlan->net, ...)) and can reopen the
underlay socket in that netns, so the same reasoning as the tunnel
changelink series applies here.

Gate vxlan_changelink() with rtnl_dev_link_net_capable(), at the top of
the op before any attribute is parsed, matching ipgre_changelink() and
the rest of the "require CAP_NET_ADMIN in the device netns for
changelink" series.

Found by 0sec automated security-research tooling (https://0sec.ai).

Fixes: 8bcdc4f3a20b ("vxlan: add changelink support")
Cc: stable@vger.kernel.org
Assisted-by: 0sec:multi-model
Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
---
v2: correct the Fixes: tag to the commit that added changelink (Fernando Mancera).

 drivers/net/vxlan/vxlan_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 67c367cc5662..d834a4865aec 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -4421,6 +4421,9 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
 	struct vxlan_rdst *dst;
 	int err;
 
+	if (!rtnl_dev_link_net_capable(dev, vxlan->net))
+		return -EPERM;
+
 	dst = &vxlan->default_dst;
 	err = vxlan_nl2conf(tb, data, dev, &conf, true, extack);
 	if (err)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net v2 2/2] geneve: require CAP_NET_ADMIN in the device netns for changelink
  2026-07-16 20:34 [PATCH net v2 0/2] vxlan, geneve: require CAP_NET_ADMIN in the device netns for changelink Doruk Tan Ozturk
  2026-07-16 20:34 ` [PATCH net v2 1/2] vxlan: " Doruk Tan Ozturk
@ 2026-07-16 20:35 ` Doruk Tan Ozturk
  2026-07-16 21:37   ` Fernando Fernandez Mancera
  2026-07-23 15:20 ` [PATCH net v2 0/2] vxlan, " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Doruk Tan Ozturk @ 2026-07-16 20:35 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, andrew+netdev
  Cc: fmancera, sd, linville, mschiffer, maoyixie.tju, netdev,
	linux-kernel, stable

A tunnel changelink() operates on at most two netns, dev_net(dev) and
the sticky underlay netns geneve->net. They differ once the device is
created in or moved to a netns other than the one the request runs in.
The rtnl changelink path checks CAP_NET_ADMIN only against dev_net(dev),
so a caller privileged there but not in geneve->net can rewrite a geneve
device whose underlay lives in geneve->net.

geneve_changelink() applies the new configuration against geneve->net:
geneve_link_config() and the geneve_quiesce()/geneve_unquiesce() pair
reopen the underlay sockets in that netns (geneve_sock_add() uses
geneve->net), so the same reasoning as the tunnel changelink series
applies here.

Gate geneve_changelink() with rtnl_dev_link_net_capable(), at the top of
the op before any attribute is parsed, matching ipgre_changelink() and
the rest of the "require CAP_NET_ADMIN in the device netns for
changelink" series.

Found by 0sec automated security-research tooling (https://0sec.ai).

Fixes: 5b861f6baa3a ("geneve: add rtnl changelink support")
Cc: stable@vger.kernel.org
Assisted-by: 0sec:multi-model
Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
---
v2: correct the Fixes: tag to the commit that added changelink (Fernando Mancera).

 drivers/net/geneve.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 396e1a113cd4..03c99a016298 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -2376,6 +2376,9 @@ static int geneve_changelink(struct net_device *dev, struct nlattr *tb[],
 	struct geneve_config cfg;
 	int err;
 
+	if (!rtnl_dev_link_net_capable(dev, geneve->net))
+		return -EPERM;
+
 	/* If the geneve device is configured for metadata (or externally
 	 * controlled, for example, OVS), then nothing can be changed.
 	 */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2 1/2] vxlan: require CAP_NET_ADMIN in the device netns for changelink
  2026-07-16 20:34 ` [PATCH net v2 1/2] vxlan: " Doruk Tan Ozturk
@ 2026-07-16 21:37   ` Fernando Fernandez Mancera
  0 siblings, 0 replies; 6+ messages in thread
From: Fernando Fernandez Mancera @ 2026-07-16 21:37 UTC (permalink / raw)
  To: Doruk Tan Ozturk
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, fmancera, sd,
	linville, mschiffer, maoyixie.tju, netdev, linux-kernel, stable

On Thu, 16 Jul 2026 22:34:59 +0200, Doruk Tan Ozturk <doruk@0sec.ai> wrote:
> A tunnel changelink() operates on at most two netns, dev_net(dev) and
> the sticky underlay netns vxlan->net. They differ once the device is
> created in or moved to a netns other than the one the request runs in.
> The rtnl changelink path checks CAP_NET_ADMIN only against dev_net(dev),
> so a caller privileged there but not in vxlan->net can rewrite a vxlan
> device whose underlay lives in vxlan->net.
> 
> vxlan_changelink() validates and applies the new configuration against
> vxlan->net (vxlan_config_validate(vxlan->net, ...)) and can reopen the
> underlay socket in that netns, so the same reasoning as the tunnel
> changelink series applies here.
> 
> Gate vxlan_changelink() with rtnl_dev_link_net_capable(), at the top of
> the op before any attribute is parsed, matching ipgre_changelink() and
> the rest of the "require CAP_NET_ADMIN in the device netns for
> changelink" series.
> 
> Found by 0sec automated security-research tooling (https://0sec.ai).
> 
> Fixes: 8bcdc4f3a20b ("vxlan: add changelink support")
> Cc: stable@vger.kernel.org
> Assisted-by: 0sec:multi-model
> Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
>

Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>

Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2 2/2] geneve: require CAP_NET_ADMIN in the device netns for changelink
  2026-07-16 20:35 ` [PATCH net v2 2/2] geneve: " Doruk Tan Ozturk
@ 2026-07-16 21:37   ` Fernando Fernandez Mancera
  0 siblings, 0 replies; 6+ messages in thread
From: Fernando Fernandez Mancera @ 2026-07-16 21:37 UTC (permalink / raw)
  To: Doruk Tan Ozturk
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, fmancera, sd,
	linville, mschiffer, maoyixie.tju, netdev, linux-kernel, stable

On Thu, 16 Jul 2026 22:35:00 +0200, Doruk Tan Ozturk <doruk@0sec.ai> wrote:
> A tunnel changelink() operates on at most two netns, dev_net(dev) and
> the sticky underlay netns geneve->net. They differ once the device is
> created in or moved to a netns other than the one the request runs in.
> The rtnl changelink path checks CAP_NET_ADMIN only against dev_net(dev),
> so a caller privileged there but not in geneve->net can rewrite a geneve
> device whose underlay lives in geneve->net.
> 
> geneve_changelink() applies the new configuration against geneve->net:
> geneve_link_config() and the geneve_quiesce()/geneve_unquiesce() pair
> reopen the underlay sockets in that netns (geneve_sock_add() uses
> geneve->net), so the same reasoning as the tunnel changelink series
> applies here.
> 
> Gate geneve_changelink() with rtnl_dev_link_net_capable(), at the top of
> the op before any attribute is parsed, matching ipgre_changelink() and
> the rest of the "require CAP_NET_ADMIN in the device netns for
> changelink" series.
> 
> Found by 0sec automated security-research tooling (https://0sec.ai).
> 
> Fixes: 5b861f6baa3a ("geneve: add rtnl changelink support")
> Cc: stable@vger.kernel.org
> Assisted-by: 0sec:multi-model
> Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
>

Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>

Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2 0/2] vxlan, geneve: require CAP_NET_ADMIN in the device netns for changelink
  2026-07-16 20:34 [PATCH net v2 0/2] vxlan, geneve: require CAP_NET_ADMIN in the device netns for changelink Doruk Tan Ozturk
  2026-07-16 20:34 ` [PATCH net v2 1/2] vxlan: " Doruk Tan Ozturk
  2026-07-16 20:35 ` [PATCH net v2 2/2] geneve: " Doruk Tan Ozturk
@ 2026-07-23 15:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-07-23 15:20 UTC (permalink / raw)
  To: Doruk Tan Ozturk
  Cc: davem, edumazet, kuba, pabeni, andrew+netdev, fmancera, sd,
	linville, mschiffer, maoyixie.tju, netdev, linux-kernel, stable

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 16 Jul 2026 22:34:58 +0200 you wrote:
> The recent series "require CAP_NET_ADMIN in the device netns for
> changelink" (8165f7ff57d9..27ccb68e7ccc) added rtnl_dev_link_net_capable()
> and gated the eight IP tunnel drivers (ip_gre, ipip, ip_vti, ip6_tunnel,
> ip6_gre, ip6_vti, sit, xfrm_interface). VXLAN and GENEVE share the exact
> same shape but were not covered: both store the underlay netns sticky at
> newlink (vxlan->net / geneve->net) and their changelink() operates on that
> netns, while the generic RTM_NEWLINK path only checks CAP_NET_ADMIN against
> dev_net(dev). Once such a device is created in or moved to another netns,
> a caller privileged in dev_net(dev) but not in the underlay netns can
> reconfigure the tunnel'"'"'s underlay.
> 
> [...]

Here is the summary with links:
  - [net,v2,1/2] vxlan: require CAP_NET_ADMIN in the device netns for changelink
    https://git.kernel.org/netdev/net/c/3a61bd9637f3
  - [net,v2,2/2] geneve: require CAP_NET_ADMIN in the device netns for changelink
    https://git.kernel.org/netdev/net/c/8efb8f8bbb35

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-23 15:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16 20:34 [PATCH net v2 0/2] vxlan, geneve: require CAP_NET_ADMIN in the device netns for changelink Doruk Tan Ozturk
2026-07-16 20:34 ` [PATCH net v2 1/2] vxlan: " Doruk Tan Ozturk
2026-07-16 21:37   ` Fernando Fernandez Mancera
2026-07-16 20:35 ` [PATCH net v2 2/2] geneve: " Doruk Tan Ozturk
2026-07-16 21:37   ` Fernando Fernandez Mancera
2026-07-23 15:20 ` [PATCH net v2 0/2] vxlan, " patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox