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.