Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754354AbcJDQjP (ORCPT ); Tue, 4 Oct 2016 12:39:15 -0400 Received: from mga07.intel.com ([134.134.136.100]:53519 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752583AbcJDQjN (ORCPT ); Tue, 4 Oct 2016 12:39:13 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,444,1473145200"; d="scan'208";a="1066025565" Subject: [PATCH] x86/pkeys: Update documentation To: linux-kernel@vger.kernel.org Cc: Dave Hansen , dave.hansen@intel.com, x86@kernel.org, corbet@lwn.net, linux-doc@vger.kernel.org From: Dave Hansen Date: Tue, 04 Oct 2016 09:38:57 -0700 Message-Id: <20161004163857.71E0D6F6@viggo.jf.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2247 Lines: 55 From: Dave Hansen There are a few items that have gotten stale in the protection keys documentation. The config option description only applied to the execute-only support and is not accurate for the current code. There was also a typo with the number of system calls. I also wanted to call out that pkey_set() is not a kernel-provided facility, and where to find an implementation. Signed-off-by: Dave Hansen Cc: x86@kernel.org Cc: Jonathan Corbet Cc: linux-doc@vger.kernel.org --- b/Documentation/x86/protection-keys.txt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff -puN Documentation/x86/protection-keys.txt~pkeys-docfix Documentation/x86/protection-keys.txt --- a/Documentation/x86/protection-keys.txt~pkeys-docfix 2016-10-04 09:31:01.361928429 -0700 +++ b/Documentation/x86/protection-keys.txt 2016-10-04 09:32:39.142383585 -0700 @@ -20,7 +20,7 @@ instruction fetches. =========================== Syscalls =========================== -There are 2 system calls which directly interact with pkeys: +There are 3 system calls which directly interact with pkeys: int pkey_alloc(unsigned long flags, unsigned long init_access_rights) int pkey_free(int pkey); @@ -52,6 +52,10 @@ is no longer in use: munmap(ptr, PAGE_SIZE); pkey_free(pkey); +(Note: pkey_set() is a wrapper for the RDPKRU and WRPKRU instructions. + An example implementation can be found in + tools/testing/selftests/x86/protection_keys.c) + =========================== Behavior =========================== The kernel attempts to make protection keys consistent with the @@ -79,11 +83,3 @@ with a read(): The kernel will send a SIGSEGV in both cases, but si_code will be set to SEGV_PKERR when violating protection keys versus SEGV_ACCERR when the plain mprotect() permissions are violated. - -=========================== Config Option =========================== - -This config option adds approximately 1.5kb of text. and 50 bytes of -data to the executable. A workload which does large O_DIRECT reads -of holes in XFS files was run to exercise get_user_pages_fast(). No -performance delta was observed with the config option -enabled or disabled. _