Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp233719pxx; Wed, 28 Oct 2020 03:37:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfU83x3sClEgKTXMRfma/a7UHpU21YXbq5TE3q8xf3bdAajtzZ857NxC1vP4YnilJ636Fz X-Received: by 2002:a17:906:ad8:: with SMTP id z24mr6684163ejf.222.1603881440769; Wed, 28 Oct 2020 03:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881440; cv=none; d=google.com; s=arc-20160816; b=R9EHpVe2whY+4fl/Bp8bTAxWg34jjeac2mNngG49zAOpRpY7okg+RliAhOlM5hvj3x MLvUsW4maID94eCeNSsY8rsjYMkoKA10VWNtowcqj1WJyA2vZw9it3kxuKV6Lj4/v3Hg AXKkZTvcMWNAZ6iYEEc1ctDW59bfX5MijxZrfiHPDS28LeEXFQReXAHcapAu7O3ZinBD 91PxQJ9figViMJNb2ogIRcWVLMolAk7NPEgR6eT6sKb5j7mQCP4jA9eDDl1H1p1lxz4B PdPHGmAhjkaYE1zrH+ZoX9OKmujjTNHN9TGEqDTP1JJk9qwIiW8mPGQYEfFLs0aOorUT CH+A== 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=KHtMcEAkx0zcAiHALsNkXnUZO76oPUha+ynqaZyyCCg=; b=ihZnV5/pUp2smoQxGrmDYJRVzyxvpXwJcfVKl7NAWQa9kfVmYljef2GKbARGZ6Tqle 0Goffodx+7P7DHApSUicIQYbhRwZG7DZLtFq6HKYV5lSBAL5ysuGtf69Mmdde1B2JvhU on2V9T37fuOWFWZX0XxKFXVBJPhHl34fZ1Xy+V4x0ZRx6N5wRfk/uMwHOWpykUU5RnvL 3XqrcD5ROc4Pi01GBsraWaEF6JI0zjW4MZ8xrxmYXT6DnWqc2k/LUTQkarse5XWW0gGC 9AKULEu/OajHm6npbVrDRO/gWjldNhZ9BFDBns7XzIwAs/9kbPWs43Dt12m0l7MiWj8N nSbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1PdCnk0Q; 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 b6si3402013edu.343.2020.10.28.03.36.59; Wed, 28 Oct 2020 03:37:20 -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=1PdCnk0Q; 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 S1762656AbgJ0Onz (ORCPT + 99 others); Tue, 27 Oct 2020 10:43:55 -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 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 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; } -- 2.25.1