From patchwork Tue Oct 27 13:53:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6CBBC388F9 for ; Tue, 27 Oct 2020 14:41:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 684EE21D7B for ; Tue, 27 Oct 2020 14:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809709; bh=WHyRwHSBwr0NvurNUhz0xnWf/zho8+AR72sUml7fYeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dWbrcdJTHhojLucMM+5JhQLhwztAB90yrUc19M8EffF+dtfLDukglff/cNfBWJPzT LsvlGtudgOn/d+MbCbfb6Zylk6LSNiTcCDFTPJNqvAZYCVB+nvByr4rWpZhPAdp9R/ J6jVedWVY7ytDP2daT+DOf+bw2TcjY1YhJwu7wvI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762287AbgJ0Olo (ORCPT ); Tue, 27 Oct 2020 10:41:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:41156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761466AbgJ0Oln (ORCPT ); Tue, 27 Oct 2020 10:41:43 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 31CBC20773; Tue, 27 Oct 2020 14:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809702; bh=WHyRwHSBwr0NvurNUhz0xnWf/zho8+AR72sUml7fYeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1PdCnk0QgUEs91whGygmkdsQwexzTX1wOVzL+TJNYU4+cuyuV4AucpFURbO/jxrke eyBMJ1TT10kjJkASMzGMNU/rgbUieEsrJ+R6Ik7IpbLllEpqzkYEUJiAbfW16MwEjA Rq9nmK7x9stuiBLGV/1f0ep37x+fzgdYqoFD3hlE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hoo , Jim Mattson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.4 290/408] KVM: x86: emulating RDPID failure shall return #UD rather than #GP Date: Tue, 27 Oct 2020 14:53:48 +0100 Message-Id: <20201027135508.498053278@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Robert Hoo [ 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 --- 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 cc7823e7ef96c..484c32b7f79ff 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3617,7 +3617,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; }