Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp308016pxb; Fri, 22 Apr 2022 00:58:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXerCc/cXI5EXVvP9VysCZZ6oyoaxwrzF7Uy1MwIrCdyJMH+7sGYKeL75f6S4Q1T7uVzWf X-Received: by 2002:a05:6402:528c:b0:425:ab33:7b6b with SMTP id en12-20020a056402528c00b00425ab337b6bmr3445594edb.49.1650614325374; Fri, 22 Apr 2022 00:58:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650614325; cv=none; d=google.com; s=arc-20160816; b=FNBLlutIZRziSEGgy3j33URByfYK8vK/zrAGALLMx050/+tRhz5vpo6xKJSdw3mXwQ ey7xcY0bMmTeTCHWoyvAT6oE4C4drRYWwI9VkCACkDYr7ZtFz6hvjg38+T33/VR/iXf4 c/aO7TCcwB1KWix/cHGlhrXk+4LbYh34wFZg4U7KrA6aoQweWTp7SF7KfSlmaja0r9EO cpGsMWHxiDplv6fueeq9VkEXKbuNHJiY2L3CbLd6ypCfL1IgS/XTjFZ3oSpByCfp832P CeBRS/8NCMTvWfVB+Z+8jjRNpxafcLTKFNH8EIcQiivRm/BlUwHcEWCPLgp3eFvkoNCh iwCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o6NbYQJZ+PdFMNHhRou8fvUlPo4UXgbwroLHHCTyryQ=; b=yZBU3YAZU0cJ1U7dHfmd13NLqhS2dsLR1bIwlqzMB7lTyF8bo5v2C9j54XttUnpD9y q0x7W3pzQaADLVUG9xAnu0o2dEnQ2RvHvE1mqDSPmRJvifrYBWBE0q0pQy4H47yFm6mr gLP+MGuXSNohY+D05i19javwNJDEdVxe6CVJJC5yaaNmztyQpb6nRXDxUSAT/ggh4drv mBD+Li+TEJ3r8VxHjbNrBfBwM7ZeW3/SJ03g77P+3iW8p/oV/7XI8tIPkb2P3N1brbol wt+QDDLY/SUIJ7CSGKckLGsb8xe50N6y/VhAd3SbgndBFX6dLVNimIH1ewHpzF7p2yeX WKKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZVSM1sGm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020a17090629c100b006f014a2d8e4si3515079eje.646.2022.04.22.00.58.21; Fri, 22 Apr 2022 00:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZVSM1sGm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355581AbiDSRJr (ORCPT + 99 others); Tue, 19 Apr 2022 13:09:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355357AbiDSRJg (ORCPT ); Tue, 19 Apr 2022 13:09:36 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F555FF7 for ; Tue, 19 Apr 2022 10:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650388013; x=1681924013; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4kg96elYopHb8G+ADzcmCb8Kh5ugzUamsq/2aa+YD4w=; b=ZVSM1sGmAxhpfn5iglGqwXYe/CCOwcVrab2Q0ZRjLKo1W4BoeMsc09mr DvqS3ffSnJHCzl6Vq7hvKoa6h7kPtH7LtF0uoJAdZlndYN1bVNLrqggBp BrpRmQE4+nHitsqakA6Qm2GX1k4W69uDAZYJXY9MMeqH5Yu6wKKizaCSy 1H72YFRFufuRZJd6rH0Bxd90kn0S4JGbfiFFF73ke5wgwTWaDWjz58J/H TAV6S/oisr6CvW+F9OIpNbySVYvaiDcpn0TQA22m46z4cNfaCqO3RWrlW bal1GWWUdbZ6zjcUpjea0Ug9NrMS/+dVqYEhsqAv6G8tZ2b/MiMSlkekz Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10322"; a="350267538" X-IronPort-AV: E=Sophos;i="5.90,273,1643702400"; d="scan'208";a="350267538" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 10:06:53 -0700 X-IronPort-AV: E=Sophos;i="5.90,273,1643702400"; d="scan'208";a="727145490" Received: from ajacosta-mobl1.amr.corp.intel.com (HELO localhost) ([10.212.11.4]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 10:06:51 -0700 From: ira.weiny@intel.com To: Dave Hansen , "H. Peter Anvin" , Dan Williams Cc: Ira Weiny , Fenghua Yu , Rick Edgecombe , "Shankar, Ravi V" , linux-kernel@vger.kernel.org Subject: [PATCH V10 01/44] Documentation/protection-keys: Clean up documentation for User Space pkeys Date: Tue, 19 Apr 2022 10:06:06 -0700 Message-Id: <20220419170649.1022246-2-ira.weiny@intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220419170649.1022246-1-ira.weiny@intel.com> References: <20220419170649.1022246-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Ira Weiny 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. Cc: "Moger, Babu" Signed-off-by: Ira Weiny --- Changes for V9: use pkey Change information on which CPU's have PKU --- 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 ec575e72d0b2..bf28ac0401f3 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 ======== -- 2.35.1