lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e4656969f15fe0b43135b6e3f301695b77c885fc.1510768775.git.khalid.aziz@oracle.com>
Date:   Thu, 16 Nov 2017 07:38:31 -0700
From:   Khalid Aziz <khalid.aziz@...cle.com>
To:     akpm@...ux-foundation.org, davem@...emloft.net,
        dave.hansen@...ux.intel.com
Cc:     Khalid Aziz <khalid.aziz@...cle.com>, mhocko@...e.com,
        jack@...e.cz, kirill.shutemov@...ux.intel.com,
        ross.zwisler@...ux.intel.com, lstoakes@...il.com,
        dave.jiang@...el.com, willy@...radead.org, hughd@...gle.com,
        ying.huang@...el.com, n-horiguchi@...jp.nec.com,
        heiko.carstens@...ibm.com, mgorman@...e.de, aarcange@...hat.com,
        ak@...ux.intel.com, aneesh.kumar@...ux.vnet.ibm.com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        sparclinux@...r.kernel.org, Khalid Aziz <khalid@...ehiking.org>
Subject: [PATCH RESEND v10 08/10] mm: Clear arch specific VM flags on protection change

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@...cle.com>
Cc: Khalid Aziz <khalid@...ehiking.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 43edf659453b..f97bc6184c52 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -277,6 +277,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 1e0d9cb024c8..a071f72309c0 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -468,7 +468,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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ