* [PATCH net-next] net: align SO_RCVMARK required privileges with SO_MARK
@ 2022-05-04 9:54 Eyal Birger
2022-05-05 22:51 ` Jakub Kicinski
2022-05-06 1:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Eyal Birger @ 2022-05-04 9:54 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, asml.silence
Cc: aahringo, weiwan, fw, yangbo.lu, tglx, dsahern, lnx.erin, mkl,
netdev, Eyal Birger
The commit referenced in the "Fixes" tag added the SO_RCVMARK socket
option for receiving the skb mark in the ancillary data.
Since this is a new capability, and exposes admin configured details
regarding the underlying network setup to sockets, let's align the
needed capabilities with those of SO_MARK.
Fixes: 6fd1d51cfa25 ("net: SO_RCVMARK socket option for SO_MARK with recvmsg()")
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
---
net/core/sock.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/core/sock.c b/net/core/sock.c
index be20a1af20e5..6b287eb5427b 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1315,6 +1315,12 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
__sock_set_mark(sk, val);
break;
case SO_RCVMARK:
+ if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_RAW) &&
+ !ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)) {
+ ret = -EPERM;
+ break;
+ }
+
sock_valbool_flag(sk, SOCK_RCVMARK, valbool);
break;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: align SO_RCVMARK required privileges with SO_MARK
2022-05-04 9:54 [PATCH net-next] net: align SO_RCVMARK required privileges with SO_MARK Eyal Birger
@ 2022-05-05 22:51 ` Jakub Kicinski
2022-05-06 1:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-05-05 22:51 UTC (permalink / raw)
To: Eyal Birger
Cc: davem, edumazet, pabeni, asml.silence, aahringo, weiwan, fw,
yangbo.lu, tglx, dsahern, lnx.erin, mkl, netdev
On Wed, 4 May 2022 12:54:59 +0300 Eyal Birger wrote:
> The commit referenced in the "Fixes" tag added the SO_RCVMARK socket
> option for receiving the skb mark in the ancillary data.
>
> Since this is a new capability, and exposes admin configured details
> regarding the underlying network setup to sockets, let's align the
> needed capabilities with those of SO_MARK.
>
> Fixes: 6fd1d51cfa25 ("net: SO_RCVMARK socket option for SO_MARK with recvmsg()")
> Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
It's not really as bad as the ability to set the mark, but since
Erin is not complaining I assume it's fine with their use case.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: align SO_RCVMARK required privileges with SO_MARK
2022-05-04 9:54 [PATCH net-next] net: align SO_RCVMARK required privileges with SO_MARK Eyal Birger
2022-05-05 22:51 ` Jakub Kicinski
@ 2022-05-06 1:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-06 1:20 UTC (permalink / raw)
To: Eyal Birger
Cc: davem, edumazet, kuba, pabeni, asml.silence, aahringo, weiwan,
fw, yangbo.lu, tglx, dsahern, lnx.erin, mkl, netdev
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 4 May 2022 12:54:59 +0300 you wrote:
> The commit referenced in the "Fixes" tag added the SO_RCVMARK socket
> option for receiving the skb mark in the ancillary data.
>
> Since this is a new capability, and exposes admin configured details
> regarding the underlying network setup to sockets, let's align the
> needed capabilities with those of SO_MARK.
>
> [...]
Here is the summary with links:
- [net-next] net: align SO_RCVMARK required privileges with SO_MARK
https://git.kernel.org/netdev/net-next/c/1f86123b9749
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] 3+ messages in thread
end of thread, other threads:[~2022-05-06 1:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 9:54 [PATCH net-next] net: align SO_RCVMARK required privileges with SO_MARK Eyal Birger
2022-05-05 22:51 ` Jakub Kicinski
2022-05-06 1: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;
as well as URLs for NNTP newsgroup(s).