From: Avi Kivity <avi@qumranet.com>
To: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 19/19] KVM: MMU: Fix potential race setting upper shadow ptes on nonpae hosts
Date: Tue, 15 Jul 2008 15:12:38 +0300 [thread overview]
Message-ID: <1216123958-10717-20-git-send-email-avi@qumranet.com> (raw)
In-Reply-To: <1216123958-10717-1-git-send-email-avi@qumranet.com>
The direct mapped shadow code (used for real mode and two dimensional paging)
sets upper-level ptes using direct assignment rather than calling
set_shadow_pte(). A nonpae host will split this into two writes, which opens
up a race if another vcpu accesses the same memory area.
Fix by calling set_shadow_pte() instead of assigning directly.
Noticed by Izik Eidus.
Signed-off-by: Avi Kivity <avi@qumranet.com>
---
arch/x86/kvm/mmu.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 7f57da6..b0e4ddc 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1189,9 +1189,10 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
return -ENOMEM;
}
- table[index] = __pa(new_table->spt)
- | PT_PRESENT_MASK | PT_WRITABLE_MASK
- | shadow_user_mask | shadow_x_mask;
+ set_shadow_pte(&table[index],
+ __pa(new_table->spt)
+ | PT_PRESENT_MASK | PT_WRITABLE_MASK
+ | shadow_user_mask | shadow_x_mask);
}
table_addr = table[index] & PT64_BASE_ADDR_MASK;
}
--
1.5.6.1
prev parent reply other threads:[~2008-07-15 12:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-15 12:12 [PATCH 00/19] KVM Updates for the 2.6.27 (supplemental) Avi Kivity
2008-07-15 12:12 ` [PATCH 01/19] KVM: VMX: Fix a wrong usage of vmcs_config Avi Kivity
2008-07-15 12:12 ` [PATCH 02/19] KVM: VMX: Fake emulate Intel perfctr MSRs Avi Kivity
2008-07-15 12:12 ` [PATCH 03/19] KVM: move slots_lock acquision down to vapic_exit Avi Kivity
2008-07-15 12:12 ` [PATCH 04/19] KVM: s390: dont allocate dirty bitmap Avi Kivity
2008-07-15 12:12 ` [PATCH 05/19] KVM: Fix memory leak on guest exit Avi Kivity
2008-07-15 12:12 ` [PATCH 06/19] KVM: s390: Set guest storage limit and offset to sane values Avi Kivity
2008-07-15 12:12 ` [PATCH 07/19] KVM: s390: rename private structures Avi Kivity
2008-07-15 12:12 ` [PATCH 08/19] KVM: SVM: fix suspend/resume support Avi Kivity
2008-07-15 12:12 ` [PATCH 09/19] x86: KVM guest: make kvm_smp_prepare_boot_cpu() static Avi Kivity
2008-07-15 12:12 ` [PATCH 10/19] KVM: mmu_shrink: kvm_mmu_zap_page requires slots_lock to be held Avi Kivity
2008-07-15 12:12 ` [PATCH 11/19] KVM: VMX: Add ept_sync_context in flush_tlb Avi Kivity
2008-07-15 12:12 ` [PATCH 12/19] KVM: Apply the kernel sigmask to vcpus blocked due to being uninitialized Avi Kivity
2008-07-15 12:12 ` [PATCH 13/19] KVM: x86 emulator: Fix HLT instruction Avi Kivity
2008-07-15 12:12 ` [PATCH 14/19] KVM: check injected pic irq within valid pic irqs Avi Kivity
2008-07-15 12:12 ` [PATCH 15/19] KVM: Prefix some x86 low level function with kvm_, to avoid namespace issues Avi Kivity
2008-07-15 12:12 ` [PATCH 16/19] KVM: MMU: nuke shadowed pgtable pages and ptes on memslot destruction Avi Kivity
2008-07-15 12:12 ` [PATCH 17/19] KVM: MMU: improve invalid shadow root page handling Avi Kivity
2008-07-15 12:12 ` [PATCH 18/19] KVM: x86 emulator: emulate clflush Avi Kivity
2008-07-15 12:12 ` Avi Kivity [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1216123958-10717-20-git-send-email-avi@qumranet.com \
--to=avi@qumranet.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®