Skip to contentSkip to conversation

KVM: VMX: Do not account for temporary memory allocation in ECREATE emulation

PATCH Applied Kai Huang 2 participants 2 messages Jul 15, 2024 – Aug 23, 2024

Subsystems (3)
lore
Share & tools
lore

Kai Huang

author
#0 lore raw

PATCH 1/1 KVM: VMX: Do not account for temporary memory allocation in ECREATE emulation

In handle_encls_ecreate(), a page is allocated to store a copy of SECS structure used by the ENCLS[ECREATE] leaf from the guest. This page is only used temporarily and is freed after use in handle_encls_ecreate().

Don't account for the memory allocation of this page per [1].

---
 arch/x86/kvm/vmx/sgx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx/sgx.c +1 -1
index 6fef01e0536e..a3c3d2a51f47 100644
@@ -274,7 +274,7 @@ static int handle_encls_ecreate(struct kvm_vcpu *vcpu)
 	 * simultaneously set SGX_ATTR_PROVISIONKEY to bypass the check to
 	 * enforce restriction of access to the PROVISIONKEY.
 	 */
-	contents = (struct sgx_secs *)__get_free_page(GFP_KERNEL_ACCOUNT);
+	contents = (struct sgx_secs *)__get_free_page(GFP_KERNEL);
 	if (!contents)
 		return -ENOMEM;
 

base-commit: c8b8b8190a80b591aa73c27c70a668799f8db547

Signature · 1 line
2.45.2
maintainer Applied
#1 lore raw
Quoted 8 lines · Kai Huang

In handle_encls_ecreate(), a page is allocated to store a copy of SECS structure used by the ENCLS[ECREATE] leaf from the guest. This page is only used temporarily and is freed after use in handle_encls_ecreate().

Don't account for the memory allocation of this page per [1].

[...]

Applied to kvm-x86 vmx, thanks!

[1/1] KVM: VMX: Do not account for temporary memory allocation in ECREATE emulation

      https://github.com/kvm-x86/linux/commit/d9aa56edad35

--
https://github.com/kvm-x86/linux/tree/next