KVM: x86: #PF error-code on R/W operations is wrong
authorNadav Amit <namit@cs.technion.ac.il>
Thu, 25 Dec 2014 00:52:16 +0000 (02:52 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 9 Jan 2015 09:24:11 +0000 (10:24 +0100)
When emulating an instruction that reads the destination memory operand (i.e.,
instructions without the Mov flag in the emulator), the operand is first read.
If a page-fault is detected in this phase, the error-code which would be
delivered to the VM does not indicate that the access that caused the exception
is a write one. This does not conform with real hardware, and may cause the VM
to enter the page-fault handler twice for no reason (once for read, once for
write).

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/emulate.c
arch/x86/kvm/mmu.h

Simple merge
Simple merge
Simple merge