From: Zhiquan Li <zhiquan1.li@intel.com>
To: Kai Huang <kai.huang@intel.com>,
"Luck, Tony" <tony.luck@intel.com>,
Jarkko Sakkinen <jarkko@kernel.org>
Cc: "linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"Christopherson,, Sean" <seanjc@google.com>,
"Du, Fan" <fan.du@intel.com>, <zhiquan1.li@intel.com>
Subject: Re: [PATCH 0/4] x86/sgx: fine grained SGX MCA behavior
Date: Wed, 18 May 2022 09:02:42 +0800 [thread overview]
Message-ID: <443cb425-009c-2784-56f4-5e707122de76@intel.com> (raw)
In-Reply-To: <52dc7f50b68c99cecb9e1c3383d9c6d88734cd67.camel@intel.com>
On 2022/5/17 08:43, Kai Huang wrote:
> On Mon, 2022-05-16 at 16:40 +0800, Zhiquan Li wrote:
>> On 2022/5/16 10:29, Kai Huang wrote:
>>> On Sat, 2022-05-14 at 13:39 +0800, Zhiquan Li wrote:
>>>> On 2022/5/14 00:35, Luck, Tony wrote:
>>>>>>> Do you think the processes sharing the same enclave need to be killed,
>>>>>>> even they had not touched the EPC page with hardware error?
>>>>>>> Any ideas are welcome.
>>>>>> I do not think the patch set is going to wrong direction. This discussion
>>>>>> was just missing from the cover letter.
>>>> OK, I will add this point into v2 of cover letter and patch 03.
>>>>
>>>>
>>> I don't think you should add to patch 03. The same enclave can be shared by
>>> multiple processes is only true for host enclaves, but not virtual EPC isntance.
>>> Virtual EPC instance is just a raw EPC resource which is accessible to guest,
>>> but how enclaves are created on this EPC resource is completely upto guest.
>>> Therefore, one virtual EPC cannot be shared by two guests.
>>>
>> Thanks for your clarification, Kai.
>> Patch 04 is for the host case, we can put it there.
>>
>> May I add your comments in patch 03 and add you as "Acked-by" in v2?
>> I suppose it is a good answer if someone has the same question.
>>
> Yes you can add the comments to the patch.
>
> One problem is currently we don't explicitly prevent vepc being shared via
> fork(). For instance, an application can open /dev/sgx_vepc, mmap(), and
> fork(). Then if the child does mmap() against the fd opened by the parent, the
> child will share the same vepc with the parent.
>
> We can either explicitly enforce that only one process can mmap() to one vepc in
> mmap() of vepc, or we can put into comment saying something like below:
>
> Unlike host encalves, virtual EPC instance cannot be shared by multiple
> VMs. It is because how enclaves are created is totally upto the guest.
> Sharing virtual EPC instance will very likely to unexpectedly break
> enclaves in all VMs.
>
> SGX virtual EPC driver doesn't explicitly prevent virtual EPC instance
> being shared by multiple VMs via fork(). However KVM doesn't support
> running a VM across multiple mm structures, and the de facto userspace
> hypervisor (Qemu) doesn't use fork() to create a new VM, so in practice
> this should not happen.
>
Very excellent explanation!! I will put them into patch 03.
Thanks a lot, Kai.
Best Regards,
Zhiquan
> I'd like to hear from others whether simply adding some comment is fine.
>
> -- Thanks, -Kai
prev parent reply other threads:[~2022-05-18 1:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-10 3:16 [PATCH 0/4] x86/sgx: fine grained SGX MCA behavior Zhiquan Li
2022-05-11 10:29 ` Jarkko Sakkinen
2022-05-12 12:03 ` Zhiquan Li
2022-05-13 14:38 ` Jarkko Sakkinen
2022-05-13 16:35 ` Luck, Tony
2022-05-14 5:39 ` Zhiquan Li
2022-05-15 3:35 ` Luck, Tony
2022-05-16 0:57 ` Zhiquan Li
2022-05-16 2:29 ` Kai Huang
2022-05-16 8:40 ` Zhiquan Li
2022-05-17 0:43 ` Kai Huang
2022-05-18 1:02 ` Zhiquan Li [this message]
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=443cb425-009c-2784-56f4-5e707122de76@intel.com \
--to=zhiquan1.li@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=fan.du@intel.com \
--cc=jarkko@kernel.org \
--cc=kai.huang@intel.com \
--cc=linux-sgx@vger.kernel.org \
--cc=seanjc@google.com \
--cc=tony.luck@intel.com \
/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