KVM: SVM: Account scratch allocations used to decrypt SEV guest memory
authorAnish Ghulati <aghulati@google.com>
Fri, 13 Jan 2023 22:09:23 +0000 (22:09 +0000)
committerSean Christopherson <seanjc@google.com>
Tue, 24 Jan 2023 18:06:48 +0000 (10:06 -0800)
Account the temp/scratch allocation used to decrypt unaligned debug
accesses to SEV guest memory, the allocation is very much tied to the
target VM.

Reported-by: Mingwei Zhang <mizhang@google.com>
Signed-off-by: Anish Ghulati <aghulati@google.com>
Link: https://lore.kernel.org/r/20230113220923.2834699-1-aghulati@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/sev.c

index 273cba809328d9f454da23c14970fd7498892b95..a5e4c5ef7c9ec79ddf70c12d1e6ae1f2c86563f9 100644 (file)
@@ -813,7 +813,7 @@ static int __sev_dbg_decrypt_user(struct kvm *kvm, unsigned long paddr,
        if (!IS_ALIGNED(dst_paddr, 16) ||
            !IS_ALIGNED(paddr,     16) ||
            !IS_ALIGNED(size,      16)) {
-               tpage = (void *)alloc_page(GFP_KERNEL | __GFP_ZERO);
+               tpage = (void *)alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
                if (!tpage)
                        return -ENOMEM;