public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Dave Hansen <dave.hansen@intel.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: x86@kernel.org, linux-sgx@vger.kernel.org, jarkko@kernel.org,
	dave.hansen@linux.intel.com, yang.zhong@intel.com
Subject: Re: [PATCH 1/2] x86: sgx_vepc: extract sgx_vepc_remove_page
Date: Mon, 13 Sep 2021 20:35:53 +0200	[thread overview]
Message-ID: <2b595588-eb98-6d30-dc50-794fc396bf7e@redhat.com> (raw)
In-Reply-To: <480cf917-7301-4227-e1c4-728b52537f46@intel.com>

On 13/09/21 17:29, Dave Hansen wrote:
> On 9/13/21 8:14 AM, Paolo Bonzini wrote:
>> On 13/09/21 16:55, Dave Hansen wrote:
>>>> By "Windows startup" I mean even after guest reboot.  Because another
>>>> process could sneak in and steal your EPC pages between a close() and an
>>>> open(), I'd like to have a way to EREMOVE the pages while keeping them
>>>> assigned to the specific vEPC instance, i.e.*without*  going through
>>>> sgx_vepc_free_page().
>>> Oh, so you want fresh EPC state for the guest, but you're concerned that
>>> the previous guest might have left them in a bad state.  The current
>>> method of getting a new vepc instance (which guarantees fresh state) has
>>> some other downsides.
>>>
>>> Can't another process steal pages via sgxd and reclaim at any time?
>>
>> vEPC pages never call sgx_mark_page_reclaimable, don't they?
> 
> Oh, I was just looking that they were on the SGX LRU.  You might be right.
> But, we certainly don't want the fact that they are unreclaimable today
> to be part of the ABI.  It's more of a bug than a feature.

Sure, that's fine.

>>> What's the extra concern here about going through a close()/open()
>>> cycle?  Performance?
>>
>> Apart from reclaiming, /dev/sgx_vepc might disappear between the first
>> open() and subsequent ones.
> 
> Aside from it being rm'd, I don't think that's possible.
> 

Being rm'd would be a possibility in principle, and it would be ugly for 
it to cause issues on running VMs.  Also I'd like for it to be able to 
pass /dev/sgx_vepc in via a file descriptor, and run QEMU in a chroot or 
a mount namespace.  Alternatively, with seccomp it may be possible to 
sandbox a running QEMU process in such a way that open() is forbidden at 
runtime (all hotplug is done via file descriptor passing); it is not yet 
possible, but it is a goal.

Paolo


  reply	other threads:[~2021-09-13 18:36 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 13:11 [RFC/RFT PATCH 0/2] x86: sgx_vepc: implement ioctl to EREMOVE all pages Paolo Bonzini
2021-09-13 13:11 ` [PATCH 1/2] x86: sgx_vepc: extract sgx_vepc_remove_page Paolo Bonzini
2021-09-13 14:05   ` Dave Hansen
2021-09-13 14:24     ` Paolo Bonzini
2021-09-13 14:55       ` Dave Hansen
2021-09-13 15:14         ` Paolo Bonzini
2021-09-13 15:29           ` Dave Hansen
2021-09-13 18:35             ` Paolo Bonzini [this message]
2021-09-13 19:25               ` Dave Hansen
2021-09-13 21:16                 ` Jarkko Sakkinen
2021-09-13 21:15               ` Jarkko Sakkinen
2021-09-13 21:13           ` Jarkko Sakkinen
2021-09-14  5:36             ` Paolo Bonzini
2021-09-14 16:05               ` Jarkko Sakkinen
2021-09-13 21:12         ` Jarkko Sakkinen
2021-09-13 21:00       ` Jarkko Sakkinen
2021-09-13 20:33   ` Jarkko Sakkinen
2021-09-13 13:11 ` [PATCH 2/2] x86: sgx_vepc: implement SGX_IOC_VEPC_REMOVE ioctl Paolo Bonzini
2021-09-13 19:33   ` Dave Hansen
2021-09-13 21:11     ` Sean Christopherson
2021-09-13 22:43       ` Dave Hansen
2021-09-14 10:55   ` Kai Huang
2021-09-14  7:10 ` [RFC/RFT PATCH 0/2] x86: sgx_vepc: implement ioctl to EREMOVE all pages Yang Zhong
2021-09-14 10:19   ` Paolo Bonzini
2021-09-14 16:42     ` Jarkko Sakkinen
2021-09-14 17:07       ` Paolo Bonzini
2021-09-14 17:40         ` Jarkko Sakkinen
2021-09-14 17:44           ` Jarkko Sakkinen
2021-09-15  8:28     ` Yang Zhong
  -- strict thread matches above, loose matches on Subject: below --
2021-09-20 12:53 [PATCH " Paolo Bonzini
2021-09-20 12:54 ` [PATCH 1/2] x86: sgx_vepc: extract sgx_vepc_remove_page Paolo Bonzini
2021-09-21 19:44   ` Jarkko Sakkinen
2021-09-21 19:46     ` Jarkko Sakkinen
2021-09-23 12:08     ` Paolo Bonzini
2021-09-23 20:33       ` Jarkko Sakkinen

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=2b595588-eb98-6d30-dc50-794fc396bf7e@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jarkko@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=yang.zhong@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