stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS" has been added to the 4.4-stable tree
@ 2017-01-09  9:33 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2017-01-09  9:33 UTC (permalink / raw)
  To: guangrong.xiao, gregkh, pbonzini; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS

to the 4.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-reset-mmu-on-kvm_set_vcpu_events.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 6ef4e07ecd2db21025c446327ecf34414366498b Mon Sep 17 00:00:00 2001
From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Date: Sat, 24 Dec 2016 10:00:42 +0100
Subject: KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS

From: Xiao Guangrong <guangrong.xiao@linux.intel.com>

commit 6ef4e07ecd2db21025c446327ecf34414366498b upstream.

Otherwise, mismatch between the smm bit in hflags and the MMU role
can cause a NULL pointer dereference.

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kvm/x86.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2949,6 +2949,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_
 	memset(&events->reserved, 0, sizeof(events->reserved));
 }
 
+static void kvm_set_hflags(struct kvm_vcpu *vcpu, unsigned emul_flags);
+
 static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
 					      struct kvm_vcpu_events *events)
 {
@@ -2981,10 +2983,13 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_e
 		vcpu->arch.apic->sipi_vector = events->sipi_vector;
 
 	if (events->flags & KVM_VCPUEVENT_VALID_SMM) {
+		u32 hflags = vcpu->arch.hflags;
 		if (events->smi.smm)
-			vcpu->arch.hflags |= HF_SMM_MASK;
+			hflags |= HF_SMM_MASK;
 		else
-			vcpu->arch.hflags &= ~HF_SMM_MASK;
+			hflags &= ~HF_SMM_MASK;
+		kvm_set_hflags(vcpu, hflags);
+
 		vcpu->arch.smi_pending = events->smi.pending;
 		if (events->smi.smm_inside_nmi)
 			vcpu->arch.hflags |= HF_SMM_INSIDE_NMI_MASK;


Patches currently in stable-queue which might be from guangrong.xiao@linux.intel.com are

queue-4.4/kvm-x86-reset-mmu-on-kvm_set_vcpu_events.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-09  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-09  9:33 Patch "KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS" has been added to the 4.4-stable tree gregkh

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).