Skip to contentSkip to conversation

x86/sgx: Update correct attributes variable when allowing provisioning

PATCH In review Sean Christopherson 2 participants 2 messages Oct 1, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/sgx: Update correct attributes variable when allowing provisioning

Set the PROVISIONKEY flag in attributes_mask, a.k.a. the mask of allowed attributes for the enclave, when the enclave's owner demonstrates access to /dev/sgx/provision. Setting the flag in the enclave's attributes effectively declares intent to access the key, whereas the ioctl()'s intent is to grant access to the key.

Fixes 80e062767a37 ("x86/sgx: Add SGX_IOC_ENCLAVE_PROVISION")
---
 arch/x86/kernel/cpu/sgx/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/sgx/ioctl.c +1 -1
index ec38a9416788..16d0c9abafc2 100644
@@ -763,7 +763,7 @@ static long sgx_ioc_enclave_provision(struct sgx_encl *encl, void __user *arg)
 		goto out;
 	}
 
-	encl->attributes |= SGX_ATTR_PROVISIONKEY;
+	encl->attributes_mask |= SGX_ATTR_PROVISIONKEY;
 	ret = 0;
 
 out:
Signature · 1 line
2.28.0
#1 lore raw
Quoted 8 lines · Sean Christopherson

Set the PROVISIONKEY flag in attributes_mask, a.k.a. the mask of allowed attributes for the enclave, when the enclave's owner demonstrates access to /dev/sgx/provision. Setting the flag in the enclave's attributes effectively declares intent to access the key, whereas the ioctl()'s intent is to grant access to the key.

Fixes 80e062767a37 ("x86/sgx: Add SGX_IOC_ENCLAVE_PROVISION")

Thank you!

For this kind of fixes ignore the fixes tag and just put at most a lore link to the response or something. I feel bad that you went all that trouble writing the paragraph :-)

Anyway, thanks again.

Quoted 20 lines
---
 arch/x86/kernel/cpu/sgx/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/sgx/ioctl.c +1 -1
index ec38a9416788..16d0c9abafc2 100644
@@ -763,7 +763,7 @@ static long sgx_ioc_enclave_provision(struct sgx_encl *encl, void __user *arg)
 		goto out;
 	}
 
-	encl->attributes |= SGX_ATTR_PROVISIONKEY;
+	encl->attributes_mask |= SGX_ATTR_PROVISIONKEY;
 	ret = 0;
 
 out:
Signature · 1 line
2.28.0

/Jarkko