From: Tamas K Lengyel <tamas.k.lengyel@gmail.com>
To: Julien Grall <julien.grall@arm.com>
Cc: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Volodymyr Babchuk <vlad.babchuk@gmail.com>,
Andrii Anisov <andrii.anisov@gmail.com>,
Oleksandr Tyshchenko <olekstysh@gmail.com>,
"Andrushchenko, Oleksandr" <andr2000@gmail.com>,
Xen-devel <xen-devel@lists.xen.org>,
Artem Mygaiev <joculator@gmail.com>
Subject: Re: [ARM] SMC (and HVC) handling in hypervisor
Date: Mon, 13 Feb 2017 09:59:41 -0700 [thread overview]
Message-ID: <CABfawhm8Pv4w34Qn5A3ZobH4sfmX0UV0GV2Peg=+1FuZ4wV2Dw@mail.gmail.com> (raw)
In-Reply-To: <83c79e43-b102-83af-b3c4-ffb7f4b3162d@arm.com>
On Mon, Feb 13, 2017 at 9:37 AM, Julien Grall <julien.grall@arm.com> wrote:
> Hi Tamas,
>
>
> On 13/02/17 16:20, Tamas K Lengyel wrote:
>>
>> On Fri, Feb 10, 2017 at 5:14 PM, Volodymyr Babchuk
>> <vlad.babchuk@gmail.com> wrote:
>>>
>>> Hello,
>>>
>>> This e-mail is sort of follow-up to the two threads: [1] (my thread
>>> about TEE interaction) and [2] (Edgar's thread regarding handling SMC
>>> calls in platform_hvc). I want to discuss more broad topic there.
>>>
>>> Obviously, there are growing number of SMC users and current state of
>>> SMC handling in Xen satisfies nobody. My team wants to handle SMCs in
>>> secure way, Xilinx wants to forward some calls directly to Secure
>>> Monitor, while allowing to handle other in userspace, etc.
>>>
>>> My proposition is to gather all requirements to SMC (and HVC) handling
>>> in one place (e.g. in this mail thread). After we' will have clear
>>> picture of what we want, we will be able to develop some solution,
>>> that will satisfy us all. At least, I hope so :)
>>>
>>> Also I want to remind, that there are ARM document called "SMC Calling
>>> Convention" [3]. According to it, any aarch64 hypervisor "must
>>> implement the Standard Secure and Hypervisor Service calls". At this
>>> moment XEN does not conform to this.
>>>
>>> So, lets get started with the requirements:
>>> 0. There are no much difference between SMC and HVC handling (at least
>>> according to SMCCC).
>>> 1. Hypervisor should at least provide own UUID and version while
>>> called by SMC/HVC
>>> 2. Hypervisor should forward some calls from dom0 directly to Secure
>>> Monitor (Xilinx use case)
>>> 3. Hypervisor should virtualize PSCI calls, CPU service calls, ARM
>>> architecture service calls, etc.
>>> 4. Hypervisor should handle TEE calls in a secure way (e.g. no
>>> untrusted handlers in Dom0 userspace).
>>> 5. Hypervisor should support multiple TEEs (at least at compilation
>>> time).
>>> 6. Hypervisor should do this as fast as possible (DRM playback use case).
>>> 7. All domains (including dom0) should be handled in the same way.
>>> 8. Not all domains will have right to issue certain SMCs.
>>> 9. Hypervisor will issue own SMCs in some cases.
>>
>>
>> 10. Domains on which the monitor privileged call feature is enabled
>> (which is by default disabled for all domains) should not be able to
>> issue SMCs such that it reaches the firmware directly. Xen should not
>> bounce such calls to the firmware on behalf of the domain. Xen should
>> not alter the state of the domain automatically (ie. incrementing PC).
>> These calls should be exclusively transfered to the monitor subscriber
>> for further processing. HVC calls need not be included in the monitor
>> forwarding as long as the HVC call can be governed by XSM.
>
>
> This should not be a strong requirement. Whilst in your use case you want to
> forward all the SMCs to the monitor app, there are use case where Xen would
> need to emulate SMCs on the behalf of the guest. For instance see PSCI
> (arch/arm/vpsci.c).
In my usecases it is a strong requirement. What happens when the
monitor system is disabled is beyond my concerns - Xen can emulate or
forward the call as it wishes. But when the monitor application is in
use - in my usecase - it needs to be in exclusive control. If that
breaks an in-guest application, that is acceptable in my usecase. As
soon as there is another usecase that would need to support such an
application while the monitor system is enabled, the monitor system
can be fine-tuned for those needs to allow Xen to emulate. I've said
it many times, I have nothing against doing that, but as I don't need
it I won't be able to spend time implementing it.
>
> Another valid use case is Xen handling power management for device assigned
> to the guest and having the monitor app acting as a "Trusted App".
>
> Regarding the HVC call governed by XSM. I think this is the wrong way to g.
> As it was mentioned a couple of time HVC is a valid conduit for Secure
> monitor call. You should not deny them on the basis that your monitor app is
> not able to handle it properly. A better way would be to have a list of
> Secure Monitor Call (HVC/SMC) that should be forwarded to the monitor app.
I disagree. XSM needs to be in complete control of all hypercalls.
Whether denying some of them will break an application or not is not
Xen's concern. That is up to me as a user of Xen and XSM. If Xen
overrides a XSM policy because we hard-coded HVCs that pass-through,
that is a huge security policy violation. So even if we make a list of
HVCs that should also fall under the monitor privileged call umbrella,
it should still not override XSM. So since I would not be looking to
emulate anything that gets forwarded as a result of an HVC call, XSM
works for me just fine as the only thing I would do anyway is deny
them. So why would that list help when I might as well just make my
list more efficiently using XSM?
Tamas
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-02-13 16:59 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-11 0:14 [ARM] SMC (and HVC) handling in hypervisor Volodymyr Babchuk
2017-02-13 16:20 ` Tamas K Lengyel
2017-02-13 16:29 ` Volodymyr Babchuk
2017-02-13 16:37 ` Tamas K Lengyel
2017-02-13 16:37 ` Julien Grall
2017-02-13 16:59 ` Tamas K Lengyel [this message]
2017-02-13 18:06 ` Julien Grall
2017-02-13 19:54 ` Tamas K Lengyel
2017-02-13 21:13 ` Stefano Stabellini
2017-02-13 21:32 ` Tamas K Lengyel
2017-02-13 21:54 ` Stefano Stabellini
2017-02-13 22:11 ` Tamas K Lengyel
2017-02-13 22:14 ` Stefano Stabellini
2017-02-14 18:06 ` Julien Grall
2017-02-14 18:52 ` Tamas K Lengyel
2017-02-14 19:11 ` Stefano Stabellini
2017-02-14 20:14 ` Tamas K Lengyel
2017-02-23 18:16 ` Julien Grall
2017-02-28 13:51 ` Julien Grall
2017-03-01 14:13 ` Volodymyr Babchuk
2017-03-01 16:09 ` Julien Grall
2017-03-01 16:18 ` Julien Grall
2017-03-01 16:47 ` Volodymyr Babchuk
2017-03-02 17:54 ` Volodymyr Babchuk
2017-03-02 20:24 ` Tamas K Lengyel
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='CABfawhm8Pv4w34Qn5A3ZobH4sfmX0UV0GV2Peg=+1FuZ4wV2Dw@mail.gmail.com' \
--to=tamas.k.lengyel@gmail.com \
--cc=andr2000@gmail.com \
--cc=andrii.anisov@gmail.com \
--cc=edgar.iglesias@xilinx.com \
--cc=joculator@gmail.com \
--cc=julien.grall@arm.com \
--cc=olekstysh@gmail.com \
--cc=sstabellini@kernel.org \
--cc=vlad.babchuk@gmail.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).