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


Groups > linux.kernel > #1704171 > unrolled thread

[PATCH 1/2] x86,mpx: make mpx depend on x86-64 to free up VMA flag

Started byriel@redhat.com
First post2017-08-04 21:10 +0200
Last post2017-08-04 21:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] x86,mpx: make mpx depend on x86-64 to free up VMA flag riel@redhat.com - 2017-08-04 21:10 +0200
    Re: [PATCH 1/2] x86,mpx: make mpx depend on x86-64 to free up VMA  flag Dave Hansen <dave.hansen@intel.com> - 2017-08-04 21:30 +0200

#1704171 — [PATCH 1/2] x86,mpx: make mpx depend on x86-64 to free up VMA flag

Fromriel@redhat.com
Date2017-08-04 21:10 +0200
Subject[PATCH 1/2] x86,mpx: make mpx depend on x86-64 to free up VMA flag
Message-ID<uaQ8W-2CK-15@gated-at.bofh.it>
From: Rik van Riel <riel@redhat.com>

MPX only seems to be available on 64 bit CPUs, starting with Skylake
and Goldmont. Move VM_MPX into the 64 bit only portion of vma->vm_flags,
in order to free up a VMA flag.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 arch/x86/Kconfig   | 4 +++-
 include/linux/mm.h | 8 ++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 781521b7cf9e..6dff14fadc6f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1756,7 +1756,9 @@ config X86_SMAP
 config X86_INTEL_MPX
 	prompt "Intel MPX (Memory Protection Extensions)"
 	def_bool n
-	depends on CPU_SUP_INTEL
+	# Note: only available in 64-bit mode due to VMA flags shortage
+	depends on CPU_SUP_INTEL && X86_64
+	select ARCH_USES_HIGH_VMA_FLAGS
 	---help---
 	  MPX provides hardware features that can be used in
 	  conjunction with compiler-instrumented code to check
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 46b9ac5e8569..7550eeb06ccf 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -208,10 +208,12 @@ extern unsigned int kobjsize(const void *objp);
 #define VM_HIGH_ARCH_BIT_1	33	/* bit only usable on 64-bit architectures */
 #define VM_HIGH_ARCH_BIT_2	34	/* bit only usable on 64-bit architectures */
 #define VM_HIGH_ARCH_BIT_3	35	/* bit only usable on 64-bit architectures */
+#define VM_HIGH_ARCH_BIT_4	36	/* bit only usable on 64-bit architectures */
 #define VM_HIGH_ARCH_0	BIT(VM_HIGH_ARCH_BIT_0)
 #define VM_HIGH_ARCH_1	BIT(VM_HIGH_ARCH_BIT_1)
 #define VM_HIGH_ARCH_2	BIT(VM_HIGH_ARCH_BIT_2)
 #define VM_HIGH_ARCH_3	BIT(VM_HIGH_ARCH_BIT_3)
+#define VM_HIGH_ARCH_4	BIT(VM_HIGH_ARCH_BIT_4)
 #endif /* CONFIG_ARCH_USES_HIGH_VMA_FLAGS */
 
 #if defined(CONFIG_X86)
@@ -235,9 +237,11 @@ extern unsigned int kobjsize(const void *objp);
 # define VM_MAPPED_COPY	VM_ARCH_1	/* T if mapped copy of data (nommu mmap) */
 #endif
 
-#if defined(CONFIG_X86)
+#if defined(CONFIG_X86_INTEL_MPX)
 /* MPX specific bounds table or bounds directory */
-# define VM_MPX		VM_ARCH_2
+# define VM_MPX		VM_HIGH_ARCH_BIT_4
+#else
+# define VM_MPX		VM_NONE
 #endif
 
 #ifndef VM_GROWSUP
-- 
2.9.4

[toc] | [next] | [standalone]


#1704177 — Re: [PATCH 1/2] x86,mpx: make mpx depend on x86-64 to free up VMA flag

FromDave Hansen <dave.hansen@intel.com>
Date2017-08-04 21:30 +0200
SubjectRe: [PATCH 1/2] x86,mpx: make mpx depend on x86-64 to free up VMA flag
Message-ID<uaQsh-2J9-1@gated-at.bofh.it>
In reply to#1704171
On 08/04/2017 12:07 PM, riel@redhat.com wrote:
> MPX only seems to be available on 64 bit CPUs, starting with Skylake
> and Goldmont. Move VM_MPX into the 64 bit only portion of vma->vm_flags,
> in order to free up a VMA flag.

Makes me a little sad.  But, seems worth it.

Acked-by: Dave Hansen <dave.hansen@intel.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web