lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 31 Jan 2022 17:02:28 -0800
From:   Maciej Żenczykowski <maze@...gle.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Linux NetDev <netdev@...r.kernel.org>,
        David Ahern <dsahern@...il.com>,
        Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next] net: allow SO_MARK with CAP_NET_RAW via cmsg

On Mon, Jan 31, 2022 at 3:34 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> There's not reason SO_MARK would be allowed via setsockopt()
> and not via cmsg, let's keep the two consistent. See
> commit 079925cce1d0 ("net: allow SO_MARK with CAP_NET_RAW")
> for justification why NET_RAW -> SO_MARK is safe.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> --
> CC: maze@...gle.com
> ---
>  net/core/sock.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/sock.c b/net/core/sock.c
> index d6804685f17f..09d31a7dc68f 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -2625,7 +2625,8 @@ int __sock_cmsg_send(struct sock *sk, struct msghdr *msg, struct cmsghdr *cmsg,
>
>         switch (cmsg->cmsg_type) {
>         case SO_MARK:
> -               if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))
> +               if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_RAW) &&
> +                   !ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN))
>                         return -EPERM;
>                 if (cmsg->cmsg_len != CMSG_LEN(sizeof(u32)))
>                         return -EINVAL;
> --
> 2.34.1

Reviewed-by: Maciej Żenczykowski <maze@...gle.com>

I thought I'd sent this out already... interesting must have forgotten.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ