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

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 08:59:50 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG190b9110c23c: [compiler-rt] [test] Disable MPROTECT on two builtin tests (authored by mgorny).
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

Repository:
  rG LLVM Github Monorepo

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.234913.patch
Type: text/x-patch
Size: 3038 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191220/97e4f96a/attachment.bin>


More information about the llvm-commits mailing list