From: Khalid Aziz <khalid.aziz@oracle.com>
To: akpm@linux-foundation.org, dave.hansen@linux.intel.com
Cc: Khalid Aziz <khalid.aziz@oracle.com>,
mhocko@suse.com, davem@davemloft.net, jack@suse.cz,
kirill.shutemov@linux.intel.com, ross.zwisler@linux.intel.com,
lstoakes@gmail.com, dave.jiang@intel.com, willy@infradead.org,
hughd@google.com, ying.huang@intel.com, tglx@linutronix.de,
mgorman@suse.de, aarcange@redhat.com, ak@linux.intel.com,
aneesh.kumar@linux.vnet.ibm.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org,
Khalid Aziz <khalid@gonehiking.org>
Subject: [PATCH v7 8/9] mm: Clear arch specific VM flags on protection change
Date: Wed, 9 Aug 2017 15:26:01 -0600 [thread overview]
Message-ID: <8474c263daa5c8f7c72eb24dda0014bacb11f81c.1502219353.git.khalid.aziz@oracle.com> (raw)
In-Reply-To: <cover.1502219353.git.khalid.aziz@oracle.com>
In-Reply-To: <cover.1502219353.git.khalid.aziz@oracle.com>
When protection bits are changed on a VMA, some of the architecture
specific flags should be cleared as well. An examples of this are the
PKEY flags on x86. This patch expands the current code that clears PKEY
flags for x86, to support similar functionality for other architectures
as well.
Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Cc: Khalid Aziz <khalid@gonehiking.org>
---
v7:
- new patch
include/linux/mm.h | 6 ++++++
mm/mprotect.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 6f543a47fc92..b7aa3932e6d4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -271,6 +271,12 @@ extern unsigned int kobjsize(const void *objp);
/* This mask is used to clear all the VMA flags used by mlock */
#define VM_LOCKED_CLEAR_MASK (~(VM_LOCKED | VM_LOCKONFAULT))
+/* Arch-specific flags to clear when updating VM flags on protection change */
+#ifndef VM_ARCH_CLEAR
+# define VM_ARCH_CLEAR VM_NONE
+#endif
+#define VM_FLAGS_CLEAR (ARCH_VM_PKEY_FLAGS | VM_ARCH_CLEAR)
+
/*
* mapping from the currently active vm_flags protection bits (the
* low four bits) to a page protection mask..
diff --git a/mm/mprotect.c b/mm/mprotect.c
index beac2dfbb5fa..b1ec9902dcd6 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -454,7 +454,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len,
* cleared from the VMA.
*/
mask_off_old_flags = VM_READ | VM_WRITE | VM_EXEC |
- ARCH_VM_PKEY_FLAGS;
+ VM_FLAGS_CLEAR;
new_vma_pkey = arch_override_mprotect_pkey(vma, prot, pkey);
newflags = calc_vm_prot_bits(prot, new_vma_pkey);
--
2.11.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-08-09 21:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-09 21:25 [PATCH v7 0/9] Application Data Integrity feature introduced by SPARC M7 Khalid Aziz
2017-08-09 21:25 ` [PATCH v7 2/9] mm, swap: Add infrastructure for saving page metadata on swap Khalid Aziz
2017-08-16 4:53 ` David Miller
2017-08-16 14:34 ` Khalid Aziz
2017-08-09 21:26 ` [PATCH v7 7/9] mm: Add address parameter to arch_validate_prot() Khalid Aziz
2017-08-10 13:20 ` Michael Ellerman
2017-08-10 14:41 ` Khalid Aziz
2017-08-15 5:02 ` Michael Ellerman
2017-08-15 14:32 ` Khalid Aziz
2017-08-09 21:26 ` Khalid Aziz [this message]
2017-08-09 21:26 ` [PATCH v7 9/9] sparc64: Add support for ADI (Application Data Integrity) Khalid Aziz
2017-08-16 4:58 ` David Miller
2017-08-16 14:44 ` Khalid Aziz
2017-08-25 22:31 ` Anthony Yznaga
2017-08-30 22:27 ` Khalid Aziz
2017-08-30 22:38 ` David Miller
2017-08-30 23:23 ` Khalid Aziz
2017-08-31 0:09 ` David Miller
2017-08-31 16:38 ` Khalid Aziz
2017-09-01 5:38 ` Anthony Yznaga
2017-09-04 16:25 ` Pavel Machek
2017-09-05 21:44 ` David Miller
2017-09-06 22:32 ` Pavel Machek
2017-09-08 12:18 ` Steven Sistare
2017-09-06 14:10 ` Khalid Aziz
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=8474c263daa5c8f7c72eb24dda0014bacb11f81c.1502219353.git.khalid.aziz@oracle.com \
--to=khalid.aziz@oracle.com \
--cc=aarcange@redhat.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=dave.hansen@linux.intel.com \
--cc=dave.jiang@intel.com \
--cc=davem@davemloft.net \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=khalid@gonehiking.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lstoakes@gmail.com \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=ross.zwisler@linux.intel.com \
--cc=sparclinux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=willy@infradead.org \
--cc=ying.huang@intel.com \
/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