This is a note to let you know that I've just added the patch titled KVM: x86/mmu: Commit zap of remaining invalid pages when recovering lpages to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kvm-x86-mmu-commit-zap-of-remaining-invalid-pages-when-recovering-lpages.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From e89505698c9f70125651060547da4ff5046124fc Mon Sep 17 00:00:00 2001 From: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> Date: Wed, 23 Sep 2020 11:37:28 -0700 Subject: KVM: x86/mmu: Commit zap of remaining invalid pages when recovering lpages From: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> commit e89505698c9f70125651060547da4ff5046124fc upstream. Call kvm_mmu_commit_zap_page() after exiting the "prepare zap" loop in kvm_recover_nx_lpages() to finish zapping pages in the unlikely event that the loop exited due to lpage_disallowed_mmu_pages being empty. Because the recovery thread drops mmu_lock() when rescheduling, it's possible that lpage_disallowed_mmu_pages could be emptied by a different thread without to_zap reaching zero despite to_zap being derived from the number of disallowed lpages. Fixes: 1aa9b9572b105 ("kvm: x86: mmu: Recovery of shattered NX large pages") Cc: Junaid Shahid <junaids@xxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> Message-Id: <20200923183735.584-2-sean.j.christopherson@xxxxxxxxx> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/x86/kvm/mmu.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -6453,6 +6453,7 @@ static void kvm_recover_nx_lpages(struct cond_resched_lock(&kvm->mmu_lock); } } + kvm_mmu_commit_zap_page(kvm, &invalid_list); spin_unlock(&kvm->mmu_lock); srcu_read_unlock(&kvm->srcu, rcu_idx); Patches currently in stable-queue which might be from sean.j.christopherson@xxxxxxxxx are queue-5.4/kvm-x86-mmu-commit-zap-of-remaining-invalid-pages-when-recovering-lpages.patch queue-5.4/kvm-nvmx-reload-vmcs01-if-getting-vmcs12-s-pages-fails.patch queue-5.4/kvm-nvmx-reset-the-segment-cache-when-stuffing-guest-segs.patch