Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4313380pxb; Tue, 31 Aug 2021 01:57:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs3rssmeYcU3Nff5eQeBVLQn+HoDglv6UkEnHZRYhwB434gquYWtElbfv+PDdWZiUxje1H X-Received: by 2002:a92:cc01:: with SMTP id s1mr20813863ilp.15.1630400232319; Tue, 31 Aug 2021 01:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630400232; cv=none; d=google.com; s=arc-20160816; b=JK1oUPeNHOn8uMnU2tu/tG8y39KaNkB+gRCHDR/WzAxvXT+oILQKVx7cqMXzCXA/+j iaN44cfNUZDx+cv6P1ZbKMZFniyoRxRLaRYpYPd01EPos6DqWRjcZFtZa/KbttHauyun 4lHrrYx5tUjnne0lv4M20cLnfeWcYiYXDCyazSKdaOVLrRxO3YC/VaU9BFjMcWGcGfvi Lr7sEOPvhz3GxuwiM6VBsc8O6jk+qCeU/j+975t1thw9IXp5PxdOESiNvXEqMGfKW/6f b0Oef6WuJ4kcfjmzddZYc9h8tffXxWwOP0dWqcZhtS/7GIuZCwqP1odoJ0pv5mJK1hhE 0zjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yEJL8S0Fzyxcd3UToXMibBWzbd7c+Ed3rzaq+y5KPA4=; b=n1Cksy0c+DaLLbnsHMdhgEd/F8nApi6k4htnIKfAo3fODzZh4Ui7Y5/pi64dJmwDrr aO85UxD5eXZf5lJQN32vBZukXdLgmtsTYwrGcrIasSNUFjRRUna3RqStMQFAylZbM8ba 8chVQ45WLj18F5XkS5/w0hz5u8wMVYRwZPlfOduq7u+zUcQCLOgWBopq+uANUsHFucKH nLeiCJP0QceiTP6UJ7i1rkPlCMWTRCDnmAhkGiHmYtEncyY/84N2Vs7H3nuBbTO+DQeV 5BuZghlufn8jdB4XCUMyjXfV2Bqz9+VNIp2wVJgro5mMt3xESS6Cje7ojCq11g7R3AQ5 S+hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H1UsoCB6; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f11si17172802iok.80.2021.08.31.01.57.01; Tue, 31 Aug 2021 01:57:12 -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=k20201202 header.b=H1UsoCB6; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240493AbhHaI5J (ORCPT + 99 others); Tue, 31 Aug 2021 04:57:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:40070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240455AbhHaI5I (ORCPT ); Tue, 31 Aug 2021 04:57:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 69E3E6023F; Tue, 31 Aug 2021 08:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630400173; bh=DNUygxTSAI95z0kYhGZBnpsWktfjbuKT8jy5wGbbaVE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H1UsoCB6olqAwXiqi6JHq0icYTheLspJKQ9mo4xFG0W/ZEVDGIdL8iQZ+z45Iv6GL lzSGekgjp++HeYdByKsCFII+ru1eFXNlPMPNCY35SMiVQIvxVq5YaSwpngidGiZbfd lJf1wVIGGEYgBo5iL/QmstQ0PmnHGazxVMStZyS4gGcjsffFfnLwd/30yCuq93GTRH Zga0Lh7fLX3yVrdNzuwBbDOScFpEryOXSpO52gYHSSuVmkSY0kGXAETznpR+7bpN24 v9ZgNhueXN6LJys1c9Ui4Unq6JyK+ZT5F7fr2Wn+DHUB35LAS9D8jvbwcqk3vjogwO 0NdNuHR1ekgJA== Date: Tue, 31 Aug 2021 11:56:06 +0300 From: Mike Rapoport To: Rick Edgecombe Cc: dave.hansen@intel.com, luto@kernel.org, peterz@infradead.org, x86@kernel.org, akpm@linux-foundation.org, keescook@chromium.org, shakeelb@google.com, vbabka@suse.cz, linux-mm@kvack.org, linux-hardening@vger.kernel.org, kernel-hardening@lists.openwall.com, ira.weiny@intel.com, dan.j.williams@intel.com, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 16/19] x86/mm: Protect page tables with PKS Message-ID: References: <20210830235927.6443-1-rick.p.edgecombe@intel.com> <20210830235927.6443-17-rick.p.edgecombe@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210830235927.6443-17-rick.p.edgecombe@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 30, 2021 at 04:59:24PM -0700, Rick Edgecombe wrote: > Write protect page tables with PKS. Toggle writeability inside the > pgtable.h defined page table modifiction functions. > > Do not protect the direct map page tables as it is more complicated and > will come in a later patch. > > Signed-off-by: Rick Edgecombe > --- > arch/x86/boot/compressed/ident_map_64.c | 5 ++ > arch/x86/include/asm/pgtable.h | 18 ++++++- > arch/x86/include/asm/pgtable_64.h | 33 ++++++++++-- > arch/x86/include/asm/pkeys_common.h | 1 - > arch/x86/mm/pgtable.c | 71 ++++++++++++++++++++++--- > arch/x86/mm/pkeys.c | 1 + > include/linux/pkeys.h | 1 + > mm/Kconfig | 6 +++ > 8 files changed, 123 insertions(+), 13 deletions(-) ... > diff --git a/mm/Kconfig b/mm/Kconfig > index 4184d0a7531d..0f8e8595a396 100644 > --- a/mm/Kconfig > +++ b/mm/Kconfig > @@ -845,6 +845,12 @@ config ARCH_ENABLE_SUPERVISOR_PKEYS > def_bool y > depends on PKS_TEST || GENERAL_PKS_USER > > +config PKS_PG_TABLES > + bool "PKS write protected page tables" > + select GENERAL_PKS_USER > + depends on !HIGHMEM && !X86_PAE && SPARSEMEM_VMEMMAP Hmm, why is this x86-only feature is in mm/Kconfig? > + depends on ARCH_HAS_SUPERVISOR_PKEYS > + > config PERCPU_STATS > bool "Collect percpu memory statistics" > help > -- > 2.17.1 > -- Sincerely yours, Mike.