[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
This commit is contained in:
Michał Górny 2019-12-03 14:44:33 +01:00
parent 90409f73a5
commit 6c2b2b9e20
6 changed files with 21 additions and 0 deletions

View File

@ -237,3 +237,6 @@ if config.host_os not in ['Linux', 'Darwin', 'FreeBSD', 'SunOS', 'Windows', 'Net
if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'
if config.host_os == 'NetBSD':
config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))

View File

@ -498,3 +498,9 @@ elif config.use_lld and (not config.has_lld):
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'))

View File

@ -45,3 +45,6 @@ if config.host_arch in ['mips64', 'mips64el']:
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))

View File

@ -73,3 +73,6 @@ if config.host_os not in ['Linux', 'Darwin', 'NetBSD', 'FreeBSD']:
if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'
if config.host_os == 'NetBSD':
config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))

View File

@ -0,0 +1,3 @@
#!/bin/sh
/usr/sbin/paxctl +a "${1}"
exec "${@}"

View File

@ -88,3 +88,6 @@ if config.android:
if not config.parallelism_group:
config.parallelism_group = 'shadow-memory'
if config.host_os == 'NetBSD':
config.substitutions.insert(0, ('%run', config.netbsd_noaslr_prefix))