Messages in this thread | | | Date | Wed, 3 Apr 2019 16:03:17 -0700 | From | Sean Christopherson <> | Subject | Re: [PATCH v19,RESEND 24/27] x86/vdso: Add __vdso_sgx_enter_enclave() to wrap SGX enclave transitions |
| |
On Thu, Mar 28, 2019 at 12:18:40PM -0700, Andy Lutomirski wrote: > Finally, why does the vDSO code bother checking whether the leaf is valid?
To sanity check the input to ensure the caller is attempting to enter an enclave, i.e. the function is named __vdso_sgx_enter_enclave(), not __vsgx_enclu(). And if the caller does pass the wrong leaf, EINVAL will be easier to debug than EFAULT, especially on SGX1 hardware where the #GP could be misconstrued as a loss of EPC.
I'm not dead set on the checks by any means, but it does seem appropriate. And the cost is all of 3 uops and a few bytes of a code.
| |