* [PATCH 0/7] KVM fixes for 3.2.17
@ 2012-05-18 20:58 Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 1/7] KVM: mmu_notifier: Flush TLBs before releasing mmu_lock Marcelo Tosatti
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2012-05-18 20:58 UTC (permalink / raw)
To: stable; +Cc: kvm, avi, Marcelo Tosatti
See individual patches for details.
Alex Williamson (1):
KVM: lock slots_lock around device assignment
Avi Kivity (1):
KVM: Ensure all vcpus are consistent with in-kernel irqchip settings
Christian Borntraeger (1):
KVM: s390: Sanitize fpc registers for KVM_SET_FPU
Jens Freimann (1):
KVM: s390: do store status after handling STOP_ON_STOP bit
Marcelo Tosatti (1):
KVM: VMX: vmx_set_cr0 expects kvm->srcu locked
Nadav Har'El (1):
KVM: nVMX: Fix erroneous exception bitmap check
Takuya Yoshikawa (1):
KVM: mmu_notifier: Flush TLBs before releasing mmu_lock
arch/ia64/kvm/kvm-ia64.c | 5 +++++
arch/s390/kvm/intercept.c | 20 ++++++++++++--------
arch/s390/kvm/kvm-s390.c | 2 +-
arch/x86/kvm/vmx.c | 4 +++-
arch/x86/kvm/x86.c | 8 ++++++++
include/linux/kvm_host.h | 7 +++++++
virt/kvm/iommu.c | 23 +++++++++++++++--------
virt/kvm/kvm_main.c | 23 ++++++++++++++---------
8 files changed, 65 insertions(+), 27 deletions(-)
--
1.7.6.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/7] KVM: mmu_notifier: Flush TLBs before releasing mmu_lock
2012-05-18 20:58 [PATCH 0/7] KVM fixes for 3.2.17 Marcelo Tosatti
@ 2012-05-18 20:58 ` Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 2/7] KVM: Ensure all vcpus are consistent with in-kernel irqchip settings Marcelo Tosatti
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2012-05-18 20:58 UTC (permalink / raw)
To: stable; +Cc: kvm, avi, Takuya Yoshikawa, Marcelo Tosatti
From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
(cherry picked from commit 565f3be2174611f364405bbea2d86e153c2e7e78
Other threads may process the same page in that small window and skip
TLB flush and then return before these functions do flush.
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
virt/kvm/kvm_main.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e401c1b..9ffac2e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -289,15 +289,15 @@ static void kvm_mmu_notifier_invalidate_page(struct mmu_notifier *mn,
*/
idx = srcu_read_lock(&kvm->srcu);
spin_lock(&kvm->mmu_lock);
+
kvm->mmu_notifier_seq++;
need_tlb_flush = kvm_unmap_hva(kvm, address) | kvm->tlbs_dirty;
- spin_unlock(&kvm->mmu_lock);
- srcu_read_unlock(&kvm->srcu, idx);
-
/* we've to flush the tlb before the pages can be freed */
if (need_tlb_flush)
kvm_flush_remote_tlbs(kvm);
+ spin_unlock(&kvm->mmu_lock);
+ srcu_read_unlock(&kvm->srcu, idx);
}
static void kvm_mmu_notifier_change_pte(struct mmu_notifier *mn,
@@ -335,12 +335,12 @@ static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
for (; start < end; start += PAGE_SIZE)
need_tlb_flush |= kvm_unmap_hva(kvm, start);
need_tlb_flush |= kvm->tlbs_dirty;
- spin_unlock(&kvm->mmu_lock);
- srcu_read_unlock(&kvm->srcu, idx);
-
/* we've to flush the tlb before the pages can be freed */
if (need_tlb_flush)
kvm_flush_remote_tlbs(kvm);
+
+ spin_unlock(&kvm->mmu_lock);
+ srcu_read_unlock(&kvm->srcu, idx);
}
static void kvm_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
@@ -378,13 +378,14 @@ static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn,
idx = srcu_read_lock(&kvm->srcu);
spin_lock(&kvm->mmu_lock);
- young = kvm_age_hva(kvm, address);
- spin_unlock(&kvm->mmu_lock);
- srcu_read_unlock(&kvm->srcu, idx);
+ young = kvm_age_hva(kvm, address);
if (young)
kvm_flush_remote_tlbs(kvm);
+ spin_unlock(&kvm->mmu_lock);
+ srcu_read_unlock(&kvm->srcu, idx);
+
return young;
}
--
1.7.6.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/7] KVM: Ensure all vcpus are consistent with in-kernel irqchip settings
2012-05-18 20:58 [PATCH 0/7] KVM fixes for 3.2.17 Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 1/7] KVM: mmu_notifier: Flush TLBs before releasing mmu_lock Marcelo Tosatti
@ 2012-05-18 20:58 ` Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 3/7] KVM: lock slots_lock around device assignment Marcelo Tosatti
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2012-05-18 20:58 UTC (permalink / raw)
To: stable; +Cc: kvm, avi, Michael Ellerman, Greg Kroah-Hartman
From: Avi Kivity <avi@redhat.com>
(cherry picked from commit 3e515705a1f46beb1c942bb8043c16f8ac7b1e9e)
If some vcpus are created before KVM_CREATE_IRQCHIP, then
irqchip_in_kernel() and vcpu->arch.apic will be inconsistent, leading
to potential NULL pointer dereferences.
Fix by:
- ensuring that no vcpus are installed when KVM_CREATE_IRQCHIP is called
- ensuring that a vcpu has an apic if it is installed after KVM_CREATE_IRQCHIP
This is somewhat long winded because vcpu->arch.apic is created without
kvm->lock held.
Based on earlier patch by Michael Ellerman.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/ia64/kvm/kvm-ia64.c | 5 +++++
arch/x86/kvm/x86.c | 8 ++++++++
include/linux/kvm_host.h | 7 +++++++
virt/kvm/kvm_main.c | 4 ++++
4 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 43f4c92..7073185 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1169,6 +1169,11 @@ out:
#define PALE_RESET_ENTRY 0x80000000ffffffb0UL
+bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu)
+{
+ return irqchip_in_kernel(vcpu->kcm) == (vcpu->arch.apic != NULL);
+}
+
int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
{
struct kvm_vcpu *v;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index e04cae1..4fc5323 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3579,6 +3579,9 @@ long kvm_arch_vm_ioctl(struct file *filp,
r = -EEXIST;
if (kvm->arch.vpic)
goto create_irqchip_unlock;
+ r = -EINVAL;
+ if (atomic_read(&kvm->online_vcpus))
+ goto create_irqchip_unlock;
r = -ENOMEM;
vpic = kvm_create_pic(kvm);
if (vpic) {
@@ -6486,6 +6489,11 @@ void kvm_arch_check_processor_compat(void *rtn)
kvm_x86_ops->check_processor_compatibility(rtn);
}
+bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu)
+{
+ return irqchip_in_kernel(vcpu->kvm) == (vcpu->arch.apic != NULL);
+}
+
int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
{
struct page *page;
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 35410ef..6136821 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -744,6 +744,13 @@ static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
{
return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
}
+
+bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu);
+
+#else
+
+static inline bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) { return true; }
+
#endif
#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 9ffac2e..ec747dc 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1667,6 +1667,10 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id)
goto vcpu_destroy;
mutex_lock(&kvm->lock);
+ if (!kvm_vcpu_compatible(vcpu)) {
+ r = -EINVAL;
+ goto unlock_vcpu_destroy;
+ }
if (atomic_read(&kvm->online_vcpus) == KVM_MAX_VCPUS) {
r = -EINVAL;
goto unlock_vcpu_destroy;
--
1.7.6.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/7] KVM: lock slots_lock around device assignment
2012-05-18 20:58 [PATCH 0/7] KVM fixes for 3.2.17 Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 1/7] KVM: mmu_notifier: Flush TLBs before releasing mmu_lock Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 2/7] KVM: Ensure all vcpus are consistent with in-kernel irqchip settings Marcelo Tosatti
@ 2012-05-18 20:58 ` Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 4/7] KVM: nVMX: Fix erroneous exception bitmap check Marcelo Tosatti
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2012-05-18 20:58 UTC (permalink / raw)
To: stable; +Cc: kvm, avi, Alex Williamson, Marcelo Tosatti, Greg Kroah-Hartman
From: Alex Williamson <alex.williamson@redhat.com>
(cherry picked from commit 21a1416a1c945c5aeaeaf791b63c64926018eb77)
As pointed out by Jason Baron, when assigning a device to a guest
we first set the iommu domain pointer, which enables mapping
and unmapping of memory slots to the iommu. This leaves a window
where this path is enabled, but we haven't synchronized the iommu
mappings to the existing memory slots. Thus a slot being removed
at that point could send us down unexpected code paths removing
non-existent pinnings and iommu mappings. Take the slots_lock
around creating the iommu domain and initial mappings as well as
around iommu teardown to avoid this race.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
virt/kvm/iommu.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index fd817a2..533db33 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -239,9 +239,13 @@ int kvm_iommu_map_guest(struct kvm *kvm)
return -ENODEV;
}
+ mutex_lock(&kvm->slots_lock);
+
kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type);
- if (!kvm->arch.iommu_domain)
- return -ENOMEM;
+ if (!kvm->arch.iommu_domain) {
+ r = -ENOMEM;
+ goto out_unlock;
+ }
if (!allow_unsafe_assigned_interrupts &&
!iommu_domain_has_cap(kvm->arch.iommu_domain,
@@ -252,17 +256,16 @@ int kvm_iommu_map_guest(struct kvm *kvm)
" module option.\n", __func__);
iommu_domain_free(kvm->arch.iommu_domain);
kvm->arch.iommu_domain = NULL;
- return -EPERM;
+ r = -EPERM;
+ goto out_unlock;
}
r = kvm_iommu_map_memslots(kvm);
if (r)
- goto out_unmap;
-
- return 0;
+ kvm_iommu_unmap_memslots(kvm);
-out_unmap:
- kvm_iommu_unmap_memslots(kvm);
+out_unlock:
+ mutex_unlock(&kvm->slots_lock);
return r;
}
@@ -338,7 +341,11 @@ int kvm_iommu_unmap_guest(struct kvm *kvm)
if (!domain)
return 0;
+ mutex_lock(&kvm->slots_lock);
kvm_iommu_unmap_memslots(kvm);
+ kvm->arch.iommu_domain = NULL;
+ mutex_unlock(&kvm->slots_lock);
+
iommu_domain_free(domain);
return 0;
}
--
1.7.6.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/7] KVM: nVMX: Fix erroneous exception bitmap check
2012-05-18 20:58 [PATCH 0/7] KVM fixes for 3.2.17 Marcelo Tosatti
` (2 preceding siblings ...)
2012-05-18 20:58 ` [PATCH 3/7] KVM: lock slots_lock around device assignment Marcelo Tosatti
@ 2012-05-18 20:58 ` Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 5/7] KVM: VMX: vmx_set_cr0 expects kvm->srcu locked Marcelo Tosatti
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2012-05-18 20:58 UTC (permalink / raw)
To: stable; +Cc: kvm, avi, Nadav Har'El, Nadav Har'El, Greg Kroah-Hartman
From: Nadav Har'El <nyh@math.technion.ac.il>
(cherry picked from commit 9587190107d0c0cbaccbf7bf6b0245d29095a9ae)
The code which checks whether to inject a pagefault to L1 or L2 (in
nested VMX) was wrong, incorrect in how it checked the PF_VECTOR bit.
Thanks to Dan Carpenter for spotting this.
Signed-off-by: Nadav Har'El <nyh@il.ibm.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kvm/vmx.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 4ea7678..7ac5993 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1677,7 +1677,7 @@ static int nested_pf_handled(struct kvm_vcpu *vcpu)
struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
/* TODO: also check PFEC_MATCH/MASK, not just EB.PF. */
- if (!(vmcs12->exception_bitmap & PF_VECTOR))
+ if (!(vmcs12->exception_bitmap & (1u << PF_VECTOR)))
return 0;
nested_vmx_vmexit(vcpu);
--
1.7.6.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/7] KVM: VMX: vmx_set_cr0 expects kvm->srcu locked
2012-05-18 20:58 [PATCH 0/7] KVM fixes for 3.2.17 Marcelo Tosatti
` (3 preceding siblings ...)
2012-05-18 20:58 ` [PATCH 4/7] KVM: nVMX: Fix erroneous exception bitmap check Marcelo Tosatti
@ 2012-05-18 20:58 ` Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 6/7] KVM: s390: do store status after handling STOP_ON_STOP bit Marcelo Tosatti
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2012-05-18 20:58 UTC (permalink / raw)
To: stable; +Cc: kvm, avi, Marcelo Tosatti, Greg Kroah-Hartman
(cherry picked from commit 7a4f5ad051e02139a9f1c0f7f4b1acb88915852b)
vmx_set_cr0 is called from vcpu run context, therefore it expects
kvm->srcu to be held (for setting up the real-mode TSS).
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kvm/vmx.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 7ac5993..7315488 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3915,7 +3915,9 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
vmx->vcpu.arch.cr0 = X86_CR0_NW | X86_CR0_CD | X86_CR0_ET;
+ vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
vmx_set_cr0(&vmx->vcpu, kvm_read_cr0(vcpu)); /* enter rmode */
+ srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
vmx_set_cr4(&vmx->vcpu, 0);
vmx_set_efer(&vmx->vcpu, 0);
vmx_fpu_activate(&vmx->vcpu);
--
1.7.6.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/7] KVM: s390: do store status after handling STOP_ON_STOP bit
2012-05-18 20:58 [PATCH 0/7] KVM fixes for 3.2.17 Marcelo Tosatti
` (4 preceding siblings ...)
2012-05-18 20:58 ` [PATCH 5/7] KVM: VMX: vmx_set_cr0 expects kvm->srcu locked Marcelo Tosatti
@ 2012-05-18 20:58 ` Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 7/7] KVM: s390: Sanitize fpc registers for KVM_SET_FPU Marcelo Tosatti
2012-05-22 2:12 ` [PATCH 0/7] KVM fixes for 3.2.17 Ben Hutchings
7 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2012-05-18 20:58 UTC (permalink / raw)
To: stable
Cc: kvm, avi, Jens Freimann, Christian Borntraeger, Marcelo Tosatti,
Greg Kroah-Hartman
From: Jens Freimann <jfrei@linux.vnet.ibm.com>
(cherry picked from commit 9e0d5473e2f0ba2d2fe9dab9408edef3060b710e)
In handle_stop() handle the stop bit before doing the store status as
described for "Stop and Store Status" in the Principles of Operation.
We have to give up the local_int.lock before calling kvm store status
since it calls gmap_fault() which might sleep. Since local_int.lock
only protects local_int.* and not guest memory we can give up the lock.
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/s390/kvm/intercept.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 0243454..a5f6eff 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -133,13 +133,6 @@ static int handle_stop(struct kvm_vcpu *vcpu)
vcpu->stat.exit_stop_request++;
spin_lock_bh(&vcpu->arch.local_int.lock);
- if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) {
- vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP;
- rc = kvm_s390_vcpu_store_status(vcpu,
- KVM_S390_STORE_STATUS_NOADDR);
- if (rc >= 0)
- rc = -EOPNOTSUPP;
- }
if (vcpu->arch.local_int.action_bits & ACTION_RELOADVCPU_ON_STOP) {
vcpu->arch.local_int.action_bits &= ~ACTION_RELOADVCPU_ON_STOP;
@@ -155,7 +148,18 @@ static int handle_stop(struct kvm_vcpu *vcpu)
rc = -EOPNOTSUPP;
}
- spin_unlock_bh(&vcpu->arch.local_int.lock);
+ if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) {
+ vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP;
+ /* store status must be called unlocked. Since local_int.lock
+ * only protects local_int.* and not guest memory we can give
+ * up the lock here */
+ spin_unlock_bh(&vcpu->arch.local_int.lock);
+ rc = kvm_s390_vcpu_store_status(vcpu,
+ KVM_S390_STORE_STATUS_NOADDR);
+ if (rc >= 0)
+ rc = -EOPNOTSUPP;
+ } else
+ spin_unlock_bh(&vcpu->arch.local_int.lock);
return rc;
}
--
1.7.6.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/7] KVM: s390: Sanitize fpc registers for KVM_SET_FPU
2012-05-18 20:58 [PATCH 0/7] KVM fixes for 3.2.17 Marcelo Tosatti
` (5 preceding siblings ...)
2012-05-18 20:58 ` [PATCH 6/7] KVM: s390: do store status after handling STOP_ON_STOP bit Marcelo Tosatti
@ 2012-05-18 20:58 ` Marcelo Tosatti
2012-05-22 2:12 ` [PATCH 0/7] KVM fixes for 3.2.17 Ben Hutchings
7 siblings, 0 replies; 9+ messages in thread
From: Marcelo Tosatti @ 2012-05-18 20:58 UTC (permalink / raw)
To: stable; +Cc: kvm, avi, Christian Borntraeger, Marcelo Tosatti,
Greg Kroah-Hartman
From: Christian Borntraeger <borntraeger@de.ibm.com>
(cherry picked from commit 851755871c1f3184f4124c466e85881f17fa3226)
commit 7eef87dc99e419b1cc051e4417c37e4744d7b661 (KVM: s390: fix
register setting) added a load of the floating point control register
to the KVM_SET_FPU path. Lets make sure that the fpc is valid.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/s390/kvm/kvm-s390.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index d1c44573..d3cb86c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -418,7 +418,7 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
{
memcpy(&vcpu->arch.guest_fpregs.fprs, &fpu->fprs, sizeof(fpu->fprs));
- vcpu->arch.guest_fpregs.fpc = fpu->fpc;
+ vcpu->arch.guest_fpregs.fpc = fpu->fpc & FPC_VALID_MASK;
restore_fp_regs(&vcpu->arch.guest_fpregs);
return 0;
}
--
1.7.6.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/7] KVM fixes for 3.2.17
2012-05-18 20:58 [PATCH 0/7] KVM fixes for 3.2.17 Marcelo Tosatti
` (6 preceding siblings ...)
2012-05-18 20:58 ` [PATCH 7/7] KVM: s390: Sanitize fpc registers for KVM_SET_FPU Marcelo Tosatti
@ 2012-05-22 2:12 ` Ben Hutchings
7 siblings, 0 replies; 9+ messages in thread
From: Ben Hutchings @ 2012-05-22 2:12 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: stable, kvm, avi
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
On Fri, 2012-05-18 at 17:58 -0300, Marcelo Tosatti wrote:
> See individual patches for details.
[...]
These came a little too late for 3.2.18, but I've queued them up now.
Ben.
--
Ben Hutchings
You can't have everything. Where would you put it?
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-05-22 2:12 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-18 20:58 [PATCH 0/7] KVM fixes for 3.2.17 Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 1/7] KVM: mmu_notifier: Flush TLBs before releasing mmu_lock Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 2/7] KVM: Ensure all vcpus are consistent with in-kernel irqchip settings Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 3/7] KVM: lock slots_lock around device assignment Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 4/7] KVM: nVMX: Fix erroneous exception bitmap check Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 5/7] KVM: VMX: vmx_set_cr0 expects kvm->srcu locked Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 6/7] KVM: s390: do store status after handling STOP_ON_STOP bit Marcelo Tosatti
2012-05-18 20:58 ` [PATCH 7/7] KVM: s390: Sanitize fpc registers for KVM_SET_FPU Marcelo Tosatti
2012-05-22 2:12 ` [PATCH 0/7] KVM fixes for 3.2.17 Ben Hutchings
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).