Patch "KVM: x86: Decoding guest instructions which cross page boundary may fail" has been added to the 3.17-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

    KVM: x86: Decoding guest instructions which cross page boundary may fail

to the 3.17-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-decoding-guest-instructions-which-cross-page-boundary-may-fail.patch
and it can be found in the queue-3.17 subdirectory.

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


>From 08da44aedba0f493e10695fa334348a7a4f72eb3 Mon Sep 17 00:00:00 2001
From: Nadav Amit <namit@xxxxxxxxxxxxxxxxx>
Date: Fri, 3 Oct 2014 01:10:04 +0300
Subject: KVM: x86: Decoding guest instructions which cross page boundary may fail

From: Nadav Amit <namit@xxxxxxxxxxxxxxxxx>

commit 08da44aedba0f493e10695fa334348a7a4f72eb3 upstream.

Once an instruction crosses a page boundary, the size read from the second page
disregards the common case that part of the operand resides on the first page.
As a result, fetch of long insturctions may fail, and thereby cause the
decoding to fail as well.

Fixes: 5cfc7e0f5e5e1adf998df94f8e36edaf5d30d38e
Signed-off-by: Nadav Amit <namit@xxxxxxxxxxxxxxxxx>
Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
 arch/x86/kvm/emulate.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -773,8 +773,10 @@ static int __do_insn_fetch_bytes(struct
 static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt,
 					       unsigned size)
 {
-	if (unlikely(ctxt->fetch.end - ctxt->fetch.ptr < size))
-		return __do_insn_fetch_bytes(ctxt, size);
+	unsigned done_size = ctxt->fetch.end - ctxt->fetch.ptr;
+
+	if (unlikely(done_size < size))
+		return __do_insn_fetch_bytes(ctxt, size - done_size);
 	else
 		return X86EMUL_CONTINUE;
 }


Patches currently in stable-queue which might be from namit@xxxxxxxxxxxxxxxxx are

queue-3.17/kvm-x86-emulator-fixes-for-eip-canonical-checks-on-near-branches.patch
queue-3.17/kvm-x86-check-non-canonical-addresses-upon-wrmsr.patch
queue-3.17/kvm-x86-handle-errors-when-rip-is-set-during-far-jumps.patch
queue-3.17/kvm-x86-emulator-does-not-decode-clflush-well.patch
queue-3.17/kvm-x86-prefetch-and-hint_nop-should-have-srcmem-flag.patch
queue-3.17/kvm-x86-fix-wrong-masking-on-relative-jump-call.patch
queue-3.17/kvm-x86-decoding-guest-instructions-which-cross-page-boundary-may-fail.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]