qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wei Wang <wei.w.wang@intel.com>
To: "Jan Kiszka" <jan.kiszka@siemens.com>,
	"Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Stefan Hajnoczi" <stefanha@gmail.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>
Cc: Jailhouse <jailhouse-dev@googlegroups.com>
Subject: Re: [Qemu-devel] [virtio-dev] Re: Vhost-pci RFC2.0
Date: Thu, 20 Apr 2017 14:51:28 +0800	[thread overview]
Message-ID: <58F85A70.8080006@intel.com> (raw)
In-Reply-To: <b752f6cb-b75e-dbae-73cf-ef3fee5516d5@siemens.com>

On 04/19/2017 10:52 PM, Jan Kiszka wrote:
> On 2017-04-19 16:33, Wang, Wei W wrote:
>> On 04/19/2017 07:21 PM, Jan Kiszka wrote:
>>> On 2017-04-19 13:11, Wei Wang wrote:
>>>> On 04/19/2017 06:36 PM, Jan Kiszka wrote:
>>>>> On 2017-04-19 12:02, Wei Wang wrote:
>>>>>>>>>> The design presented here intends to use only one BAR to expose
>>>>>>>>>> both TX and RX. The two VMs share an intermediate memory here,
>>>>>>>>>> why couldn't we give the same permission to TX and RX?
>>>>>>>>>>
>>>>>>>>> For security and/or safety reasons: the TX side can then safely
>>>>>>>>> prepare and sign a message in-place because the RX side cannot
>>>>>>>>> mess around with it while not yet being signed (or check-summed).
>>>>>>>>> Saves one copy from a secure place into the shared memory.
>>>>>>>> If we allow guest1 to write to RX, what safety issue would it
>>>>>>>> cause to guest2?
>>>>>>> This way, guest1 could trick guest2, in a race condition, to sign a
>>>>>>> modified message instead of the original one.
>>>>>>>
>>>>>> Just align the context that we are talking about: RX is the
>>>>>> intermediate shared ring that guest1 uses to receive packets and
>>>>>> guest2 uses to send packet.
>>>>>>
>>>>>> Seems the issue is that guest1 will receive a hacked message from RX
>>>>>> (modified by itself). How would it affect guest2?
>>>>> Retry: guest2 wants to send a signed/hashed message to guest1. For
>>>>> that purpose, it starts to build that message inside the shared
>>>>> memory that
>>>>> guest1 can at least read, then guest2 signs that message, also in-place.
>>>>> If guest1 can modify the message inside the ring while guest2 has not
>>>>> yet signed it, the result is invalid.
>>>>>
>>>>> Now, if guest2 is the final receiver of the message, nothing is lost,
>>>>> guest2 just shot itself into the foot. However, if guest2 is just a
>>>>> router (gray channel) and the message travels further, guest2 now has
>>>>> corrupted that channel without allowing the final receive to detect
>>>>> that. That's the scenario.
>>>> If guest2 has been a malicious guest, I think it wouldn't make a
>>>> difference whether we protect the shared RX or not. As a router,
>>>> guest2 can play tricks on the messages after read it and then send the
>>>> modified message to a third man, right?
>>> It can swallow it, "steal" it (redirect), but it can't manipulate the signed content
>>> without being caught, that's the idea. It's particularly relevant for safety-critical
>>> traffic from one safe application to another over unreliable channels, but it may
>>> also be relevant for the integrity of messages in a secure setup.
>>>
>> OK, I see most of your story, thanks. To get to the bottom of it, is it possible to
>> Sign the packet before put it onto the unreliable channel (e.g. the shared RX),
>> Instead of signing in-place? If that's doable, we can have a simpler shared channel.
> Of course, you can always add another copy... But as it was trivial to
> add unidirectional shared memory support to ivshmem [1], I see no reason
> this shouldn't be possible for vhost-pci as well.
>

IIUC, this requires the ring and it's head/tail to be put into different 
regions, it would
be hard to fit the existing virtqueue into the shared the channel, since 
the vring and
its pointers (e.g. idx) and flags are on the same page.
So, probably will need to use another ring type.


Best,
Wei

  reply	other threads:[~2017-04-20  6:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19  6:38 [Qemu-devel] Vhost-pci RFC2.0 Wang, Wei W
2017-04-19  7:31 ` Marc-André Lureau
2017-04-19  8:33   ` Wei Wang
2017-04-19  7:35 ` Jan Kiszka
2017-04-19  8:42   ` Wei Wang
2017-04-19  8:49     ` [Qemu-devel] [virtio-dev] " Jan Kiszka
2017-04-19  9:09       ` Wei Wang
2017-04-19  9:31         ` Jan Kiszka
2017-04-19 10:02           ` Wei Wang
2017-04-19 10:36             ` Jan Kiszka
2017-04-19 11:11               ` Wei Wang
2017-04-19 11:21                 ` Jan Kiszka
2017-04-19 14:33                   ` Wang, Wei W
2017-04-19 14:52                     ` Jan Kiszka
2017-04-20  6:51                       ` Wei Wang [this message]
2017-04-20  7:05                         ` Jan Kiszka
2017-04-20  8:58                           ` Wei Wang
2017-04-19  9:57 ` [Qemu-devel] [virtio-dev] " Stefan Hajnoczi
2017-04-19 10:42   ` Wei Wang
2017-04-19 15:24     ` Stefan Hajnoczi
2017-04-20  5:51       ` Wei Wang
2017-05-02 12:48         ` Stefan Hajnoczi
2017-05-03  6:02           ` Wei Wang
2017-05-05  4:05 ` Jason Wang
2017-05-05  6:18   ` Wei Wang
2017-05-05  9:18     ` Jason Wang
2017-05-08  1:39       ` Wei Wang

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=58F85A70.8080006@intel.com \
    --to=wei.w.wang@intel.com \
    --cc=jailhouse-dev@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=virtio-dev@lists.oasis-open.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).