All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Julien Grall <julien.grall@arm.com>
Cc: "tee-dev@lists.linaro.org" <tee-dev@lists.linaro.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Volodymyr Babchuk <vlad.babchuk@gmail.com>
Subject: Re: [PATCH v4 06/10] xen/arm: optee: add support for RPC SHM buffers
Date: Wed, 20 Mar 2019 17:09:11 +0000	[thread overview]
Message-ID: <87k1gt8ocp.fsf@epam.com> (raw)
In-Reply-To: <b9adde4b-acd1-23d4-74b6-8807ba060d87@arm.com>



Julien Grall writes:

> Hi,
>
> On 20/03/2019 16:21, Volodymyr Babchuk wrote:
>>
>> Julien Grall writes:
>>> On 07/03/2019 21:04, Volodymyr Babchuk wrote:
>>>> From: Volodymyr Babchuk <vlad.babchuk@gmail.com>
>>>>
>>>> OP-TEE usually uses the same idea with command buffers (see
>>>> previous commit) to issue RPC requests. Problem is that initially
>>>> it has no buffer, where it can write request. So the first RPC
>>>> request it makes is special: it requests NW to allocate shared
>>>> buffer for other RPC requests. Usually this buffer is allocated
>>>> only once for every OP-TEE thread and it remains allocated all
>>>> the time until guest shuts down. Guest can ask OP-TEE to disable
>>>> RPC buffers caching, in this case OP-TEE will ask guest to
>>>> allocate/free buffer for the each RPC.
>>>>
>>>> Mediator needs to pin this buffer to make sure that domain can't
>>>> transfer it to someone else.
>>>
>>> At the moment, Xen on Arm doesn't support transfer of a page between
>>> domain (see steal_page). What we want to prevent here is the domain to
>>> free the page (via XENMEM_decrease_reservation). If the reference drop
>>> to 0, the page will be freed and could potentially be allocated for
>>> Xen usage or another domain. Taking the reference here, will prevent
>>> it to free until the reference is dropped.
>>>
>>> So I would reword this sentence. Something like:
>>>
>>> "Mediator needs to pin the buffer to make sure the page will not be
>>> freed while it is shared with OP-TEE".
>> When I wrote that, I kept in mind grant mappings as well. But, I
>> think, I was mistaken there, because grant mappings will have p2m type
>> p2m_grant_map_rw/p2m_grant_map_ro. So yeah, your variant is better. Thanks.
>
> I don't understand how grant mappings are related to this patch. What
> did you have in mind about them?

For some reason I assumed that following scenario would be possible:

Guest A grants access to own page to guest B. Guest B maps this page and
then shares it with OP-TEE.

My concern was that Guest B than can unmap granted page and release
grant, but it still be able to alter data on that page via OP-TEE.

But, looks I was mistaken there, because currently I'm checking p2m type to
be strictly p2m_ram_rw before sharing the page with OP-TEE. So mentioned
scenario is impossible in the first place.

-- 
Best regards,Volodymyr Babchuk
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-03-20 17:09 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 21:04 [PATCH v4 00/10] TEE mediator (and OP-TEE) support in XEN Volodymyr Babchuk
2019-03-07 21:04 ` [PATCH v4 01/10] xen/arm: add generic TEE mediator framework Volodymyr Babchuk
2019-03-15 15:03   ` Julien Grall
2019-03-07 21:04 ` [PATCH v4 02/10] xen/arm: optee: add OP-TEE header files Volodymyr Babchuk
2019-03-07 21:04 ` [PATCH v4 04/10] xen/arm: optee: add fast calls handling Volodymyr Babchuk
2019-03-15 15:46   ` Julien Grall
2019-03-07 21:04 ` [PATCH v4 03/10] xen/arm: optee: add OP-TEE mediator skeleton Volodymyr Babchuk
2019-03-15 15:24   ` Julien Grall
2019-03-15 19:00     ` Volodymyr Babchuk
2019-03-15 20:18       ` Julien Grall
2019-03-15 15:47   ` Julien Grall
2019-03-07 21:04 ` [PATCH v4 05/10] xen/arm: optee: add std call handling Volodymyr Babchuk
2019-03-18 13:50   ` Julien Grall
2019-03-20 16:14     ` Volodymyr Babchuk
2019-03-20 16:48       ` Julien Grall
2019-03-20 17:42         ` Volodymyr Babchuk
2019-03-20 18:08           ` Julien Grall
2019-03-07 21:04 ` [PATCH v4 07/10] xen/arm: optee: add support for arbitrary shared memory Volodymyr Babchuk
2019-03-18 15:27   ` Julien Grall
2019-03-20 16:39     ` Volodymyr Babchuk
2019-03-20 17:47       ` Julien Grall
2019-03-20 19:37         ` Volodymyr Babchuk
2019-03-21 10:39           ` Julien Grall
2019-03-07 21:04 ` [PATCH v4 06/10] xen/arm: optee: add support for RPC SHM buffers Volodymyr Babchuk
2019-03-18 14:21   ` Julien Grall
2019-03-20 16:21     ` Volodymyr Babchuk
2019-03-20 16:52       ` Julien Grall
2019-03-20 17:09         ` Volodymyr Babchuk [this message]
2019-03-07 21:04 ` [PATCH v4 09/10] tools/arm: tee: add "tee" option for xl.cfg Volodymyr Babchuk
2019-03-18 15:49   ` Julien Grall
2019-03-18 21:04     ` Achin Gupta
2019-03-20 16:18       ` Julien Grall
2019-03-20 15:27     ` Volodymyr Babchuk
2019-03-20 16:06       ` Julien Grall
2019-03-20 17:01         ` Volodymyr Babchuk
2019-03-20 18:35           ` Julien Grall
2019-04-05 10:25             ` Volodymyr Babchuk
2019-04-05 10:25               ` [Xen-devel] " Volodymyr Babchuk
2019-04-08 10:47               ` Julien Grall
2019-04-08 10:47                 ` [Xen-devel] " Julien Grall
2019-03-07 21:04 ` [PATCH v4 08/10] xen/arm: optee: add support for RPC commands Volodymyr Babchuk
2019-03-18 15:38   ` Julien Grall
2019-03-20 15:36     ` Volodymyr Babchuk
2019-03-20 16:27       ` Julien Grall
2019-03-20 16:47         ` Volodymyr Babchuk
2019-03-07 21:04 ` [PATCH v4 10/10] tools/arm: optee: create optee firmware node in DT if tee=native Volodymyr Babchuk
2019-03-18 15:50   ` 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=87k1gt8ocp.fsf@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=tee-dev@lists.linaro.org \
    --cc=vlad.babchuk@gmail.com \
    --cc=xen-devel@lists.xenproject.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.