On Tue, Apr 22, 2025, Kai Huang wrote:
> On Fri, 2025-04-18 at 07:55 -0700, Sean Christopherson wrote:
> > On Tue, Apr 15, 2025, Elena Reshetova wrote:
> > That said, handling this deep in the bowels of EPC page allocation seems
> > unnecessary.  The only way for there to be no active EPC pages is if there 
> > are
> > no enclaves.  As above, virtual EPC usage is already all but guaranteed to 
> > hit
> > false positives, so I don't think there's anything gained by trying to 
> > update
> > the SVN based on EPC allocations.
> > 
> > So rather than react to EPC allocations, why not hook sgx_open() and 
> > sgx_vepc_open()?
> 
> The only thing I don't like about this is we need to hook both of them.

And having to maintain a separate counter.

> > It's the hypervisor's responsibility to enumerate SGX_CPUID_EUPDATESVN or 
> > not.
> > E.g. if the kernel is running in a "passthrough" type setup, it would be 
> > perfectly
> > fine to do EUPDATESVN from a guest kernel.  EUPDATESVN could even be 
> > proxied,
> > e.g. by intercepting ECREATE to track EPC usage
> 
> I am open to this HYPERVISOR check, because I don't think we currently support
> any kind of "passthrough" setup?

Who is "we"?  KVM?  From the SGX driver's perspective, it doesn't know on which
hypervisor it's running, or the intent of that hypervisor.  I.e. whether or not
KVM or any other hypervisor supports something is irrelevant.

> And depending on what kinda of "passthrough" types, the things that the
> hypervisor traps can vary.
> 
> Anyway, I agree it's not necessary to have this check, because currently it is
> not possible for a guest to see the EUPDATESVN in CPUID.

Why is that?

Reply via email to