From: Ian Campbell <ian.campbell@docker.com>
To: Stefan Hajnoczi <stefanha@redhat.com>, kvm@vger.kernel.org
Cc: netdev@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>,
"Matt Benjamin" <mbenjamin@redhat.com>,
"Christoffer Dall" <christoffer.dall@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"marius vlad" <marius.vlad0@gmail.com>,
areis@redhat.com,
"Claudio Imbrenda" <imbrenda@linux.vnet.ibm.com>,
"Greg Kurz" <gkurz@linux.vnet.ibm.com>,
virtualization@lists.linux-foundation.org
Subject: Re: [RFC v5 0/5] Add virtio transport for AF_VSOCK
Date: Fri, 08 Apr 2016 16:35:05 +0100 [thread overview]
Message-ID: <1460129705.1749.25.camel@docker.com> (raw)
In-Reply-To: <1459520587-12337-1-git-send-email-stefanha@redhat.com>
On Fri, 2016-04-01 at 15:23 +0100, Stefan Hajnoczi wrote:
> This series is based on Michael Tsirkin's vhost branch (v4.5-rc6).
>
> I'm about to process Claudio Imbrenda's locking fixes for virtio-vsock but
> first I want to share the latest version of the code. Several people are
> playing with vsock now so sharing the latest code should avoid duplicate work.
Thanks for this, I've been using it in my project and it mostly seems
fine.
One wrinkle I came across, which I'm not sure if it is by design or a
problem is that I can see this sequence coming from the guest (with
other activity in between):
1) OP_SHUTDOWN w/ flags == SHUTDOWN_RX
2) OP_SHUTDOWN w/ flags == SHUTDOWN_TX
3) OP_SHUTDOWN w/ flags == SHUTDOWN_TX|SHUTDOWN_RX
I orignally had my backend close things down at #2, however this meant
that when #3 arrived it was for a non-existent socket (or, worse, an
active one if the ports got reused). I checked v5 of the spec
proposal[0] which says:
If these bits are set and there are no more virtqueue buffers
pending the socket is disconnected.
but I'm not entirely sure if this behaviour contradicts this or not
(the bits have both been set at #2, but not at the same time).
BTW, how does one tell if there are no more virtqueue buffers pending
or not while processing the op?
Another thing I noticed, which is really more to do with the generic
AF_VSOCK bits than anything to do with your patches is that there is no
limitations on which vsock ports a non-privileged user can bind to and
relatedly that there is no netns support so e.g. users in unproivileged
containers can bind to any vsock port and talk to the host, which might
be undesirable. For my use for now I just went with the big hammer
approach of denying access from anything other than init_net
namespace[1] while I consider what the right answer is.
Ian.
[0] http://thread.gmane.org/gmane.comp.emulators.virtio.devel/1092
[1]
From 366c9c42afb9bd54f92f72518470c09e46f12e88 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ian.campbell@docker.com>
Date: Mon, 4 Apr 2016 14:50:10 +0100
Subject: [PATCH] VSOCK: Only allow host network namespace to use AF_VSOCK.
The VSOCK addressing schema does not really lend itself to simply creating an
alternative end point address within a namespace.
Signed-off-by: Ian Campbell <ian.campbell@docker.com>
---
net/vmw_vsock/af_vsock.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 1e5f5ed..cdb3dd3 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1840,6 +1840,9 @@ static const struct proto_ops vsock_stream_ops = {
static int vsock_create(struct net *net, struct socket *sock,
int protocol, int kern)
{
+ if (!net_eq(net, &init_net))
+ return -EAFNOSUPPORT;
+
if (!sock)
return -EINVAL;
--
2.8.0.rc3
next prev parent reply other threads:[~2016-04-08 15:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-01 14:23 [RFC v5 0/5] Add virtio transport for AF_VSOCK Stefan Hajnoczi
2016-04-01 14:23 ` [RFC v5 1/5] VSOCK: transport-specific vsock_transport functions Stefan Hajnoczi
2016-04-01 14:23 ` [RFC v5 2/5] VSOCK: Introduce virtio_vsock_common.ko Stefan Hajnoczi
2016-04-01 14:23 ` [RFC v5 3/5] VSOCK: Introduce virtio_transport.ko Stefan Hajnoczi
2016-04-01 14:23 ` [RFC v5 4/5] VSOCK: Introduce vhost_vsock.ko Stefan Hajnoczi
2016-04-01 14:23 ` [RFC v5 5/5] VSOCK: Add Makefile and Kconfig Stefan Hajnoczi
2016-04-08 15:35 ` Ian Campbell [this message]
2016-04-11 10:45 ` [RFC v5 0/5] Add virtio transport for AF_VSOCK Stefan Hajnoczi
2016-04-11 12:54 ` Michael S. Tsirkin
2016-04-12 13:59 ` Stefan Hajnoczi
2016-04-12 16:37 ` Ian Campbell
2016-04-13 13:38 ` Stefan Hajnoczi
2016-04-12 16:07 ` Ian Campbell
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=1460129705.1749.25.camel@docker.com \
--to=ian.campbell@docker.com \
--cc=alex.bennee@linaro.org \
--cc=areis@redhat.com \
--cc=christoffer.dall@linaro.org \
--cc=gkurz@linux.vnet.ibm.com \
--cc=imbrenda@linux.vnet.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=marius.vlad0@gmail.com \
--cc=mbenjamin@redhat.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).