[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <afe444bb-5419-47db-8b2e-b51945dae752@redhat.com>
Date: Tue, 26 Nov 2024 09:01:43 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: cgzones@...glemail.com, linux-security-module@...r.kernel.org
Cc: Eric Dumazet <edumazet@...gle.com>, "David S. Miller"
<davem@...emloft.net>, David Ahern <dsahern@...nel.org>,
Jakub Kicinski <kuba@...nel.org>, Simon Horman <horms@...nel.org>,
Serge Hallyn <serge@...lyn.com>, Julia Lawall <Julia.Lawall@...ia.fr>,
Nicolas Palix <nicolas.palix@...g.fr>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, cocci@...ia.fr
Subject: Re: [PATCH 07/11] ipv4: reorder capability check last
On 11/25/24 11:39, Christian Göttsche wrote:
> capable() calls refer to enabled LSMs whether to permit or deny the
> request. This is relevant in connection with SELinux, where a
> capability check results in a policy decision and by default a denial
> message on insufficient permission is issued.
> It can lead to three undesired cases:
> 1. A denial message is generated, even in case the operation was an
> unprivileged one and thus the syscall succeeded, creating noise.
> 2. To avoid the noise from 1. the policy writer adds a rule to ignore
> those denial messages, hiding future syscalls, where the task
> performs an actual privileged operation, leading to hidden limited
> functionality of that task.
> 3. To avoid the noise from 1. the policy writer adds a rule to permit
> the task the requested capability, while it does not need it,
> violating the principle of least privilege.
>
> Signed-off-by: Christian Göttsche <cgzones@...glemail.com>
> ---
> net/ipv4/tcp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 0d704bda6c41..bd3d7a3d6655 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -3406,8 +3406,8 @@ EXPORT_SYMBOL(tcp_disconnect);
>
> static inline bool tcp_can_repair_sock(const struct sock *sk)
> {
> - return sockopt_ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN) &&
> - (sk->sk_state != TCP_LISTEN);
> + return (sk->sk_state != TCP_LISTEN) &&
> + sockopt_ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN);
> }
>
> static int tcp_repair_set_window(struct tcp_sock *tp, sockptr_t optbuf, int len)
The code change IMHO makes sense, but the commit message looks quite
unrelated to this specific change, please re-word it describing this
change helps capability validation.
Additionally it looks the net patches don't depend on other patches in
this series, so it would simplify the merging if you would resubmit them
separately targeting the net-next tree explicitly (add 'net-next' in the
subj prefix).
Note that the net-next tree is currently closed for the merge window, it
will reopen around ~2 Dec.
Please have a look at:
https://elixir.bootlin.com/linux/v6.12/source/Documentation/process/maintainer-netdev.rst
for more details.
Thanks,
Paolo
Powered by blists - more mailing lists