diff options
| author | Avi Kivity <avi@redhat.com> | 2012-03-05 07:23:29 -0500 |
|---|---|---|
| committer | Luis Henriques <luis.henriques@canonical.com> | 2012-05-01 06:00:11 -0400 |
| commit | 5e6beee5c7e63387f4e2af71b0b2d5418d93f2ed (patch) | |
| tree | 8371723119b0ca3d54f53762891c1d896590f95f /include/linux | |
| parent | e1263827312b2d70158aa58dd7765f501d9b82cd (diff) | |
KVM: Ensure all vcpus are consistent with in-kernel irqchip settings
BugLink: http://bugs.launchpad.net/bugs/971685
CVE-2012-1601
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>
(cherry picked from commit 3e515705a1f46beb1c942bb8043c16f8ac7b1e9e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Herton Krzesinski <herton.krzesinski@canonical.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kvm_host.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 31ebb59cbd2..d70a250701e 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -730,6 +730,13 @@ static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu) | |||
| 730 | { | 730 | { |
| 731 | return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; | 731 | return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id; |
| 732 | } | 732 | } |
| 733 | |||
| 734 | bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu); | ||
| 735 | |||
| 736 | #else | ||
| 737 | |||
| 738 | static inline bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) { return true; } | ||
| 739 | |||
| 733 | #endif | 740 | #endif |
| 734 | 741 | ||
| 735 | #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT | 742 | #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT |
