From: David Brazdil <dbrazdil@google.com>
To: selinux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Paul Moore <paul@paul-moore.com>,
Stephen Smalley <stephen.smalley.work@gmail.com>,
Eric Paris <eparis@parisplace.org>,
Jeff Vander Stoep <jeffv@google.com>,
Alistair Delva <adelva@google.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v2] selinux: vsock: Set SID for socket returned by accept()
Date: Fri, 19 Mar 2021 13:30:23 +0000 [thread overview]
Message-ID: <YFSnb/kGpn7xPPR8@google.com> (raw)
In-Reply-To: <20210319130541.2188184-1-dbrazdil@google.com>
On Fri, Mar 19, 2021 at 01:05:41PM +0000, David Brazdil wrote:
> For AF_VSOCK, accept() currently returns sockets that are unlabelled.
> Other socket families derive the child's SID from the SID of the parent
> and the SID of the incoming packet. This is typically done as the
> connected socket is placed in the queue that accept() removes from.
>
> Reuse the existing 'security_sk_clone' hook to copy the SID from the
> parent (server) socket to the child. There is no packet SID in this
> case.
>
> Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Cc: <stable@vger.kernel.org>
> Signed-off-by: David Brazdil <dbrazdil@google.com>
> ---
> Tested on Android AOSP and Fedora 33 with v5.12-rc3.
> Unit test is available here:
> https://github.com/SELinuxProject/selinux-testsuite/pull/75
>
> Changes since v1:
> * reuse security_sk_clone instead of adding a new hook
>
> net/vmw_vsock/af_vsock.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> index 5546710d8ac1..bc7fb9bf3351 100644
> --- a/net/vmw_vsock/af_vsock.c
> +++ b/net/vmw_vsock/af_vsock.c
> @@ -755,6 +755,7 @@ static struct sock *__vsock_create(struct net *net,
> vsk->buffer_size = psk->buffer_size;
> vsk->buffer_min_size = psk->buffer_min_size;
> vsk->buffer_max_size = psk->buffer_max_size;
> + security_sk_clone(parent, sk);
> } else {
> vsk->trusted = ns_capable_noaudit(&init_user_ns, CAP_NET_ADMIN);
> vsk->owner = get_current_cred();
> --
> 2.31.0.rc2.261.g7f71774620-goog
>
next prev parent reply other threads:[~2021-03-19 13:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-19 13:05 [PATCH v2] selinux: vsock: Set SID for socket returned by accept() David Brazdil
2021-03-19 13:30 ` David Brazdil [this message]
2021-03-19 21:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YFSnb/kGpn7xPPR8@google.com \
--to=dbrazdil@google.com \
--cc=adelva@google.com \
--cc=eparis@parisplace.org \
--cc=jeffv@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.