Skip to content
Permalink
Browse files

[compiler-rt] [test] Disable ASLR on ASAN/MSAN/TSAN tests on NetBSD

Use a new %run wrapper for ASAN/MSAN/TSAN tests that calls paxctl
in order to disable ASLR on the test executables.  This makes it
possible to test sanitizers on systems where ASLR is enabled by default.

Differential Revision: https://reviews.llvm.org/D70958
  • Loading branch information
mgorny committed Dec 3, 2019
1 parent 90409f7 commit 6c2b2b9e20abb27ab5c1ae255c1862785b793c1f
@@ -237,3 +237,6 @@ def build_invocation(compile_flags):

if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'

if config.host_os == 'NetBSD':
config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))
@@ -498,3 +498,9 @@ def is_windows_lto_supported():

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'))
@@ -45,3 +45,6 @@ def build_invocation(compile_flags):
config.substitutions.append( ('CHECK-%short-stack', 'CHECK-SHORT-STACK'))
else:
config.substitutions.append( ('CHECK-%short-stack', 'CHECK-FULL-STACK'))

if config.host_os == 'NetBSD':
config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))
@@ -73,3 +73,6 @@ def build_invocation(compile_flags):

if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'

if config.host_os == 'NetBSD':
config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))
@@ -0,0 +1,3 @@
#!/bin/sh
/usr/sbin/paxctl +a "${1}"
exec "${@}"
@@ -88,3 +88,6 @@ def build_invocation(compile_flags):

if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'

if config.host_os == 'NetBSD':
config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))

0 comments on commit 6c2b2b9

Please sign in to comment.
You can’t perform that action at this time.