Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751278AbbBKA4S (ORCPT ); Tue, 10 Feb 2015 19:56:18 -0500 Received: from mail-ig0-f182.google.com ([209.85.213.182]:57910 "EHLO mail-ig0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbbBKA4Q convert rfc822-to-8bit (ORCPT ); Tue, 10 Feb 2015 19:56:16 -0500 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions From: Nadav Amit In-Reply-To: <1423472611-5104-1-git-send-email-pbonzini@redhat.com> Date: Tue, 10 Feb 2015 19:56:10 -0500 Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Nadav Amit Content-Transfer-Encoding: 8BIT Message-Id: <934F9FF2-D571-485C-9117-CC6B6F617C32@gmail.com> References: <1423472611-5104-1-git-send-email-pbonzini@redhat.com> To: Paolo Bonzini X-Mailer: Apple Mail (2.2070.6) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1579 Lines: 45 Sorry for that. I’ll try to run some few more tests next week. Nadav Paolo Bonzini wrote: > NoWrite instructions (e.g. cmp or test) never set the "write access" > bit in the error code, even if one of the operands is treated as a > destination. > > Fixes: c205fb7d7d4f81e46fc577b707ceb9e356af1456 > Cc: Nadav Amit > Signed-off-by: Paolo Bonzini > --- > arch/x86/kvm/emulate.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > index 81dcf7964701..a943bf0c06d0 100644 > --- a/arch/x86/kvm/emulate.c > +++ b/arch/x86/kvm/emulate.c > @@ -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; > -- > 1.8.3.1 > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/