Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1438595

[PATCH 1/9] x86, pkeys: add fault handling for PF_PK page fault bit

From Dave Hansen <dave@sr71.net>
Newsgroups linux.kernel
Subject [PATCH 1/9] x86, pkeys: add fault handling for PF_PK page fault bit
Date 2016-07-07 15:00 +0200
Message-ID <rSh4l-71b-27@gated-at.bofh.it> (permalink)
References <rSgUF-6Xx-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Dave Hansen <dave.hansen@linux.intel.com>

PF_PK means that a memory access violated the protection key
access restrictions.  It is unconditionally an access_error()
because the permissions set on the VMA don't matter (the PKRU
value overrides it), and we never "resolve" PK faults (like
how a COW can "resolve write fault).

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: linux-api@vger.kernel.org
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: x86@kernel.org
Cc: torvalds@linux-foundation.org
Cc: akpm@linux-foundation.org
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: mgorman@techsingularity.net
Cc: hughd@google.com
Cc: viro@zeniv.linux.org.uk
---

 b/arch/x86/mm/fault.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff -puN arch/x86/mm/fault.c~pkeys-105-add-pk-to-fault arch/x86/mm/fault.c
--- a/arch/x86/mm/fault.c~pkeys-105-add-pk-to-fault	2016-07-07 05:46:59.554745699 -0700
+++ b/arch/x86/mm/fault.c	2016-07-07 05:46:59.558745881 -0700
@@ -1112,6 +1112,15 @@ access_error(unsigned long error_code, s
 {
 	/* This is only called for the current mm, so: */
 	bool foreign = false;
+
+	/*
+	 * Read or write was blocked by protection keys.  This is
+	 * always an unconditional error and can never result in
+	 * a follow-up action to resolve the fault, like a COW.
+	 */
+	if (error_code & PF_PK)
+		return 1;
+
 	/*
 	 * Make sure to check the VMA so that we do not perform
 	 * faults just to hit a PF_PK as soon as we fill in a
_

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/9] [REVIEW-REQUEST] [v4] System Calls for Memory Protection Keys Dave Hansen <dave@sr71.net> - 2016-07-07 14:50 +0200
  [PATCH 8/9] pkeys: add details of system call use to Documentation/ Dave Hansen <dave@sr71.net> - 2016-07-07 14:50 +0200
  [PATCH 1/9] x86, pkeys: add fault handling for PF_PK page fault bit Dave Hansen <dave@sr71.net> - 2016-07-07 15:00 +0200
    Re: [PATCH 1/9] x86, pkeys: add fault handling for PF_PK page fault  bit Mel Gorman <mgorman@techsingularity.net> - 2016-07-07 16:50 +0200
      Re: [PATCH 1/9] x86, pkeys: add fault handling for PF_PK page fault  bit Dave Hansen <dave@sr71.net> - 2016-07-07 17:50 +0200
  Re: [PATCH 0/9] [REVIEW-REQUEST] [v4] System Calls for Memory  Protection Keys Mel Gorman <mgorman@techsingularity.net> - 2016-07-07 16:50 +0200
  Re: [PATCH 0/9] [REVIEW-REQUEST] [v4] System Calls for Memory  Protection Keys Hugh Dickins <hughd@google.com> - 2016-07-08 20:40 +0200

csiph-web