On Thu, Mar 30, 2017 at 02:48:22PM +0300, Serge Ayoun wrote:
ENCLS(EINIT) instruction errors (during ENCLAVE_INIT ioctl call) are
now returned without a change instead of being translated to OS
generic errors. Documentation updated.
Signed-off-by: Serge Ayoun <serge.ayoun(a)intel.com>
---
Documentation/x86/intel_sgx.rst | 24 ++++++++++++++++++++++++
drivers/platform/x86/intel_sgx_ioctl.c | 16 ----------------
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/Documentation/x86/intel_sgx.rst b/Documentation/x86/intel_sgx.rst
index fb2f9df..1825c92 100644
--- a/Documentation/x86/intel_sgx.rst
+++ b/Documentation/x86/intel_sgx.rst
@@ -85,6 +85,29 @@ by using the ENCLS(EDBGRD) and ENCLS(EDBGWR) opcodes. The Intel
provided launch
enclave provides them always a valid EINITTOKEN and therefore they are a low
hanging fruit way to try out SGX.
+SGX_IOC_ENCLAVE_INIT Description:
+================================
+
+The SGX_IOC_ENCLAVE_INIT ioctl has a different behavior than the others: its
+return value may reflect the possible error returned by the ENCLS(EINIT)
+instruction:
+
+0x0: success
+0x1: (SGX_INVALID_SIG_STRUCT) the sigstruct has an invalid field
+0x2: (SGX_INVALID_ATTRIBUTE) the token or the sigstruct have an
+ unexpected or wrong attribute, mask or signer
+0x4: (SGX_INVALID_MEASUREMENT) the token or the sigstruct has an invalid
+ measurement
+0x8: (SGX_INVALID_SIGNATURE) signature validation check has failed
+0x10: (SGX_INVALID_LICENSE) The token license validation has failed
+0x20: (SGX_INVALID_CPUSVN) The token cpu svn used is not supported by
+ current cpu
+0x80: (SGX_UNMASKED_EVENT) system too busy to perform EINIT
+0x40000000: (SGX_POWER_LOSS) A sleep transition has occurred and the
+ enclave is not valid anymore
+0x40000001: (SGX_LE_ROLLBACK) The launch enclave isv svn of the the
+ license is not supported
+
The return values should be documented into the documentation comment in
intel_sgx_ioctl.c.
I'll propose the following for this particular fix. I'll take your code
change and take care of updating documentation.
/Jarkko