Re: [PATCH v39 05/24] x86/sgx: Add wrappers for ENCLS leaf functions

2020-10-19 Thread Dave Hansen
On 10/19/20 10:53 AM, Sean Christopherson wrote: >>> SGX1 CPUs take an erratum on the #PF behavior, e.g. "KBW90 Violation of >>> Intel >>> SGX Access-Control Requirements Produce #GP Instead of #PF". >>> >>>

Re: [PATCH v39 05/24] x86/sgx: Add wrappers for ENCLS leaf functions

2020-10-19 Thread Sean Christopherson
On Mon, Oct 19, 2020 at 10:48:35AM -0700, Dave Hansen wrote: > On 10/19/20 10:38 AM, Sean Christopherson wrote: > >>> +static inline bool encls_failed(int ret) > >>> +{ > >>> + int epcm_trapnr; > >>> + > >>> + if (boot_cpu_has(X86_FEATURE_SGX2)) > >>> + epcm_trapnr = X86_TRAP_PF; > >>> +

Re: [PATCH v39 05/24] x86/sgx: Add wrappers for ENCLS leaf functions

2020-10-19 Thread Dave Hansen
On 10/19/20 10:38 AM, Sean Christopherson wrote: >>> +static inline bool encls_failed(int ret) >>> +{ >>> + int epcm_trapnr; >>> + >>> + if (boot_cpu_has(X86_FEATURE_SGX2)) >>> + epcm_trapnr = X86_TRAP_PF; >>> + else >>> + epcm_trapnr = X86_TRAP_GP; >> So, the SDM makes

Re: [PATCH v39 05/24] x86/sgx: Add wrappers for ENCLS leaf functions

2020-10-19 Thread Sean Christopherson
On Mon, Oct 19, 2020 at 07:30:32AM -0700, Dave Hansen wrote: > On 10/2/20 9:50 PM, Jarkko Sakkinen wrote: > > +/** > > + * encls_failed() - Check if an ENCLS leaf function failed > > + * @ret: the return value of an ENCLS leaf function call > > + * > > + * Check if an ENCLS leaf function failed.

Re: [PATCH v39 05/24] x86/sgx: Add wrappers for ENCLS leaf functions

2020-10-19 Thread Dave Hansen
On 10/2/20 9:50 PM, Jarkko Sakkinen wrote: > +/** > + * encls_failed() - Check if an ENCLS leaf function failed > + * @ret: the return value of an ENCLS leaf function call > + * > + * Check if an ENCLS leaf function failed. This happens when the leaf > function > + * causes a fault that is

[PATCH v39 05/24] x86/sgx: Add wrappers for ENCLS leaf functions

2020-10-02 Thread Jarkko Sakkinen
ENCLS is a ring 0 instruction, which contains a set of leaf functions for managing an enclave. Enclaves are measured and signed software entities, which are protected by asserting the outside memory accesses and memory encryption. Add a two-layer macro system along with an encoding scheme to