提交 480bd021 编写于 作者: B Ben Gardon 提交者: Zheng Zengkai

KVM: x86/mmu: Fix TDP MMU zap collapsible SPTEs

stable inclusion
from stable-5.10.15
commit dd7f10523b19c809b908be8b11da35c8e13e15f2
bugzilla: 48167

--------------------------------

commit 87aa9ec9 upstream.

There is a bug in the TDP MMU function to zap SPTEs which could be
replaced with a larger mapping which prevents the function from doing
anything. Fix this by correctly zapping the last level SPTEs.

Cc: stable@vger.kernel.org
Fixes: 14881998 ("kvm: x86/mmu: Support disabling dirty logging for the tdp MMU")
Signed-off-by: NBen Gardon <bgardon@google.com>
Message-Id: <20210202185734.1680553-11-bgardon@google.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 f748b88f
...@@ -1037,8 +1037,8 @@ bool kvm_tdp_mmu_slot_set_dirty(struct kvm *kvm, struct kvm_memory_slot *slot) ...@@ -1037,8 +1037,8 @@ bool kvm_tdp_mmu_slot_set_dirty(struct kvm *kvm, struct kvm_memory_slot *slot)
} }
/* /*
* Clear non-leaf entries (and free associated page tables) which could * Clear leaf entries which could be replaced by large mappings, for
* be replaced by large mappings, for GFNs within the slot. * GFNs within the slot.
*/ */
static void zap_collapsible_spte_range(struct kvm *kvm, static void zap_collapsible_spte_range(struct kvm *kvm,
struct kvm_mmu_page *root, struct kvm_mmu_page *root,
...@@ -1050,7 +1050,7 @@ static void zap_collapsible_spte_range(struct kvm *kvm, ...@@ -1050,7 +1050,7 @@ static void zap_collapsible_spte_range(struct kvm *kvm,
tdp_root_for_each_pte(iter, root, start, end) { tdp_root_for_each_pte(iter, root, start, end) {
if (!is_shadow_present_pte(iter.old_spte) || if (!is_shadow_present_pte(iter.old_spte) ||
is_last_spte(iter.old_spte, iter.level)) !is_last_spte(iter.old_spte, iter.level))
continue; continue;
pfn = spte_to_pfn(iter.old_spte); pfn = spte_to_pfn(iter.old_spte);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册