From patchwork Tue Oct 27 13:53:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 307330 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 BA8CFC8300E for ; Tue, 27 Oct 2020 16:36:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E68A218AC for ; Tue, 27 Oct 2020 16:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603816602; bh=TKmVJoukR4BZOhkxwruw+3wTFzHmXCsTzhI8cRjqa2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=v7pzclHlcDPTHz1qjYSomtwqmBsOy6+eNt6Jvw5GJIoQODFfJoiy9CIVWJRrsV7ZT y197hjPseBO7+YG8eUR5QYOqOcTmDYcWyF8xsOJKpBeo6YQo8vQelu5Np22HiqjkqA d0qJaYEcIhLfSelVsKXLIySehTa9NzsFoiSlB9Jg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1810996AbgJ0Qgk (ORCPT ); Tue, 27 Oct 2020 12:36:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:41766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1801890AbgJ0Po6 (ORCPT ); Tue, 27 Oct 2020 11:44:58 -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 C85D122409; Tue, 27 Oct 2020 15:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603813491; bh=TKmVJoukR4BZOhkxwruw+3wTFzHmXCsTzhI8cRjqa2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EB36+SYKOr5w6zr2WlWQdoDgeOrKZXtdIDJAM2z7IO/D1E+4tZwyk7RuTY1QEDGtn ngjdQayXO8+YymqAQR1fwAbQlkHWooxXdB5Z4sknlcHGGOxJCYh+Cqj3vSh2/AcZph BEqwaYSkQ1A4YsBFw5DFGMbTHIntabpJQUtSIjrU= 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.9 569/757] KVM: x86: emulating RDPID failure shall return #UD rather than #GP Date: Tue, 27 Oct 2020 14:53:39 +0100 Message-Id: <20201027135517.201145013@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@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 2f6510de6b0c0..85111cd0adcd0 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3606,7 +3606,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; }