Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp174254pxx; Wed, 28 Oct 2020 01:36:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUjmy8yb1s+8Jr4M4ncgPg+mpEPM6dGanbCC5Muo/RW/k6B2isSFN5qwdrAsX6R5wyeesm X-Received: by 2002:a17:906:48a:: with SMTP id f10mr2250606eja.5.1603874189257; Wed, 28 Oct 2020 01:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603874189; cv=none; d=google.com; s=arc-20160816; b=dvgkZZwMCMIjUKloO6wKebhqYN5DbaLbFe92mOsxw1RlH9hC8UQ/ERHb2cKA7n53Dz W59Xnd0/y0XJS5TQFvdkqaACJQ71RoNirRIRsPVFgHCNQ0ycte/ZoDqWUhe7SSOkHXPU 8SlB+LZMsfyd7qH6g4F5yNZ2fR1q55+FJtLmP3l9A+h7pdSbb5upDHfJb2OzFCOyiIUr DbildLYHuqLd+5VHh3kP2vhUxVLsk4Vb0TFm3VgmDyS4E0lcmVby1/n+Kl1YYJonw5Xx NDO4KznBjDDXCyLEb6YSLBuGv3nQ4kK3XOGCKObFI5IY9lWcVOXmHKz6iBl4w5zaqSJP h5mg== 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=uTptxc6YbCc0SipGStd/XIxxNVicT5doMveWd4fSiAU=; b=YVlYaJrS1ASc9Y5lopk83wzg60acG2e7fYgTSxVxcXmcQrCKEwcmscXEufRdnqcKIn PxsydCrkDsGpi5dMu60VcGya727rz0wr1bgU3RfakdLl8JFTVtjLHCUuyZh1AZlzcTzQ iIH9rM3ln0wcZYbtPQxwMNZeH4sZXT0W7JMpzOktzeZdrIhsVnroIgktr/we5kbLgUGI pxQxDTGEsHsi86fDD4N4FrDMQNp6iqRswiMTvE0KxXQIySiwaZ16Bih/3/QHL1v9RQRg hnr8mHfhSfVK4QSoBrqKxWkvOY1VR172irL2HkUJy/PsrG5AkibI0EGrRQSyk5nTEYeT tF0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZQvZF+P6; 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 l12si2820211edk.163.2020.10.28.01.36.07; Wed, 28 Oct 2020 01:36:29 -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=ZQvZF+P6; 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 S1754759AbgJ0OG5 (ORCPT + 99 others); Tue, 27 Oct 2020 10:06:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:47192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753287AbgJ0N7j (ORCPT ); Tue, 27 Oct 2020 09:59:39 -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 B976D2068D; Tue, 27 Oct 2020 13:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807179; bh=Cy42EPoULeSZsZ8sVYky8mByMq1EuOgF4SNBc7BbvB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQvZF+P6dKf13OCYJrPbDdI977Wpgbad1NXTNkapD2zTXVM0jqjkcMqkteR6EUkpQ aK5du1Jb9qGnruVFi0x+R6mRCP3jY+EU4cbedXEZmKOz/DBvaCoA43PBDVKhy3nz3E 4NgR24/OTb5r/MboDxJtFm9qJ9jUVJA+TVjbrJ8I= 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 4.4 072/112] KVM: x86: emulating RDPID failure shall return #UD rather than #GP Date: Tue, 27 Oct 2020 14:49:42 +0100 Message-Id: <20201027134903.965222809@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@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 466028623e1a0..0c1e249a7ab69 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3524,7 +3524,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