All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Jeremy White <jwhite@codeweavers.com>,
	"Daniel P. Berrange" <berrange@redhat.com>
Cc: spice-devel@lists.freedesktop.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [Spice-devel] [RFC PATCH 1/1] Add a usbredir kernel module to remotely connect USB devices over IP.
Date: Wed, 1 Jul 2015 20:45:03 +0200	[thread overview]
Message-ID: <5594352F.7080003@redhat.com> (raw)
In-Reply-To: <55943213.6040901@codeweavers.com>

Hi,

On 01-07-15 20:31, Jeremy White wrote:
>> Assuming that's correct, then this seems to imply that the socket has raw
>> plain text data being sent/received, and thus precludes the possibility
>> of running any security protocol like TLS unless the kernel wants to have
>> an impl of the TLS protocol.
>
> Good point.  For completeness, I'll note that, in a Spice use case, the
> data would be encrypted by the normal Spice mechanisms.  And it would be
> fairly straight forward to write a user space daemon that would accept
> TLS and then relay to the unencrypted socket (of course, it would
> rewrite everything, which would be inefficient).
>
>>
>> I don't really think it is sensible to be defining & implementing new
>> network services which can't support strong encryption and authentication.
>> Rather than passing the file descriptor to the kernel and having it do
>> the I/O directly, I think it would be better to dissassociate the kernel
>> from the network transport, and thus leave all sockets layer data I/O
>> to userspace daemons so they can layer in TLS or SASL or whatever else
>> is appropriate for the security need.
>
> And that would also eliminate the need to copy the parsing code, which
> would be a nice improvement.
>
> I considered this approach, but discarded it, perhaps wrongly, when my
> google fu suggested that netlink sockets were the best way to connect
> user space and a kernel module.  (Because I perceived netlink sockets to
> be functionally equivalent to the relay daemon described, above).
>
>  From the user space perspective, the usbredir parser has an interface
> that exposes about 20 callback functions, which are invoked with
> pointers to a variety of structures.  The ideal would be to have a
> mechanism to 'call into' kernel space with those varying interfaces.
>
> Would using ioctls be a reasonable way to achieve this?  Is there a
> better way?
>
> In the other direction, the usbredir hc provides a range of functions; I
> think most interesting are the urb en/dequeue, hub control, and hub
> status calls.  Some of that can be handled in the driver; some would
> need to be passed on to user space.
>
> My google fu did not lead me to an obvious way to pass this information
> to user space.  The approach that comes to mind is to use a signal, or
> woken socket, to instruct user space to poll.
>
> I'd appreciate further comments and advice.

I think it makes sense to have the actual usbredir protocol parsing
in the kernel, and use a netlink interface, this will make it much
easier to deal with protocol extensions (although we have not had
any extensions to the usbredir proto in a while), and will be much
cleaner then an ioctl interface.

I think that Daniel's concern can easily be fixed by rather then
passing the fd of a socket into the kernel to simply forwarding the
data back and forth from a socket opened by userspace into the netlink
socket. This way SSL, SASL or whatever can be put in between, and
you can even built a nice test-suite this way :)

The downside of this is introducing an extra memcpy of all the data,
but an ioctl interface has the same problem and is going to be
unwieldy, so I advice against that.

As for the extra memcpy I would not worry about that, in all the
performance testing I've done it has almost always been all about
latency not throughput.

Regards,

Hans

  reply	other threads:[~2015-07-01 18:45 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 21:44 [RFC PATCH 0/1] RFC - Implement a usbredir kernel module Jeremy White
2015-06-30 21:44 ` [RFC PATCH 1/1] Add a usbredir kernel module to remotely connect USB devices over IP Jeremy White
2015-06-30 23:48   ` Greg KH
2015-07-01  3:34     ` Jeremy White
2015-07-01  5:44       ` Greg KH
2015-07-01 15:55         ` Jeremy White
2015-07-01 16:13           ` Greg KH
2015-07-01 18:39             ` Hans de Goede
2015-07-07 16:47             ` Jeremy White
2015-07-08  7:11               ` Hans de Goede
2015-07-09  0:19                 ` Jeremy White
2015-07-01  9:06   ` [Spice-devel] " Daniel P. Berrange
2015-07-01 18:31     ` Jeremy White
2015-07-01 18:45       ` Hans de Goede [this message]
2015-07-02  8:45     ` Oliver Neukum
2015-07-02 11:35       ` Hans de Goede
2015-07-02 12:10         ` Oliver Neukum
2015-07-02 15:57           ` Jeremy White
2015-07-02 18:46             ` Oliver Neukum
2015-07-02 19:02               ` Jeremy White
2015-07-02 19:59                 ` Alan Stern
2015-07-02 20:06                   ` Jeremy White
2015-07-02 20:20                     ` Alan Stern
2015-07-03  8:51                       ` Krzysztof Opasiak
2015-07-03 14:04                         ` Alan Stern
2015-07-06  8:20                         ` Oliver Neukum
2015-07-06 20:14                           ` Jeremy White
2015-07-06 20:22                             ` Alan Stern
     [not found]                               ` <mnlh2b$1cs$1@ger.gmane.org>
2015-07-22 14:03                                 ` Jeremy White
2015-07-22 14:34                                   ` Greg KH
2015-07-22 16:55                                     ` Jeremy White
2015-07-22 17:59                                       ` Sean O. Stalley
2015-07-23  0:20                                         ` Jeremy White
2015-12-09 22:32                                           ` Jeremy White

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=5594352F.7080003@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=berrange@redhat.com \
    --cc=jwhite@codeweavers.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=spice-devel@lists.freedesktop.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 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.