[PATCH] D71513: [compiler-rt] [test] Disable MPROTECT on two builtin tests

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 17 11:36:32 PST 2019


mgorny updated this revision to Diff 234351.
mgorny edited the summary of this revision.
mgorny added a comment.

Switch to using `%run_nomprotect` instead of extra `%paxctl`. This should be more consistent and should avoid potential issues with `:` on Windows.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71513/new/

https://reviews.llvm.org/D71513

Files:
  compiler-rt/test/builtins/Unit/clear_cache_test.c
  compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
  compiler-rt/test/lit.common.cfg.py
  compiler-rt/test/sanitizer_common/netbsd_commands/run_nomprotect.sh


Index: compiler-rt/test/sanitizer_common/netbsd_commands/run_nomprotect.sh
===================================================================
--- /dev/null
+++ compiler-rt/test/sanitizer_common/netbsd_commands/run_nomprotect.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+/usr/sbin/paxctl +m "${1}"
+exec "${@}"
Index: compiler-rt/test/lit.common.cfg.py
===================================================================
--- compiler-rt/test/lit.common.cfg.py
+++ compiler-rt/test/lit.common.cfg.py
@@ -112,6 +112,19 @@
     (' clang', """\n\n*** Do not use 'clangXXX' in tests,
      instead define '%clangXXX' substitution in lit config. ***\n\n""") )
 
+if config.host_os == 'NetBSD':
+  nb_commands_dir = os.path.join(config.compiler_rt_src_root,
+                                 "test", "sanitizer_common", "netbsd_commands")
+  config.netbsd_noaslr_prefix = ('sh ' +
+                                 os.path.join(nb_commands_dir, 'run_noaslr.sh'))
+  config.netbsd_nomprotect_prefix = ('sh ' +
+                                     os.path.join(nb_commands_dir,
+                                                  'run_nomprotect.sh'))
+  config.substitutions.append( ('%run_nomprotect',
+                                config.netbsd_nomprotect_prefix) )
+else:
+  config.substitutions.append( ('%run_nomprotect', '%run') )
+
 # Allow tests to be executed on a simulator or remotely.
 if config.emulator:
   config.substitutions.append( ('%run', config.emulator) )
@@ -498,9 +511,3 @@
 
 config.clang = " " + " ".join(run_wrapper + [config.compile_wrapper, config.clang]) + " "
 config.target_cflags = " " + " ".join(target_cflags + extra_cflags) + " "
-
-if config.host_os == 'NetBSD':
-  nb_commands_dir = os.path.join(config.compiler_rt_src_root,
-                                 "test", "sanitizer_common", "netbsd_commands")
-  config.netbsd_noaslr_prefix = ('sh ' +
-                                 os.path.join(nb_commands_dir, 'run_noaslr.sh'))
Index: compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
===================================================================
--- compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
+++ compiler-rt/test/builtins/Unit/enable_execute_stack_test.c
@@ -1,5 +1,5 @@
 // REQUIRES: native-run
-// RUN: %clang_builtins %s %librt -o %t && %run %t
+// RUN: %clang_builtins %s %librt -o %t && %run_nomprotect %t
 // REQUIRES: librt_has_enable_execute_stack
 //===-- enable_execute_stack_test.c - Test __enable_execute_stack ----------===//
 //
Index: compiler-rt/test/builtins/Unit/clear_cache_test.c
===================================================================
--- compiler-rt/test/builtins/Unit/clear_cache_test.c
+++ compiler-rt/test/builtins/Unit/clear_cache_test.c
@@ -1,6 +1,6 @@
 // REQUIRES: native-run
 // UNSUPPORTED: arm, aarch64
-// RUN: %clang_builtins %s %librt -o %t && %run %t
+// RUN: %clang_builtins %s %librt -o %t && %run_nomprotect %t
 // REQUIRES: librt_has_clear_cache
 //===-- clear_cache_test.c - Test clear_cache -----------------------------===//
 //


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71513.234351.patch
Type: text/x-patch
Size: 3038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191217/f37a3eea/attachment.bin>


More information about the cfe-commits mailing list