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: <20221202122332.GC7057@breakpoint.cc>
Date:   Fri, 2 Dec 2022 13:23:32 +0100
From:   Florian Westphal <fw@...len.de>
To:     Paolo Abeni <pabeni@...hat.com>
Cc:     Paul Moore <paul@...l-moore.com>,
        Ondrej Mosnacek <omosnace@...hat.com>,
        SElinux list <selinux@...r.kernel.org>,
        Linux Security Module list 
        <linux-security-module@...r.kernel.org>, mptcp@...ts.linux.dev,
        network dev <netdev@...r.kernel.org>,
        Mat Martineau <mathew.j.martineau@...ux.intel.com>,
        Matthieu Baerts <matthieu.baerts@...sares.net>
Subject: Re: Broken SELinux/LSM labeling with MPTCP and accept(2)

Paolo Abeni <pabeni@...hat.com> wrote:
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 99f5e51d5ca4..b8095b8df71d 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -3085,7 +3085,10 @@ struct sock *mptcp_sk_clone(const struct sock *sk,
>  	/* will be fully established after successful MPC subflow creation */
>  	inet_sk_state_store(nsk, TCP_SYN_RECV);
>  
> -	security_inet_csk_clone(nsk, req);
> +	/* let's the new socket inherit the security label from the msk
> +	 * listener, as the TCP reqest socket carries a kernel context
> +	 */
> +	security_sock_graft(nsk, sk->sk_socket);
>  	bh_unlock_sock(nsk);

FWIW this makes Ondrejs test case work:

before:
mptcp successfully enabled on unit /usr/lib/systemd/system/nginx.service
% Total    % Received % Xferd  Average Speed   Time    Time     Time % Current
Dload  Upload   Total   Spent    Left Speed
0     0    0     0    0     0 0      0 --:--:-- --:--:-- --:--:-- 0
curl: (52) Empty reply from server

With above change:
mptcp successfully enabled on unit /usr/lib/systemd/system/nginx.service
% Total    % Received % Xferd  Average Speed   Time    Time     Time % Current
Dload  Upload   Total   Spent    Left Speed 100     5  100     5    0     0 1770      0 --:--:-- --:--:-- --:--:--  5000

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ