Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp471746pxx; Wed, 28 Oct 2020 09:05:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy83FvNwrHULuBgG2f2KtwxgbA+NYnW0sC0McTfPu8t15XJWjZq0JrO5siWK7vXlZGCKuGL X-Received: by 2002:a05:6402:1686:: with SMTP id a6mr8343305edv.106.1603901149684; Wed, 28 Oct 2020 09:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603901149; cv=none; d=google.com; s=arc-20160816; b=VmpcAMi61YxZYOaQAquIyiJLfrPV4T3dHT3In8wAn8t/Rf1Qa+gUs9VQQOvUrk6lzL uaARxfbctmxp/C1aun2Q40Gr6BGyFdtmaCoI2MRLzvZzbaRu2yT1gyx5O9s5X9LhATrq xv2OqBVf8CeO+txvsS50sujpjZG17niOUWdiz+GH0gS3ft2wvJAZTWxzUr+r9/9wzEkw jpzp+0ezglX9iBWFW69lKhs4BzZaFnRA1t57Y64WXYKY7ExkeDev2uObKDV1zsw+HABe ZH4FO0ZQ/mGzzD2jUmp5HgPvnWIx3AIbmTW9l6jDWAok37t5RKhqb4/XeUAvqy+X5tZp Bphw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=y2B1vGos+3KDNlkZPvkDrY6kyMA14tMp5orOWpHBnMc=; b=FxVCLtVvslv5lOhKXLoEWIEBIeA+MPX+YZQ+DZbm+JWgXZsM1+OjdCsWc+Cxy7ZnWG d3/ptuHypXNcJobFWrc9ljThUKl6oIiwarv7Rv/cW5jsl4SYeLFn/T0ItF9lKXoxBHPf Fj9SAA/CSd3v+xDRDvHPfv22NGlrDK4dFNJM2v8Lxu77lXi5Yp+uChBx+vp+btrBKRle dgixyyZoPAzPJYhG1ze5+1qdJyqjMoRxAP0jhLs8QxaBD3YjF+AhEpyfALa7xk2V9Y0U VwOracixXbQcUR6vyEgwZHtYsoyNGJhg/Jj8tQ4mJSmuymMacBDr6A0MY/Wq/sjJ3WWH iPng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="2FgkL/Rj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si2953320edn.245.2020.10.28.09.05.25; Wed, 28 Oct 2020 09:05:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="2FgkL/Rj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1814709AbgJ0Q7W (ORCPT + 99 others); Tue, 27 Oct 2020 12:59:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:45224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1794019AbgJ0PJn (ORCPT ); Tue, 27 Oct 2020 11:09: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 87A3C206E5; Tue, 27 Oct 2020 15:09:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811383; bh=5gD5+YSD1ucPQ6kqFmI8woromPacIx4Cj5ytG/Cqv68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2FgkL/RjD7ygsOrTQwkrGv2eOzWrFw99xRgDvvWxR42CH9+wy3v43GL6EMxvlH691 tvacNe+kaoGb1v5zPEvlfZtG76SgNqnrxKpVQ6ZoRT6wtT0DSDjkwFvp0O6EI4Qemh oTHOA3sHyWpp2p+Jpm8HVBCCuGrc6ZsCpzmxrFWM= 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.8 473/633] KVM: x86: emulating RDPID failure shall return #UD rather than #GP Date: Tue, 27 Oct 2020 14:53:36 +0100 Message-Id: <20201027135544.926561146@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 d0e2825ae6174..571cb8657e53e 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; } -- 2.25.1