* KVM: x86: emulating RDPID failure shall return #UD rather than #GP
@ 2020-08-28 2:23 Robert Hoo
2020-08-28 18:25 ` Jim Mattson
2020-09-23 15:51 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Robert Hoo @ 2020-08-28 2:23 UTC (permalink / raw)
To: pbonzini, sean.j.christopherson, wanpengli, kvm; +Cc: robert.hu, Robert Hoo
Per Intel's SDM, RDPID takes a #UD if it is unsupported, which is more or
less what KVM is emulating when MSR_TSC_AUX is not available. In fact,
there are no scenarios in which RDPID is supposed to #GP.
Fixes: fb6d4d340e (KVM: x86: emulate RDPID)
Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
---
arch/x86/kvm/emulate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index d0e2825..571cb86 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3594,7 +3594,7 @@ static int em_rdpid(struct x86_emulate_ctxt *ctxt)
u64 tsc_aux = 0;
if (ctxt->ops->get_msr(ctxt, MSR_TSC_AUX, &tsc_aux))
- return emulate_gp(ctxt, 0);
+ return emulate_ud(ctxt);
ctxt->dst.val = tsc_aux;
return X86EMUL_CONTINUE;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: KVM: x86: emulating RDPID failure shall return #UD rather than #GP
2020-08-28 2:23 KVM: x86: emulating RDPID failure shall return #UD rather than #GP Robert Hoo
@ 2020-08-28 18:25 ` Jim Mattson
2020-09-23 15:51 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Jim Mattson @ 2020-08-28 18:25 UTC (permalink / raw)
To: Robert Hoo
Cc: Paolo Bonzini, Sean Christopherson, Wanpeng Li, kvm list, Robert Hu
On Thu, Aug 27, 2020 at 7:23 PM Robert Hoo <robert.hu@linux.intel.com> wrote:
>
> Per Intel's SDM, RDPID takes a #UD if it is unsupported, which is more or
> less what KVM is emulating when MSR_TSC_AUX is not available. In fact,
> there are no scenarios in which RDPID is supposed to #GP.
>
> Fixes: fb6d4d340e (KVM: x86: emulate RDPID)
> Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: KVM: x86: emulating RDPID failure shall return #UD rather than #GP
2020-08-28 2:23 KVM: x86: emulating RDPID failure shall return #UD rather than #GP Robert Hoo
2020-08-28 18:25 ` Jim Mattson
@ 2020-09-23 15:51 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-09-23 15:51 UTC (permalink / raw)
To: Robert Hoo, sean.j.christopherson, wanpengli, kvm; +Cc: robert.hu
On 28/08/20 04:23, Robert Hoo wrote:
> Per Intel's SDM, RDPID takes a #UD if it is unsupported, which is more or
> less what KVM is emulating when MSR_TSC_AUX is not available. In fact,
> there are no scenarios in which RDPID is supposed to #GP.
>
> Fixes: fb6d4d340e (KVM: x86: emulate RDPID)
> Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
> ---
> arch/x86/kvm/emulate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index d0e2825..571cb86 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -3594,7 +3594,7 @@ static int em_rdpid(struct x86_emulate_ctxt *ctxt)
> u64 tsc_aux = 0;
>
> if (ctxt->ops->get_msr(ctxt, MSR_TSC_AUX, &tsc_aux))
> - return emulate_gp(ctxt, 0);
> + return emulate_ud(ctxt);
> ctxt->dst.val = tsc_aux;
> return X86EMUL_CONTINUE;
> }
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-23 15:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 2:23 KVM: x86: emulating RDPID failure shall return #UD rather than #GP Robert Hoo
2020-08-28 18:25 ` Jim Mattson
2020-09-23 15:51 ` Paolo Bonzini
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.