Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10139230ybi; Thu, 11 Jul 2019 00:13:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwumpKR8dp5kZrRxLmWqFydydVgnCvZhN+M15B6l6P6/JOIjpH+pTivv/3epR7GERh/A3e+ X-Received: by 2002:a17:902:2ac8:: with SMTP id j66mr2768755plb.273.1562829223259; Thu, 11 Jul 2019 00:13:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1562829223; cv=pass; d=google.com; s=arc-20160816; b=hAMMBg8LZiaxXOy55S6MyYFZ2rza4QLlNmbiDqZRfoZII3reYcPFigAqB/KNbcNhC3 UN0gCFb+4HqF6POxUf6dXCb85LIXmwUCw3YDZTpOZn7In1UJrp5m3YtgVmg2ge+eTyA0 tO+RE1IaA6UiFIcdxXXVUd9V3ptHPUMdI56gLycOhYghH3qU6SooifTXPQ9HFi7sVZfv bAgR/SiqHzdmtDK9v5e+jGvO2O/3SRj/n15PdMX+8vW2G/rOMGn7bgcczk6FGixyHYaV jEbPsuS2cXe1h03anCl0P6a6az/Ao0qqgdvNgUwzNGHz9x8Nqh4KLlCtEKhyZ88YW6h9 nQOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=ZiwWImwI+ZZFbWj/Qdqg1Od9ImXDwaVeJIGJewQ8uVo=; b=oOx50JFIal5luq/gi0l6c2Z3WsSY27w0tRyX9J7wLAgR82R1ztyaxJmRh2PfqYx366 xlaynO0N8f8VObKHbomp41y+cw5BgbwRkTAXstpLk2J+v0MMRG2WiYdPg2mSQsCAJ8MK f5SxWya/hGVPU9QpMFKHFE9Io8UxybbMxfHi6YDooQIcX30ML4odyqt2Bh4xVWn2vQpd AvhXJdqXJOiBQV5wp+pZ1x3ba7KHFoU84mpNZZsCWaCz5x17ZW3BGKMAFkhPRNR43S7M W7qr77PtgeqY0NKwAzyemGsWNkyZQ6xYd1ViMiOp1umGH+BNsEOJFGFiEwjK8BFYAHFy Zk9w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vmware.com header.s=selector2 header.b="BpFY76k/"; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5si4402798pfc.245.2019.07.11.00.13.27; Thu, 11 Jul 2019 00:13:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@vmware.com header.s=selector2 header.b="BpFY76k/"; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728197AbfGKHLW (ORCPT + 99 others); Thu, 11 Jul 2019 03:11:22 -0400 Received: from mail-eopbgr710049.outbound.protection.outlook.com ([40.107.71.49]:47245 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728104AbfGKHLV (ORCPT ); Thu, 11 Jul 2019 03:11:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jrfNNmr+bJw2f9OMOyNYpSQocDpv+pbHn9uUuu5y/KT9VfRlztfMxFKzXgBbcWi2Yi5uk9+t5mvKyB0M07kzBbXe2052+mcAYFMOKu3xJvFeTuR/HGToeR3PkE9Y+KMhCmvnaGioS0ykXs+mbgBoc90v8DQSqLoIih8HH2IP/9kKuEK2f42bZu93xrlqGCB1QmEQIqHMObLteaYffL3Dh0ffQSnYfTsUD/mH+f/g2vp8RR25jSnhm3hRdyhuhDgSlhgG2uOoGsp3/EdnThLqVmhkfOaZcgyXPY0ckWGw9wmfkzPWCaI8n6qKm0QKKq08IT4k35+p0NiwcqH+UqI3tA== 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=ZiwWImwI+ZZFbWj/Qdqg1Od9ImXDwaVeJIGJewQ8uVo=; b=MixKHT0lA1RRsEf3czpVtY+5lDZLZgEltHJ/7swswdbartJQ03divbrG8PFiEnZpqnKCTnEoC3ZuFNqzN9xjbWwHkKPu5CvHMt85ptRcPT9+Dk4ZOu1QHY/RJd3XokffGSlL1CYgkrCKoRW9MhJOkWqpdJht0rVD3wtayRU78t3i4eZ30yjd1CwVb+efL5HST+lW0YQ7vAXLkplDdWbgY+TNglCEoYGZDJyR37a7CoTaG/EC13rms6XiRbJsnlU3nwdage0B/VfSgVrsZYtblqtXHKqZlxel3Bh5IW6CH/y6NCE82lAG04j94rgY5T7c9w94dFqZdXt4+Y8VYiyi1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=vmware.com;dmarc=pass action=none header.from=vmware.com;dkim=pass header.d=vmware.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZiwWImwI+ZZFbWj/Qdqg1Od9ImXDwaVeJIGJewQ8uVo=; b=BpFY76k/BO7kV8Xq3XBa6z0A9E3Ap2VyiBbefuk3VmH8BZ6cNWGcS8M4O38Qdy+zTQUumwSSUCE7Qqtd7tg7IpmbxNgivpNGENsvldmRVjfYu/4KlgEPX+2nZdgmO07x40YRXiSUxEBNDDwrrhqZV1WD/3j0OQwAxVIsOXmGkKg= Received: from BYAPR05MB4776.namprd05.prod.outlook.com (52.135.233.146) by BYAPR05MB4743.namprd05.prod.outlook.com (52.135.233.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.5; Thu, 11 Jul 2019 07:11:19 +0000 Received: from BYAPR05MB4776.namprd05.prod.outlook.com ([fe80::f493:3bba:aabf:dd58]) by BYAPR05MB4776.namprd05.prod.outlook.com ([fe80::f493:3bba:aabf:dd58%7]) with mapi id 15.20.2073.008; Thu, 11 Jul 2019 07:11:19 +0000 From: Nadav Amit To: Jiri Kosina CC: Peter Zijlstra , Xi Ruoyao , Thomas Gleixner , Kees Cook , Linus Torvalds , Ingo Molnar , Linux List Kernel Mailing , Borislav Petkov , Len Brown , Andrew Morton , "Rafael J. Wysocki" , Tony Luck , Bob Moore , Erik Schmauss , Josh Poimboeuf , Daniel Bristot de Oliveira Subject: Re: [GIT PULL] x86/topology changes for v5.3 Thread-Topic: [GIT PULL] x86/topology changes for v5.3 Thread-Index: AQHVNxtt0mU1kD//MEyJwVSBEnYucabD3RUDgAAKnYCAARnCAA== Date: Thu, 11 Jul 2019 07:11:19 +0000 Message-ID: <89EBC357-BEAC-4252-915F-E183C2D350C4@vmware.com> References: <201907091727.91CC6C72D8@keescook> <1ad2de95e694a29909801d022fe2d556df9a4bd5.camel@mengyan1223.wang> <768463eb26a2feb0fcc374fd7f9cc28b96976917.camel@mengyan1223.wang> <20190710134433.GN3402@hirez.programming.kicks-ass.net> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=namit@vmware.com; x-originating-ip: [38.119.166.65] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c1689d86-d5c2-4a25-ac94-08d705cef908 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:BYAPR05MB4743; x-ms-traffictypediagnostic: BYAPR05MB4743: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-forefront-prvs: 0095BCF226 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(396003)(136003)(376002)(366004)(346002)(189003)(199004)(53546011)(6506007)(6916009)(478600001)(81166006)(81156014)(54906003)(26005)(256004)(8936002)(6486002)(102836004)(6436002)(316002)(14454004)(6512007)(76176011)(33656002)(53936002)(5660300002)(2616005)(36756003)(64756008)(66946007)(7736002)(66476007)(76116006)(6116002)(71200400001)(68736007)(3846002)(7416002)(66556008)(2906002)(186003)(99286004)(71190400001)(6246003)(4326008)(86362001)(476003)(11346002)(66066001)(305945005)(8676002)(446003)(25786009)(486006)(66446008)(229853002);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR05MB4743;H:BYAPR05MB4776.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: sj4bB0ZLjPUFoJ2w85uSibgHjGH9g9Aj8rBk33VU+DTxzvwgizcbcgOR/UQue2GQTbGfK9R28zc8tBm2SWqbaDdO1Eh7KJJQCIlrHeyReJzN/zC+V+hjvnZ3KRRwABrpaJ9MLktntGLm0ra0NmQgWauh9dL4bHkMj8bIX/QbfCIVu4FWeFkMqhNBLjmOzKQud+Chtw/FyXwG0qAdfU7KDqF+18cU5N/AaHA+Nud5eJR0NPk5mCZx2fOZc8p61RWn62lZvGHo4ONPwDI77VctW83TJA5WslDprFhvkZkbY5gDfgDQvydgchJvSRSulEOWXi9RH81J8xyw7F+iN5NYGZnbvpjy40gjjiUaxHDLPwt0PQ6/JLo+FU+FQeBVptoKO8t24mzCwgqw0zAfbrGdWZgTh8l/G3AQ1DAFxwey4ts= Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1689d86-d5c2-4a25-ac94-08d705cef908 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jul 2019 07:11:19.4442 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: namit@vmware.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR05MB4743 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jul 10, 2019, at 7:22 AM, Jiri Kosina wrote: >=20 > On Wed, 10 Jul 2019, Peter Zijlstra wrote: >=20 >> If we mark the key as RO after init, and then try and modify the key to >> link module usage sites, things might go bang as described. >>=20 >> Thanks! >>=20 >>=20 >> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c >> index 27d7864e7252..5bf7a8354da2 100644 >> --- a/arch/x86/kernel/cpu/common.c >> +++ b/arch/x86/kernel/cpu/common.c >> @@ -366,7 +366,7 @@ static __always_inline void setup_umip(struct cpuinf= o_x86 *c) >> cr4_clear_bits(X86_CR4_UMIP); >> } >>=20 >> -DEFINE_STATIC_KEY_FALSE_RO(cr_pinning); >> +DEFINE_STATIC_KEY_FALSE(cr_pinning); >=20 > Good catch, I guess that is going to fix it. >=20 > At the same time though, it sort of destroys the original intent of Kees'= =20 > patch, right? The exploits will just have to call static_key_disable()=20 > prior to calling native_write_cr4() again, and the protection is gone. Even with DEFINE_STATIC_KEY_FALSE_RO(), I presume you can just call set_memory_rw(), make the page that holds the key writable, and then call static_key_disable(), followed by a call to native_write_cr4().=