From patchwork Fri Nov 27 10:46:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 11935511 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,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 B9467C63777 for ; Fri, 27 Nov 2020 10:47:07 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 16B9B204EA for ; Fri, 27 Nov 2020 10:47:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="fhkaSzVk"; dkim=pass (1024-bit key) header.d=citrix.onmicrosoft.com header.i=@citrix.onmicrosoft.com header.b="paDeWY4A" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16B9B204EA Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.39143.71931 (Exim 4.92) (envelope-from ) id 1kibH5-0007zP-2l; Fri, 27 Nov 2020 10:46:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 39143.71931; Fri, 27 Nov 2020 10:46:47 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kibH4-0007zI-Vn; Fri, 27 Nov 2020 10:46:46 +0000 Received: by outflank-mailman (input) for mailman id 39143; Fri, 27 Nov 2020 10:46:46 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kibH4-0007zD-3N for xen-devel@lists.xenproject.org; Fri, 27 Nov 2020 10:46:46 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 623a9f76-a0ce-434e-9e18-a2f5091dccec; Fri, 27 Nov 2020 10:46:44 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kibH4-0007zD-3N for xen-devel@lists.xenproject.org; Fri, 27 Nov 2020 10:46:46 +0000 X-Inumbo-ID: 623a9f76-a0ce-434e-9e18-a2f5091dccec Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 623a9f76-a0ce-434e-9e18-a2f5091dccec; Fri, 27 Nov 2020 10:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1606474004; h=from:to:cc:subject:date:message-id: content-transfer-encoding:mime-version; bh=pl4SLpfK3Jw2b0Ca1apyPoV1WVxy+JeuV676lj8j2NI=; b=fhkaSzVkBDaNsoD5dMdM0Sxmk75/6IK4QWk8BmjYyKTRQuenBW+mJVXh xohwljeIUK9xHyic1199VZK3T5+9tEYUALaGsHbjipNOkXm+KEtTMOb0z r1//Qk6MtGDfFeb5Lf+boVjR3iygEE7WQbrwDxXWVhf+LJxKWfa+R/fvG M=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: /skHKc2GgQjSi6QkDRPaIMDu9NqM/V3a/uRqgVDXxOWfLsWfWQWYH61nrI2gPb+3Q0QNgy9vqd uzNm1P5DLoQGgeLuHPmflOTDnc6wd+qLBBWsVtDdTkyox6RrrAZ86QQ+L9XUvbxkYMpP+o4Rew IXYS4bef4SrBZhUuYx6pjn7l1QFKOHfhOog0muPLLe/sad9p9rSwJjGiIbrZlRXPOGpPv7l8+9 2+coyUkLZg5iJHB4BAHSKEUrYBlqqNE+B1Z2MDi1oyECXlJeyRS9EBSe2UKZEqIJqsO8/0eGra xW0= X-SBRS: None X-MesageID: 32007806 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.78,374,1599537600"; d="scan'208";a="32007806" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k+AWDEwllZrtql9NDcXH5jT9gIbhrXFGvgqw7pUsqKPGiP7/mWcx7a1viBWGlWyRbwbOqqO9Hu/fC4txJhCUhFHp6afExNrKxfQYa5HRPwWjzgyHuudo8AzixVU/S7W6HwlgfnH4YsDEC5lxixyAcD+M/jddLDNAwF8JlZQqHip9CTAbrMyju/j7GLQHUp1zZDH5JCI2sHk6MmmAgxI7loagkGQTyUZl8tjEe5YbtSjtt2ydwj9JciFQFuQyQUp15ZYCto9vmpEGyHJ3CePoX0dMA+TcDHGs0GtBnoXkSWAkbprvCYWic/6E2vMXA2PZqZE2XsjPOJ0KvjRUbJfUxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kMM+/x5/EdEJOyjUC+X75zlJ9+hyk+7CvKHWojtzWqE=; b=d1V8P/PHkVyWrG/F5hSYb9m+D7vZuA4MZ6G335V6+1wpvsuHfp6KgPF9/CbqtkTY58TFDfk0MrGOZ0LJ6qDipo7J2WKnRCm9mztAnTLtm98xre7RkiUvG3w3ZJXm2fMXS9KSx28nuysMU8Ct9pInmYfKbAe6mKb49Hzcmc9Qt63+Hm1LBv13jm78SpwJkR04PtvxQRv0chk+WAlQnX3zAxnFKGPHoSdTW1BGBa3R8NjbWM2JKYFTa6qWfwY74n43kVXO38P6YXe0/H8WYUlx68DQzAxF3T0v/xhL2Aaenix35Np8ydtSzixSoG54oVZiqAAyasWtby9+B+a1qjpmFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kMM+/x5/EdEJOyjUC+X75zlJ9+hyk+7CvKHWojtzWqE=; b=paDeWY4AZGOW2Cjiv41KVoVW65DNW12tNtIi5zk7gT3LRn20UdInrgUTetMdvvY+n4aAQcxY8z47y628VZ5mEZzFP3hLjrVhHUI0ZVmfzi5tjlx0JaLCoAyh8767vhqI6TmoO59BzqxUWMksKOggTMme9ocehG4/X7qTVkD6Vzc= From: Roger Pau Monne To: CC: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH] x86/msr: don't inject #GP when trying to read FEATURE_CONTROL Date: Fri, 27 Nov 2020 11:46:14 +0100 Message-ID: <20201127104614.71933-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.29.2 X-ClientProxiedBy: MR2P264CA0076.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:32::16) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8d5dd280-f377-4b21-2bdf-08d892c1b926 X-MS-TrafficTypeDiagnostic: DM6PR03MB5084: X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FCyUFWR02v68GGz7QdyyWsYhIMAq5R7Li7KpoYnlfipZ3ID1Zn6ErV/uv4/R3sAVIgICV+NX+z5XRJbrm8USSwNvB0nVhedqXMeuzCLVSjLpF1wrdHnjh6OTbDSvSOZf/4GFyBiHcHm5kwTi+4WaJDJfkN8tngkbde21+LtBpD03SltzYQYwokAaawrhQF4hQ8esvZ4ULkMnvrs+Z6VY/Rz/g+diqV99m5Mk9Mp044dGo53BTynuxbePkmgRpjub0ObrLNn8dh6bxlmxFo/Jlxe+ri7KlK+1+P2TKZkJB05dbwA+a/unsI065mwYgKhd X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(346002)(39860400002)(396003)(366004)(136003)(4326008)(2906002)(478600001)(16526019)(5660300002)(83380400001)(2616005)(8936002)(36756003)(956004)(6666004)(86362001)(186003)(316002)(6496006)(54906003)(6486002)(8676002)(1076003)(66476007)(26005)(4744005)(6916009)(66946007)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?W+ywBD1g0xH8znPiMHpwSgtbOMOuX7?= =?utf-8?q?UQqJFNl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SxT+eUZI90baautcvXs60e7luI/K8v3pBcKXLmtDSI1XOr?= =?utf-8?q?6+0tHGtYEfxJK+rndPe?= X-MS-Exchange-CrossTenant-Network-Message-Id: 8d5dd280-f377-4b21-2bdf-08d892c1b926 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2020 10:46:40.6650 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ChrTmSH/CIFp0mqJtuclXQsBCTHhfXzIQwIbjQC2YgVw06M62ylU39Hl8OhA7cdUsIWrVS51fwJcv6upzmsWhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB5084 X-OriginatorOrg: citrix.com Windows 10 will triple fault if #GP is injected when attempting to read the FEATURE_CONTROL MSR on Intel or compatible hardware. Fix this by injecting a #GP only when the vendor doesn't support the MSR, even if there are no features to expose. Fixes: 39ab598c50a2 ('x86/pv: allow reading FEATURE_CONTROL MSR') Signed-off-by: Roger Pau Monné Acked-by: Jan Beulich --- xen/arch/x86/msr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c index be8e363862..38b0a046e1 100644 --- a/xen/arch/x86/msr.c +++ b/xen/arch/x86/msr.c @@ -176,7 +176,7 @@ int guest_rdmsr(struct vcpu *v, uint32_t msr, uint64_t *val) switch ( msr ) { case MSR_IA32_FEATURE_CONTROL: - if ( !cp->basic.vmx && !vmce_has_lmce(v) ) + if ( !(cp->x86_vendor & (X86_VENDOR_INTEL | X86_VENDOR_CENTAUR)) ) goto gp_fault; *val = IA32_FEATURE_CONTROL_LOCK;