Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2212072iof; Tue, 7 Jun 2022 23:21:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFq7++doEM4zbKGMSSSkf555sGdItoJSGXm1qS8z2dFFE2tRDcm86LgMqJeccdO3NQllaF X-Received: by 2002:a65:694b:0:b0:3fb:d31a:a850 with SMTP id w11-20020a65694b000000b003fbd31aa850mr28322079pgq.15.1654669290172; Tue, 07 Jun 2022 23:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654669290; cv=none; d=google.com; s=arc-20160816; b=hN5NbnXqwhhRNq/kJ2oQWA5mtqeLnDF55ETeeQ09x5rJ3ROgAKuWHhB9KKjSjobD6f 9ADiZpnax6anVGS/IGqwHi74hW7QlbXRLwPIqArSaks0MU0EarHZjeP4o8i4L8uhPGiM 6FqtjwmJ9g1e6ZLJAaU1zkfjgfBZPpBFANI2mKtm82s6YbnvNbeKvUu0cUb4Ma5BQraw V0Er0u7XWcQLeEVnX+8eZk4bm3+81HFfn6YCAEdi3Qf31IqPmYkHm/HkZGyLmTWNEp/r FQSiqiuggdpqopQiHfbcqSjx59lO7W8x9+jkRqYgumL6cjkmxLR8t4CKIUCP+Y3388+Y SpiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=31knJ3QXB3grtazMt+b9bY3U/ZDckeFhNjGn1EuvTFE=; b=rzE94LVuKjeB6rCPyOTJ3L3OvEIRsOzWD+fAJOmHPEf9j1rIGvzrhnel26hT86+aAp x7qjaGmjDjfbIhtwkaHgg7yIMGHumgVy768/M3H6pEDiD4fAtJScBUoajCEjY3WadLqi ldIJkVaAzn44o7GjfLkhp2WSvazdKE2zVYYW4wHMgBo82+LQ/CX1VXSIUAJJIge8R8mM jfA7JT5b5+Y45RgVURfE9A91QfrCXGt50DTWgS8rrMscHP9nhYejkY3N0QvcsIcgLLwU eeunDLc3Y98aR0NnnJJmNi4cbeAD3/O9/sB+YiKpDrcARlu248m8WKMUSty/Y18CWaNk SX3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MJl5K8k3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bb17-20020a17090b009100b001e337b211e4si23538953pjb.15.2022.06.07.23.21.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:21:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MJl5K8k3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7BCB925382E; Tue, 7 Jun 2022 22:42:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443400AbiFHCCW (ORCPT + 99 others); Tue, 7 Jun 2022 22:02:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1588471AbiFGXyl (ORCPT ); Tue, 7 Jun 2022 19:54:41 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9954DEAB87; Tue, 7 Jun 2022 16:09:57 -0700 (PDT) Date: Tue, 07 Jun 2022 23:09:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1654643395; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=31knJ3QXB3grtazMt+b9bY3U/ZDckeFhNjGn1EuvTFE=; b=MJl5K8k3SMYaWkE2ICZFiDKbyUZBhahVnqp8FEBFA6di3TbE7fD/a4SnWV9ApTYPUJFP54 zRVLyR2ao8emN+QzJWwhVPo506TqscDDCAexUiVGC9TcAkPrExJ037JOhMycGB2EVh++Yl v+SL6c/1Az5w3dSEH09U4cj7w184tsSQaIfC45WFQgyv+13YUgZ7EeX9jeXyjLh+fFEvlZ cKXzW30wKK8m5FxwjQIhnqAKGTzDKEk+d4McQa3FgIiJjBZqCAxjGnkW3b6SneXpm//ElP Qcsl4NKs47N6Hp0BpFEiyXj8REFihViFgDY9LMgFo5Y3+LM7JxR/nebANOx40A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1654643395; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=31knJ3QXB3grtazMt+b9bY3U/ZDckeFhNjGn1EuvTFE=; b=HjKXp4gN6EUcqfASdXpyxbNTMkYrFFF/GNXtIJ2YNPgW76mBis3OVoy0Jh7VVMJTpICXPO UuoY4aA9fIvGneBQ== From: "tip-bot2 for Ira Weiny" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] Documentation/protection-keys: Clean up documentation for User Space pkeys Cc: Ira Weiny , Dave Hansen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220419170649.1022246-2-ira.weiny@intel.com> References: <20220419170649.1022246-2-ira.weiny@intel.com> MIME-Version: 1.0 Message-ID: <165464339351.4207.13791430848488231130.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/mm branch of tip: Commit-ID: f8c1d4ca55177326adad1fdc6bf602423a507542 Gitweb: https://git.kernel.org/tip/f8c1d4ca55177326adad1fdc6bf602423a507542 Author: Ira Weiny AuthorDate: Tue, 19 Apr 2022 10:06:06 -07:00 Committer: Dave Hansen CommitterDate: Tue, 07 Jun 2022 16:06:22 -07:00 Documentation/protection-keys: Clean up documentation for User Space pkeys The documentation for user space pkeys was a bit dated including things such as Amazon and distribution testing information which is irrelevant now. Update the documentation. This also streamlines adding the Supervisor pkey documentation later on. Signed-off-by: Ira Weiny Signed-off-by: Dave Hansen Link: https://lkml.kernel.org/r/20220419170649.1022246-2-ira.weiny@intel.com --- Documentation/core-api/protection-keys.rst | 44 ++++++++++----------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/Documentation/core-api/protection-keys.rst b/Documentation/core-api/protection-keys.rst index ec575e7..bf28ac0 100644 --- a/Documentation/core-api/protection-keys.rst +++ b/Documentation/core-api/protection-keys.rst @@ -4,31 +4,29 @@ Memory Protection Keys ====================== -Memory Protection Keys for Userspace (PKU aka PKEYs) is a feature -which is found on Intel's Skylake (and later) "Scalable Processor" -Server CPUs. It will be available in future non-server Intel parts -and future AMD processors. - -For anyone wishing to test or use this feature, it is available in -Amazon's EC2 C5 instances and is known to work there using an Ubuntu -17.04 image. - -Memory Protection Keys provides a mechanism for enforcing page-based -protections, but without requiring modification of the page tables -when an application changes protection domains. It works by -dedicating 4 previously ignored bits in each page table entry to a -"protection key", giving 16 possible keys. - -There is also a new user-accessible register (PKRU) with two separate -bits (Access Disable and Write Disable) for each key. Being a CPU -register, PKRU is inherently thread-local, potentially giving each +Memory Protection Keys provide a mechanism for enforcing page-based +protections, but without requiring modification of the page tables when an +application changes protection domains. + +Pkeys Userspace (PKU) is a feature which can be found on: + * Intel server CPUs, Skylake and later + * Intel client CPUs, Tiger Lake (11th Gen Core) and later + * Future AMD CPUs + +Pkeys work by dedicating 4 previously Reserved bits in each page table entry to +a "protection key", giving 16 possible keys. + +Protections for each key are defined with a per-CPU user-accessible register +(PKRU). Each of these is a 32-bit register storing two bits (Access Disable +and Write Disable) for each of 16 keys. + +Being a CPU register, PKRU is inherently thread-local, potentially giving each thread a different set of protections from every other thread. -There are two new instructions (RDPKRU/WRPKRU) for reading and writing -to the new register. The feature is only available in 64-bit mode, -even though there is theoretically space in the PAE PTEs. These -permissions are enforced on data access only and have no effect on -instruction fetches. +There are two instructions (RDPKRU/WRPKRU) for reading and writing to the +register. The feature is only available in 64-bit mode, even though there is +theoretically space in the PAE PTEs. These permissions are enforced on data +access only and have no effect on instruction fetches. Syscalls ========