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


Groups > linux.kernel > #1572056

[RFC][PATCH 6/7] x86, mpx, selftests: Use prctl header instead of magic numbers

From Dave Hansen <dave.hansen@linux.intel.com>
Newsgroups linux.kernel
Subject [RFC][PATCH 6/7] x86, mpx, selftests: Use prctl header instead of magic numbers
Date 2017-02-02 00:30 +0100
Message-ID <t6cvF-4hs-37@gated-at.bofh.it> (permalink)
References <t6cvD-4hs-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


I got away with just hard-coding the prctl() numbers in the MPX
selftests.  Include the kernel header so we can just use the
symbolic names.

---

 b/tools/testing/selftests/x86/mpx-mini-test.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff -puN tools/testing/selftests/x86/mpx-mini-test.c~mawa-068-selftests-inc tools/testing/selftests/x86/mpx-mini-test.c
--- a/tools/testing/selftests/x86/mpx-mini-test.c~mawa-068-selftests-inc	2017-02-01 15:12:18.083231385 -0800
+++ b/tools/testing/selftests/x86/mpx-mini-test.c	2017-02-01 15:12:18.087231565 -0800
@@ -40,6 +40,8 @@ int zap_all_every_this_many_mallocs = 10
 #include "mpx-debug.h"
 #include "mpx-mm.h"
 
+#include "../../../../include/uapi/linux/prctl.h"
+
 #ifndef __always_inline
 #define __always_inline inline __attribute__((always_inline)
 #endif
@@ -666,7 +668,7 @@ bool process_specific_init(void)
 	check_clear(dir, size);
 	enable_mpx(dir);
 	check_clear(dir, size);
-	if (prctl(43, 0, 0, 0, 0)) {
+	if (prctl(PR_MPX_ENABLE_MANAGEMENT, 0, 0, 0, 0)) {
 		printf("no MPX support\n");
 		abort();
 		return false;
@@ -676,7 +678,7 @@ bool process_specific_init(void)
 
 bool process_specific_finish(void)
 {
-	if (prctl(44)) {
+	if (prctl(PR_MPX_DISABLE_MANAGEMENT)) {
 		printf("no MPX support\n");
 		return false;
 	}
_

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


Thread

[RFC][PATCH 0/7] x86, mpx: Support larger address space (MAWA) (v2) Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-02 00:30 +0100
  [RFC][PATCH 1/7] x86, mpx: introduce per-mm MPX table size tracking Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-02 00:30 +0100
  [RFC][PATCH 3/7] x86, mpx: extend MPX prctl() to pass in size of bounds directory Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-02 00:30 +0100
    Re: [RFC][PATCH 3/7] x86, mpx: extend MPX prctl() to pass in size  of bounds directory Thomas Gleixner <tglx@linutronix.de> - 2017-02-12 20:20 +0100
  [RFC][PATCH 4/7] x86, mpx: context-switch new MPX address size MSR Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-02 00:30 +0100
    Re: [RFC][PATCH 4/7] x86, mpx: context-switch new MPX address size  MSR Thomas Gleixner <tglx@linutronix.de> - 2017-02-12 20:40 +0100
  [RFC][PATCH 7/7] x86, mpx: update MPX selftest to test larger bounds dir Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-02 00:30 +0100
  [RFC][PATCH 6/7] x86, mpx, selftests: Use prctl header instead of magic numbers Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-02 00:30 +0100
  [RFC][PATCH 5/7] x86, mpx: shrink per-mm MPX data Dave Hansen <dave.hansen@linux.intel.com> - 2017-02-02 00:30 +0100
    Re: [RFC][PATCH 5/7] x86, mpx: shrink per-mm MPX data Thomas Gleixner <tglx@linutronix.de> - 2017-02-12 23:50 +0100

csiph-web