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]
Message-ID: <ZJBiP//34udiwXML@corigine.com>
Date: Mon, 19 Jun 2023 16:12:15 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Maciej Żenczykowski <maze@...gle.com>
Cc: Maciej Żenczykowski <zenczykowski@...il.com>,
	Linux Network Development Mailing List <netdev@...r.kernel.org>,
	Larysa Zaremba <larysa.zaremba@...el.com>,
	Paolo Abeni <pabeni@...hat.com>,
	Eyal Birger <eyal.birger@...il.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Eric Dumazet <edumazet@...gle.com>, Patrick Rohr <prohr@...gle.com>
Subject: Re: [PATCH net v2] revert "net: align SO_RCVMARK required privileges
 with SO_MARK"

On Sun, Jun 18, 2023 at 03:31:30AM -0700, Maciej Żenczykowski wrote:
> This reverts commit 1f86123b9749 ("net: align SO_RCVMARK required
> privileges with SO_MARK") because the reasoning in the commit message
> is not really correct:
>   SO_RCVMARK is used for 'reading' incoming skb mark (via cmsg), as such
>   it is more equivalent to 'getsockopt(SO_MARK)' which has no priv check
>   and retrieves the socket mark, rather than 'setsockopt(SO_MARK) which
>   sets the socket mark and does require privs.
> 
>   Additionally incoming skb->mark may already be visible if
>   sysctl_fwmark_reflect and/or sysctl_tcp_fwmark_accept are enabled.
> 
>   Furthermore, it is easier to block the getsockopt via bpf
>   (either cgroup setsockopt hook, or via syscall filters)
>   then to unblock it if it requires CAP_NET_RAW/ADMIN.
> 
> On Android the socket mark is (among other things) used to store
> the network identifier a socket is bound to.  Setting it is privileged,
> but retrieving it is not.  We'd like unprivileged userspace to be able
> to read the network id of incoming packets (where mark is set via
> iptables [to be moved to bpf])...
> 
> An alternative would be to add another sysctl to control whether
> setting SO_RCVMARK is privilged or not.
> (or even a MASK of which bits in the mark can be exposed)
> But this seems like over-engineering...
> 
> Note: This is a non-trivial revert, due to later merged commit e42c7beee71d
> ("bpf: net: Consider has_current_bpf_ctx() when testing capable() in sk_setsockopt()")
> which changed both 'ns_capable' into 'sockopt_ns_capable' calls.
> 
> Fixes: 1f86123b9749 ("net: align SO_RCVMARK required privileges with SO_MARK")
> Cc: Larysa Zaremba <larysa.zaremba@...el.com>
> Cc: Simon Horman <simon.horman@...igine.com>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: Eyal Birger <eyal.birger@...il.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Patrick Rohr <prohr@...gle.com>
> Signed-off-by: Maciej Żenczykowski <maze@...gle.com>

Reviewed-by: Simon Horman <simon.horman@...igine.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ