From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 B69CAC433B4 for ; Thu, 6 May 2021 00:00:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2E0DA613C0 for ; Thu, 6 May 2021 00:00:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E0DA613C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AB39D6B006C; Wed, 5 May 2021 20:00:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A29D56B006E; Wed, 5 May 2021 20:00:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A35B6B0070; Wed, 5 May 2021 20:00:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id 68D496B006C for ; Wed, 5 May 2021 20:00:19 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 17D99824999B for ; Thu, 6 May 2021 00:00:19 +0000 (UTC) X-FDA: 78108848958.11.89B3318 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf14.hostedemail.com (Postfix) with ESMTP id A5CFCC001C75 for ; Wed, 5 May 2021 23:59:55 +0000 (UTC) IronPort-SDR: peXRFen0uBSTWIOjw5RLrz6fBU3xYj/YjoPELsnfDRzB/69t+776JrAUdN8Pv7pxUIEBJKoD0O rCvWbyfT+LKA== X-IronPort-AV: E=McAfee;i="6200,9189,9975"; a="197969454" X-IronPort-AV: E=Sophos;i="5.82,276,1613462400"; d="scan'208";a="197969454" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2021 17:00:13 -0700 IronPort-SDR: MiDK5L27NDfnkfqXtcDSsGy9F7Qhs4bjmOfsa/ErInC4zma1y9qyA9ODJsTla/3FvmBKW0Hy6q GDYgAOEtWbKw== X-IronPort-AV: E=Sophos;i="5.82,276,1613462400"; d="scan'208";a="430179714" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2021 17:00:13 -0700 Date: Wed, 5 May 2021 17:00:13 -0700 From: Ira Weiny To: Kees Cook Cc: Rick Edgecombe , dave.hansen@intel.com, luto@kernel.org, peterz@infradead.org, linux-mm@kvack.org, x86@kernel.org, akpm@linux-foundation.org, linux-hardening@vger.kernel.org, kernel-hardening@lists.openwall.com, rppt@kernel.org, dan.j.williams@intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC 0/9] PKS write protected page tables Message-ID: <20210506000013.GE1068722@iweiny-DESK2.sc.intel.com> References: <20210505003032.489164-1-rick.p.edgecombe@intel.com> <202105042253.ECBBF6B6@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <202105042253.ECBBF6B6@keescook> User-Agent: Mutt/1.11.1 (2018-12-01) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=none (imf14.hostedemail.com: domain of ira.weiny@intel.com has no SPF policy when checking 192.55.52.115) smtp.mailfrom=ira.weiny@intel.com; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none) X-Rspamd-Server: rspam03 X-Stat-Signature: yep3wr1qi6cpjqkb7dctojrsbm9wt3wn X-Rspamd-Queue-Id: A5CFCC001C75 Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf14; identity=mailfrom; envelope-from=""; helo=mga14.intel.com; client-ip=192.55.52.115 X-HE-DKIM-Result: none/none X-HE-Tag: 1620259195-333508 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, May 04, 2021 at 11:25:31PM -0700, Kees Cook wrote: > On Tue, May 04, 2021 at 05:30:23PM -0700, Rick Edgecombe wrote: >=20 > > Performance impacts > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > Setting direct map permissions on whatever random page gets allocated= for a=20 > > page table would result in a lot of kernel range shootdowns and direc= t map=20 > > large page shattering. So the way the PKS page table memory is create= d is=20 > > similar to this module page clustering series[2], where a cache of pa= ges is=20 > > replenished from 2MB pages such that the direct map permissions and a= ssociated=20 > > breakage is localized on the direct map. In the PKS page tables case,= a PKS=20 > > key is pre-applied to the direct map for pages in the cache. > >=20 > > There would be some costs of memory overhead in order to protect the = direct=20 > > map page tables. There would also be some extra kernel range shootdow= ns to=20 > > replenish the cache on occasion, from setting the PKS key on the dire= ct map of=20 > > the new pages. I don=E2=80=99t have any actual performance data yet. >=20 > What CPU models are expected to have PKS? Supervisor Memory Protection Keys (PKS) is a feature which is found on In= tel=E2=80=99s Sapphire Rapids (and later) =E2=80=9CScalable Processor=E2=80=9D Server C= PUs. It will also be available in future non-server Intel parts. Also qemu has some support as well. https://www.qemu.org/2021/04/30/qemu-6-0-0/ Ira