From: Robert Hoo Date: Fri, 28 Aug 2020 02:23:42 +0000 (+0800) Subject: KVM: x86: emulating RDPID failure shall return #UD rather than #GP X-Git-Tag: v4.9.241~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f90c8dd3a2271a65c00d7cd0364fa400144005a4;p=platform%2Fkernel%2Flinux-amlogic.git KVM: x86: emulating RDPID failure shall return #UD rather than #GP [ Upstream commit a9e2e0ae686094571378c72d8146b5a1a92d0652 ] 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 Message-Id: <1598581422-76264-1-git-send-email-robert.hu@linux.intel.com> Reviewed-by: Jim Mattson Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index da3cd73..d455221 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3536,7 +3536,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; }