Re: [PATCH 2/2] KVM: VMX: Inject #GP, not #UD, if SGX2 ENCLS leafs are unsupported

From: Huang, Kai
Date: Fri Apr 21 2023 - 05:17:30 EST


On Wed, 2023-04-12 at 11:15 +0000, Huang, Kai wrote:
> On Thu, 2023-04-06 at 11:00 -0700, Sean Christopherson wrote:
> > On Thu, Apr 06, 2023, Huang, Kai wrote:
> > > On Wed, 2023-04-05 at 16:45 -0700, Sean Christopherson wrote:
> > > > Per Intel's SDM, unsupported ENCLS leafs result in a #GP, not a #UD.
> > > > SGX1 is a special snowflake as the SGX1 flag is used by the CPU as a
> > > > "soft" disable, e.g. if software disables machine check reporting, i.e.
> > > > having SGX but not SGX1 is effectively "SGX completely unsupported" and
> > > > and thus #UDs.
> > >

[...]

>
> Reviewed-by: Kai Huang <kai.huang@xxxxxxxxx>
>
>

Tested by disabling SGX2 in the guest and running SGX2 leaf inside, and in my
testing the #GP is injected to the guest due to leaf not enabled.

Tested-by: Kai Huang <kai.huang@xxxxxxxxx>