OSDN Git Service

KVM: x86: emulate: correct page fault error code for NoWrite instructions
[uclinux-h8/linux.git] / arch / x86 / kvm / emulate.c
index 81dcf79..a943bf0 100644 (file)
@@ -4954,7 +4954,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
                rc = segmented_read(ctxt, ctxt->dst.addr.mem,
                                   &ctxt->dst.val, ctxt->dst.bytes);
                if (rc != X86EMUL_CONTINUE) {
-                       if (rc == X86EMUL_PROPAGATE_FAULT &&
+                       if (!(ctxt->d & NoWrite) &&
+                           rc == X86EMUL_PROPAGATE_FAULT &&
                            ctxt->exception.vector == PF_VECTOR)
                                ctxt->exception.error_code |= PFERR_WRITE_MASK;
                        goto done;