From: tip-bot for Dave Hansen <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: dave@sr71.net, linux-kernel@vger.kernel.org, hpa@zytor.com,
mingo@kernel.org, dave.hansen@linux.intel.com,
mgorman@techsingularity.net, tglx@linutronix.de
Subject: [tip:mm/pkeys] x86/pkeys: Add fault handling for PF_PK page fault bit
Date: Fri, 9 Sep 2016 04:10:39 -0700 [thread overview]
Message-ID: <tip-e8c6226d483cb28f55cab718065ea1b7226d40e8@git.kernel.org> (raw)
In-Reply-To: <20160729163010.DD1FE1ED@viggo.jf.intel.com>
Commit-ID: e8c6226d483cb28f55cab718065ea1b7226d40e8
Gitweb: http://git.kernel.org/tip/e8c6226d483cb28f55cab718065ea1b7226d40e8
Author: Dave Hansen <dave.hansen@linux.intel.com>
AuthorDate: Fri, 29 Jul 2016 09:30:10 -0700
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 9 Sep 2016 13:02:26 +0200
x86/pkeys: Add fault handling for PF_PK page fault bit
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>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: linux-arch@vger.kernel.org
Cc: Dave Hansen <dave@sr71.net>
Cc: arnd@arndb.de
Cc: linux-api@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: luto@kernel.org
Cc: akpm@linux-foundation.org
Cc: torvalds@linux-foundation.org
Link: http://lkml.kernel.org/r/20160729163010.DD1FE1ED@viggo.jf.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/mm/fault.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index dc80230..b88d8ac 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1112,6 +1112,15 @@ access_error(unsigned long error_code, struct vm_area_struct *vma)
{
/* 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
next prev parent reply other threads:[~2016-09-09 11:12 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-29 16:30 [PATCH 00/10] [v6] System Calls for Memory Protection Keys Dave Hansen
2016-07-29 16:30 ` [PATCH 01/10] x86, pkeys: add fault handling for PF_PK page fault bit Dave Hansen
2016-09-09 11:10 ` tip-bot for Dave Hansen [this message]
2016-07-29 16:30 ` [PATCH 02/10] mm: implement new pkey_mprotect() system call Dave Hansen
2016-09-09 11:11 ` [tip:mm/pkeys] mm: Implement " tip-bot for Dave Hansen
2016-07-29 16:30 ` [PATCH 03/10] x86, pkeys: make mprotect_key() mask off additional vm_flags Dave Hansen
2016-09-09 11:11 ` [tip:mm/pkeys] x86/pkeys: Make " tip-bot for Dave Hansen
2016-07-29 16:30 ` [PATCH 04/10] x86, pkeys: allocation/free syscalls Dave Hansen
2016-09-09 11:12 ` [tip:mm/pkeys] x86/pkeys: Allocation/free syscalls tip-bot for Dave Hansen
2016-07-29 16:30 ` [PATCH 05/10] x86: wire up protection keys system calls Dave Hansen
2016-09-09 11:12 ` [tip:mm/pkeys] x86: Wire " tip-bot for Dave Hansen
2016-07-29 16:30 ` [PATCH 06/10] generic syscalls: wire up memory protection keys syscalls Dave Hansen
2016-09-09 11:12 ` [tip:mm/pkeys] generic syscalls: Wire " tip-bot for Dave Hansen
2016-07-29 16:30 ` [PATCH 07/10] pkeys: add details of system call use to Documentation/ Dave Hansen
2016-09-09 11:13 ` [tip:mm/pkeys] pkeys: Add " tip-bot for Dave Hansen
2016-07-29 16:30 ` [PATCH 08/10] x86, pkeys: default to a restrictive init PKRU Dave Hansen
2016-07-29 17:29 ` Andy Lutomirski
2016-07-29 17:50 ` Dave Hansen
2016-07-29 19:44 ` Andy Lutomirski
2016-08-01 14:42 ` Vlastimil Babka
2016-08-01 14:58 ` Dave Hansen
2016-08-02 8:20 ` Vlastimil Babka
2016-09-09 11:13 ` [tip:mm/pkeys] x86/pkeys: Default " tip-bot for Dave Hansen
2016-07-29 16:30 ` [PATCH 09/10] x86, pkeys: allow configuration of init_pkru Dave Hansen
2016-08-02 8:28 ` Vlastimil Babka
2016-08-02 14:37 ` Dave Hansen
2016-09-09 11:14 ` [tip:mm/pkeys] x86/pkeys: Allow " tip-bot for Dave Hansen
2016-07-29 16:30 ` [PATCH 10/10] x86, pkeys: add self-tests Dave Hansen
2016-09-09 11:14 ` [tip:mm/pkeys] x86/pkeys: Add self-tests tip-bot for Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-e8c6226d483cb28f55cab718065ea1b7226d40e8@git.kernel.org \
--to=tipbot@zytor.com \
--cc=dave.hansen@linux.intel.com \
--cc=dave@sr71.net \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mgorman@techsingularity.net \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox