@@ -338,7 +338,7 @@ static int __sgx_encl_add_page(struct sgx_encl *encl,
kunmap_atomic((void *)pginfo.contents);
put_page(src_page);
- return ret ? -EFAULT : 0;
+ return ret ? -EIO : 0;
}
static int __sgx_encl_extend(struct sgx_encl *encl,
@@ -353,7 +353,7 @@ static int __sgx_encl_extend(struct sgx_encl *encl,
if (ret) {
if (encls_failed(ret))
ENCLS_WARN(ret, "EEXTEND");
- return -EFAULT;
+ return -EIO;
}
}
@@ -496,10 +496,9 @@ static int sgx_encl_add_page(struct sgx_encl *encl,
*
* Return:
* 0 on success,
- * -EINVAL if any input param or the SECINFO contains invalid data,
* -EACCES if an executable source page is located in a noexec partition,
- * -ENOMEM if any memory allocation, including EPC, fails,
- * -ERESTARTSYS if a pending signal is recognized
+ * -EIO if either ENCLS[EADD] or ENCLS[EEXTEND] fails
+ * -errno otherwise
*/
static long sgx_ioc_enclave_add_pages(struct sgx_encl *encl, void __user *arg)
{
Use a common error code for all ENCLS failures so they can be easily recognized from user space code. Cc: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> --- arch/x86/kernel/cpu/sgx/ioctl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)