Skip to content

Commit 231d3db

Browse files
Sean Christophersonsuryasaimadhu
authored andcommitted
x86/sgx: Add SGX_CHILD_PRESENT hardware error code
SGX driver can accurately track how enclave pages are used. This enables SECS to be specifically targeted and EREMOVE'd only after all child pages have been EREMOVE'd. This ensures that SGX driver will never encounter SGX_CHILD_PRESENT in normal operation. Virtual EPC is different. The host does not track how EPC pages are used by the guest, so it cannot guarantee EREMOVE success. It might, for instance, encounter a SECS with a non-zero child count. Add a definition of SGX_CHILD_PRESENT. It will be used exclusively by the SGX virtualization driver to handle recoverable EREMOVE errors when saniziting EPC pages after they are freed. Signed-off-by: Sean Christopherson <[email protected]> Signed-off-by: Kai Huang <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Dave Hansen <[email protected]> Acked-by: Jarkko Sakkinen <[email protected]> Link: https://lkml.kernel.org/r/050b198e882afde7e6eba8e6a0d4da39161dbb5a.1616136308.git.kai.huang@intel.com
1 parent b0c7459 commit 231d3db

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/x86/kernel/cpu/sgx/arch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@
2626
* enum sgx_return_code - The return code type for ENCLS, ENCLU and ENCLV
2727
* %SGX_NOT_TRACKED: Previous ETRACK's shootdown sequence has not
2828
* been completed yet.
29+
* %SGX_CHILD_PRESENT SECS has child pages present in the EPC.
2930
* %SGX_INVALID_EINITTOKEN: EINITTOKEN is invalid and enclave signer's
3031
* public key does not match IA32_SGXLEPUBKEYHASH.
3132
* %SGX_UNMASKED_EVENT: An unmasked event, e.g. INTR, was received
3233
*/
3334
enum sgx_return_code {
3435
SGX_NOT_TRACKED = 11,
36+
SGX_CHILD_PRESENT = 13,
3537
SGX_INVALID_EINITTOKEN = 16,
3638
SGX_UNMASKED_EVENT = 128,
3739
};

0 commit comments

Comments
 (0)