xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Bhupinder Thakur <bhupinder.thakur@linaro.org>
To: Julien Grall <julien.grall@arm.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Steve Capper <Steve.Capper@arm.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Xen Devel <xen-devel@lists.xen.org>,
	Jan Beulich <JBeulich@suse.com>,
	Christoffer Dall <christoffer.dall@linaro.org>
Subject: Re: Xen ARM - Exposing a PL011 to the guest
Date: Thu, 29 Dec 2016 14:47:25 +0530	[thread overview]
Message-ID: <CACtJ1JRbkBi==VBDZN200eG1OPGo2_nXRx1AHWgESbUo-1EXWQ@mail.gmail.com> (raw)
In-Reply-To: <b58fc8c9-fc04-389f-93de-f7105a437580@arm.com>

On 28 December 2016 at 23:19, Julien Grall <julien.grall@arm.com> wrote:
> On 21/12/16 22:12, Stefano Stabellini wrote:
>>
>> On Wed, 21 Dec 2016, Julien Grall wrote:
>>>
>>> On 20/12/2016 20:53, Stefano Stabellini wrote:
>>>>
>>>> On Tue, 20 Dec 2016, Julien Grall wrote:
>>>>>
>>>>> On 19/12/2016 21:24, Stefano Stabellini wrote:
>>>>>>
>>>>>> On Mon, 19 Dec 2016, Christoffer Dall wrote:
>>>>>>>
>>>>>>> On Fri, Dec 16, 2016 at 05:03:13PM +0000, Julien Grall wrote:
>>>>>>
>>>>>> If we use hvm_params for this, we need two new hvm_params and Xen
>>>>>> needs
>>>>>> to unmap the pfn from the guest immediately, because we don't want the
>>>>>> guest to have access to it.
>>>>>
>>>>>
>>>>> If you unmap the pfn, the PV backend will not be able to request the
>>>>> page
>>>>> because there will be no translation available.
>>>>>
>>>>> So what you want to do is preventing the guest to at least write into
>>>>> region
>>>>> (not sure if it is worth to restrict read)
>>>>
>>>>
>>>> That's a good idea.
>>>>
>>>>
>>>>> and unmap the page via the hypercall XENMEM_decrease_reservation.
>>>>
>>>>
>>>> That would be issued by the guest itself, right? To save address space?
>>>
>>>
>>> Correct. The main use case today is ballooning, but guest could call it
>>> on any
>>> other RAM baked page.
>>>
>>> I was thinking about more about the protection needed. Technically the
>>> data in
>>> the ring are not trusted. So if the guest is messing up with it, it would
>>> not
>>> be a big issue. Or did I miss anything here?
>>
>>
>> I understand that a guest would be smart to call
>> XENMEM_decrease_reservation on the PV console page for pl011, but it
>> cannot be a security measure, because, in fact, it needs to be called by
>> the guest.  Of course, a malicious guest can simply not call
>> XENMEM_decrease_reservation for it.
>
>
> Sorry I was not clear. I was not suggested the guest to call
> XENMEM_decrease_reservation on ring for security but a malicious guest
> issuing the hypercall on the ring protected and replacing by another page.
>
> This is the exact same problem as the one I mentioned on the ITS thread. The
> page live in guest memory but contains data that will only be touched by
> Xen.
>
> If you remove those page from stage-2, the translation IPA -> MFN will be
> lost unless you store somewhere else. You would have to do it per-page as
> the buffer will use contiguous IPA but potentially noncontiguous MFN.
>
> In the case of ITS the memory is provisioned by the guest. So there are not
> much to do there except adding protection in stage-2 such as write
> protection and preventing the guest to unmap it. However for the pl011 ring,
> as Andrew pointed on IRC, what we need to do is accounting this page to the
> domain memory. No mapping is necessary in stage-2.

Please clarify what is meant by that no stage-2 mapping is required.
Does it mean that no stage-2 mapping is required for the guest as it
never needs to access this page?

However, the Xen HYP will need the stage-2 mapping to find out the
pl011 PFN --> physical MFN mapping so that it can map the page to its
own address space. Currently, I am using prepare_ring_for_helper () to
map the pl011 PFN (passed via hvm call) ---> phyiscal MFN ---> Xen HYP
VA.

Regards,
Bhupinder

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-12-29  9:17 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-30 15:29 Xen ARM - Exposing a PL011 to the guest Julien Grall
2016-11-30 16:24 ` Christoffer Dall
2016-12-01 15:51   ` Julien Grall
2016-11-30 17:02 ` Volodymyr Babchuk
2016-11-30 22:26 ` Stefano Stabellini
2016-12-01 10:26   ` Christoffer Dall
2016-12-01 21:55     ` Stefano Stabellini
2016-12-16 10:06       ` Bhupinder Thakur
2016-12-16 17:03         ` Julien Grall
2016-12-19 12:20           ` Christoffer Dall
2016-12-19 20:24             ` Stefano Stabellini
2016-12-20  9:46               ` Bhupinder Thakur
2016-12-20 22:29                 ` Stefano Stabellini
2016-12-20 12:32               ` Julien Grall
2016-12-20 19:53                 ` Stefano Stabellini
2016-12-20 20:26                   ` Stefano Stabellini
2016-12-21 19:19                   ` Julien Grall
2016-12-21 22:12                     ` Stefano Stabellini
2016-12-28 17:49                       ` Julien Grall
2016-12-28 17:52                         ` Julien Grall
2016-12-29  9:17                         ` Bhupinder Thakur [this message]
2017-01-03 20:08                           ` Stefano Stabellini
2017-01-06 10:18                             ` Bhupinder Thakur
2017-01-06 21:54                               ` Stefano Stabellini
2017-01-10 11:39                                 ` Bhupinder Thakur
2017-01-11  0:22                                   ` Stefano Stabellini
2017-01-17 14:01                                 ` Julien Grall
2017-01-17 13:31                             ` Julien Grall
2017-01-17 19:27                               ` Stefano Stabellini
2017-01-27 12:14                                 ` Bhupinder Thakur
2017-01-27 19:13                                   ` Stefano Stabellini
2017-01-29 11:06                                   ` Christoffer Dall
2017-02-03 13:53                                     ` Bhupinder Thakur
2017-02-03 14:08                                       ` Julien Grall
2017-02-08 12:39                                         ` Bhupinder Thakur
2017-02-09  0:10                                           ` Stefano Stabellini
2017-02-13  8:50                                             ` Bhupinder Thakur
2017-02-13 21:44                                               ` Stefano Stabellini
2017-02-15  8:15                                                 ` Bhupinder Thakur
2017-02-15  8:24                                                   ` Bhupinder Thakur
2017-02-15 21:21                                                     ` Stefano Stabellini
2017-02-23 13:15                                                       ` Bhupinder Thakur
2017-02-23 15:00                                                         ` Wei Liu
2017-02-03 14:15                                       ` Christoffer Dall
2017-01-03 19:38                         ` Stefano Stabellini
2016-12-20 12:47               ` Christoffer Dall
2016-12-20 21:33                 ` Stefano Stabellini
2016-12-21 11:55                   ` Christoffer Dall
2016-12-21 20:32                   ` Julien Grall

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='CACtJ1JRbkBi==VBDZN200eG1OPGo2_nXRx1AHWgESbUo-1EXWQ@mail.gmail.com' \
    --to=bhupinder.thakur@linaro.org \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=Steve.Capper@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=christoffer.dall@linaro.org \
    --cc=george.dunlap@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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).