* [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions
@ 2015-02-09 9:03 Paolo Bonzini
2015-02-11 0:56 ` Nadav Amit
2015-11-20 2:52 ` Wanpeng Li
0 siblings, 2 replies; 6+ messages in thread
From: Paolo Bonzini @ 2015-02-09 9:03 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: Nadav Amit
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 <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions
2015-02-09 9:03 [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions Paolo Bonzini
@ 2015-02-11 0:56 ` Nadav Amit
2015-11-20 2:52 ` Wanpeng Li
1 sibling, 0 replies; 6+ messages in thread
From: Nadav Amit @ 2015-02-11 0:56 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm, Nadav Amit
Sorry for that. I’ll try to run some few more tests next week.
Nadav
Paolo Bonzini <pbonzini@redhat.com> 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 <namit@cs.technion.ac.il>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions
2015-02-09 9:03 [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions Paolo Bonzini
2015-02-11 0:56 ` Nadav Amit
@ 2015-11-20 2:52 ` Wanpeng Li
2015-11-20 3:27 ` Wanpeng Li
1 sibling, 1 reply; 6+ messages in thread
From: Wanpeng Li @ 2015-11-20 2:52 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm, Nadav Amit
Hi Paolo,
2015-02-09 17:03 GMT+08:00 Paolo Bonzini <pbonzini@redhat.com>:
> 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.
Sorry to reply to an old commit, btw, could you point out where in SDM
describe above?
Regards,
Wanpeng Li
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions
2015-11-20 2:52 ` Wanpeng Li
@ 2015-11-20 3:27 ` Wanpeng Li
2015-11-20 7:46 ` Nadav Amit
0 siblings, 1 reply; 6+ messages in thread
From: Wanpeng Li @ 2015-11-20 3:27 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm, Nadav Amit
2015-11-20 10:52 GMT+08:00 Wanpeng Li <kernellwp@gmail.com>:
> Hi Paolo,
> 2015-02-09 17:03 GMT+08:00 Paolo Bonzini <pbonzini@redhat.com>:
>> 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.
>
> Sorry to reply to an old commit, btw, could you point out where in SDM
> describe above?
I see.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions
2015-11-20 3:27 ` Wanpeng Li
@ 2015-11-20 7:46 ` Nadav Amit
0 siblings, 0 replies; 6+ messages in thread
From: Nadav Amit @ 2015-11-20 7:46 UTC (permalink / raw)
To: Wanpeng Li; +Cc: Paolo Bonzini, linux-kernel, kvm
Wanpeng Li <kernellwp@gmail.com> wrote:
> 2015-11-20 10:52 GMT+08:00 Wanpeng Li <kernellwp@gmail.com>:
>> Hi Paolo,
>> 2015-02-09 17:03 GMT+08:00 Paolo Bonzini <pbonzini@redhat.com>:
>>> 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.
>>
>> Sorry to reply to an old commit, btw, could you point out where in SDM
>> describe above?
>
> I see.
I don’t understand whether you still need my help, so to clarify: on a
page-fault the error code should indicate whether the access was due to a
write access. Previously KVM marked it as “write access” for instructions
such as test and cmp that do not perform write.
Nadav
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions
@ 2015-11-20 7:46 ` Nadav Amit
0 siblings, 0 replies; 6+ messages in thread
From: Nadav Amit @ 2015-11-20 7:46 UTC (permalink / raw)
To: Wanpeng Li; +Cc: Paolo Bonzini, linux-kernel, kvm
Wanpeng Li <kernellwp@gmail.com> wrote:
> 2015-11-20 10:52 GMT+08:00 Wanpeng Li <kernellwp@gmail.com>:
>> Hi Paolo,
>> 2015-02-09 17:03 GMT+08:00 Paolo Bonzini <pbonzini@redhat.com>:
>>> 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.
>>
>> Sorry to reply to an old commit, btw, could you point out where in SDM
>> describe above?
>
> I see.
I don’t understand whether you still need my help, so to clarify: on a
page-fault the error code should indicate whether the access was due to a
write access. Previously KVM marked it as “write access” for instructions
such as test and cmp that do not perform write.
Nadav--
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/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-20 7:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-09 9:03 [PATCH] KVM: x86: emulate: correct page fault error code for NoWrite instructions Paolo Bonzini
2015-02-11 0:56 ` Nadav Amit
2015-11-20 2:52 ` Wanpeng Li
2015-11-20 3:27 ` Wanpeng Li
2015-11-20 7:46 ` Nadav Amit
2015-11-20 7:46 ` Nadav Amit
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.