public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v2] rtnetlink: Allow deleting FDB entries in user namespace
@ 2025-10-15 20:15 Johannes Wiesböck
  2025-10-16  7:59 ` Ido Schimmel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johannes Wiesböck @ 2025-10-15 20:15 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Kuniyuki Iwashima, Stanislav Fomichev, Xiao Liang,
	Vlad Yasevich, Jitendra Kalsaria, netdev, linux-kernel
  Cc: gyroidos, sw, Johannes Wiesböck, Michael Weiß,
	Harshal Gohel

Creating FDB entries is possible from a non-initial user namespace when
having CAP_NET_ADMIN, yet, when deleting FDB entries, processes receive
an EPERM because the capability is always checked against the initial
user namespace. This restricts the FDB management from unprivileged
containers.

Drop the netlink_capable check in rtnl_fdb_del as it was originally
dropped in c5c351088ae7 and reintroduced in 1690be63a27b without
intention.

This patch was tested using a container on GyroidOS, where it was
possible to delete FDB entries from an unprivileged user namespace and
private network namespace.

Fixes: 1690be63a27b ("bridge: Add vlan support to static neighbors")
Reviewed-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
Tested-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Johannes Wiesböck <johannes.wiesboeck@aisec.fraunhofer.de>
---
v2:
  - completely drop the capability check in favor of changing to
    netlink_net_capable
  - describe intended behavior already possible for adding FDB entries
v1: https://lore.kernel.org/all/20250923082153.60030-1-johannes.wiesboeck@aisec.fraunhofer.de/
---
 net/core/rtnetlink.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 8040ff7c356e4..576d5ec3bb364 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -4715,9 +4715,6 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
 	int err;
 	u16 vid;
 
-	if (!netlink_capable(skb, CAP_NET_ADMIN))
-		return -EPERM;
-
 	if (!del_bulk) {
 		err = nlmsg_parse_deprecated(nlh, sizeof(*ndm), tb, NDA_MAX,
 					     NULL, extack);
-- 
2.51.0


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

* Re: [PATCH net v2] rtnetlink: Allow deleting FDB entries in user namespace
  2025-10-15 20:15 [PATCH net v2] rtnetlink: Allow deleting FDB entries in user namespace Johannes Wiesböck
@ 2025-10-16  7:59 ` Ido Schimmel
  2025-10-16 11:45 ` Nikolay Aleksandrov
  2025-10-16 23:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2025-10-16  7:59 UTC (permalink / raw)
  To: Johannes Wiesböck
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Kuniyuki Iwashima, Stanislav Fomichev, Xiao Liang,
	Vlad Yasevich, Jitendra Kalsaria, netdev, linux-kernel, gyroidos,
	sw, Michael Weiß, Harshal Gohel

On Wed, Oct 15, 2025 at 10:15:43PM +0200, Johannes Wiesböck wrote:
> Creating FDB entries is possible from a non-initial user namespace when
> having CAP_NET_ADMIN, yet, when deleting FDB entries, processes receive
> an EPERM because the capability is always checked against the initial
> user namespace. This restricts the FDB management from unprivileged
> containers.
> 
> Drop the netlink_capable check in rtnl_fdb_del as it was originally
> dropped in c5c351088ae7 and reintroduced in 1690be63a27b without
> intention.
> 
> This patch was tested using a container on GyroidOS, where it was
> possible to delete FDB entries from an unprivileged user namespace and
> private network namespace.
> 
> Fixes: 1690be63a27b ("bridge: Add vlan support to static neighbors")
> Reviewed-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
> Tested-by: Harshal Gohel <hg@simonwunderlich.de>
> Signed-off-by: Johannes Wiesböck <johannes.wiesboeck@aisec.fraunhofer.de>

Reviewed-by: Ido Schimmel <idosch@nvidia.com>

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

* Re: [PATCH net v2] rtnetlink: Allow deleting FDB entries in user namespace
  2025-10-15 20:15 [PATCH net v2] rtnetlink: Allow deleting FDB entries in user namespace Johannes Wiesböck
  2025-10-16  7:59 ` Ido Schimmel
@ 2025-10-16 11:45 ` Nikolay Aleksandrov
  2025-10-16 23:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Nikolay Aleksandrov @ 2025-10-16 11:45 UTC (permalink / raw)
  To: Johannes Wiesböck, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Simon Horman, Kuniyuki Iwashima,
	Stanislav Fomichev, Xiao Liang, Vlad Yasevich, Jitendra Kalsaria,
	netdev, linux-kernel
  Cc: gyroidos, sw, Michael Weiß, Harshal Gohel

On 10/15/25 23:15, Johannes Wiesböck wrote:
> Creating FDB entries is possible from a non-initial user namespace when
> having CAP_NET_ADMIN, yet, when deleting FDB entries, processes receive
> an EPERM because the capability is always checked against the initial
> user namespace. This restricts the FDB management from unprivileged
> containers.
> 
> Drop the netlink_capable check in rtnl_fdb_del as it was originally
> dropped in c5c351088ae7 and reintroduced in 1690be63a27b without
> intention.
> 
> This patch was tested using a container on GyroidOS, where it was
> possible to delete FDB entries from an unprivileged user namespace and
> private network namespace.
> 
> Fixes: 1690be63a27b ("bridge: Add vlan support to static neighbors")
> Reviewed-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
> Tested-by: Harshal Gohel <hg@simonwunderlich.de>
> Signed-off-by: Johannes Wiesböck <johannes.wiesboeck@aisec.fraunhofer.de>
> ---
> v2:
>   - completely drop the capability check in favor of changing to
>     netlink_net_capable
>   - describe intended behavior already possible for adding FDB entries
> v1: https://lore.kernel.org/all/20250923082153.60030-1-johannes.wiesboeck@aisec.fraunhofer.de/
> ---
>  net/core/rtnetlink.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 8040ff7c356e4..576d5ec3bb364 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -4715,9 +4715,6 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
>  	int err;
>  	u16 vid;
>  
> -	if (!netlink_capable(skb, CAP_NET_ADMIN))
> -		return -EPERM;
> -
>  	if (!del_bulk) {
>  		err = nlmsg_parse_deprecated(nlh, sizeof(*ndm), tb, NDA_MAX,
>  					     NULL, extack);
 
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>

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

* Re: [PATCH net v2] rtnetlink: Allow deleting FDB entries in user namespace
  2025-10-15 20:15 [PATCH net v2] rtnetlink: Allow deleting FDB entries in user namespace Johannes Wiesböck
  2025-10-16  7:59 ` Ido Schimmel
  2025-10-16 11:45 ` Nikolay Aleksandrov
@ 2025-10-16 23:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-16 23:20 UTC (permalink / raw)
  To: =?utf-8?q?Johannes_Wiesb=C3=B6ck_=3Cjohannes=2Ewiesboeck=40aisec=2Efraunhofe?=,
	=?utf-8?q?r=2Ede=3E?=
  Cc: davem, edumazet, kuba, pabeni, horms, kuniyu, sdf, shaw.leon,
	vyasevic, jitendra.kalsaria, netdev, linux-kernel, gyroidos, sw,
	michael.weiss, hg

Hello:

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

On Wed, 15 Oct 2025 22:15:43 +0200 you wrote:
> Creating FDB entries is possible from a non-initial user namespace when
> having CAP_NET_ADMIN, yet, when deleting FDB entries, processes receive
> an EPERM because the capability is always checked against the initial
> user namespace. This restricts the FDB management from unprivileged
> containers.
> 
> Drop the netlink_capable check in rtnl_fdb_del as it was originally
> dropped in c5c351088ae7 and reintroduced in 1690be63a27b without
> intention.
> 
> [...]

Here is the summary with links:
  - [net,v2] rtnetlink: Allow deleting FDB entries in user namespace
    https://git.kernel.org/netdev/net/c/bf29555f5bdc

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] 4+ messages in thread

end of thread, other threads:[~2025-10-16 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15 20:15 [PATCH net v2] rtnetlink: Allow deleting FDB entries in user namespace Johannes Wiesböck
2025-10-16  7:59 ` Ido Schimmel
2025-10-16 11:45 ` Nikolay Aleksandrov
2025-10-16 23:20 ` 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