mgorny created this revision. mgorny added reviewers: krytarowski, eugenis, kcc, dvyukov. Herald added subscribers: llvm-commits, dberris. Herald added a project: LLVM.
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. https://reviews.llvm.org/D70958 Files: compiler-rt/test/asan/lit.cfg.py compiler-rt/test/msan/lit.cfg.py compiler-rt/test/sanitizer_common/lit.common.cfg.py compiler-rt/test/sanitizer_common/netbsd_commands/run_noaslr.sh compiler-rt/test/tsan/lit.cfg.py Index: compiler-rt/test/tsan/lit.cfg.py =================================================================== --- compiler-rt/test/tsan/lit.cfg.py +++ compiler-rt/test/tsan/lit.cfg.py @@ -88,3 +88,9 @@ if not config.parallelism_group: config.parallelism_group = 'shadow-memory' + +if config.host_os == 'NetBSD': + nb_commands_dir = os.path.join(config.compiler_rt_src_root, + "test", "sanitizer_common", "netbsd_commands") + config.substitutions.insert(0, + ('%run', 'sh ' + os.path.join(nb_commands_dir, 'run_noaslr.sh'))) Index: compiler-rt/test/sanitizer_common/netbsd_commands/run_noaslr.sh =================================================================== --- /dev/null +++ compiler-rt/test/sanitizer_common/netbsd_commands/run_noaslr.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# PATH needed for paxctl +PATH=${PATH}:/usr/sbin +paxctl +a "${1}" +exec "${@}" Index: compiler-rt/test/sanitizer_common/lit.common.cfg.py =================================================================== --- compiler-rt/test/sanitizer_common/lit.common.cfg.py +++ compiler-rt/test/sanitizer_common/lit.common.cfg.py @@ -73,3 +73,9 @@ if not config.parallelism_group: config.parallelism_group = 'shadow-memory' + +if config.host_os == 'NetBSD': + nb_commands_dir = os.path.join(config.compiler_rt_src_root, + "test", "sanitizer_common", "netbsd_commands") + config.substitutions.insert(0, + ('%run', 'sh ' + os.path.join(nb_commands_dir, 'run_noaslr.sh'))) Index: compiler-rt/test/msan/lit.cfg.py =================================================================== --- compiler-rt/test/msan/lit.cfg.py +++ compiler-rt/test/msan/lit.cfg.py @@ -45,3 +45,9 @@ config.substitutions.append( ('CHECK-%short-stack', 'CHECK-SHORT-STACK')) else: config.substitutions.append( ('CHECK-%short-stack', 'CHECK-FULL-STACK')) + +if config.host_os == 'NetBSD': + nb_commands_dir = os.path.join(config.compiler_rt_src_root, + "test", "sanitizer_common", "netbsd_commands") + config.substitutions.insert(0, + ('%run', 'sh ' + os.path.join(nb_commands_dir, 'run_noaslr.sh'))) Index: compiler-rt/test/asan/lit.cfg.py =================================================================== --- compiler-rt/test/asan/lit.cfg.py +++ compiler-rt/test/asan/lit.cfg.py @@ -237,3 +237,9 @@ if not config.parallelism_group: config.parallelism_group = 'shadow-memory' + +if config.host_os == 'NetBSD': + nb_commands_dir = os.path.join(config.compiler_rt_src_root, + "test", "sanitizer_common", "netbsd_commands") + config.substitutions.insert(0, + ('%run', 'sh ' + os.path.join(nb_commands_dir, 'run_noaslr.sh')))
Index: compiler-rt/test/tsan/lit.cfg.py =================================================================== --- compiler-rt/test/tsan/lit.cfg.py +++ compiler-rt/test/tsan/lit.cfg.py @@ -88,3 +88,9 @@ if not config.parallelism_group: config.parallelism_group = 'shadow-memory' + +if config.host_os == 'NetBSD': + nb_commands_dir = os.path.join(config.compiler_rt_src_root, + "test", "sanitizer_common", "netbsd_commands") + config.substitutions.insert(0, + ('%run', 'sh ' + os.path.join(nb_commands_dir, 'run_noaslr.sh'))) Index: compiler-rt/test/sanitizer_common/netbsd_commands/run_noaslr.sh =================================================================== --- /dev/null +++ compiler-rt/test/sanitizer_common/netbsd_commands/run_noaslr.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# PATH needed for paxctl +PATH=${PATH}:/usr/sbin +paxctl +a "${1}" +exec "${@}" Index: compiler-rt/test/sanitizer_common/lit.common.cfg.py =================================================================== --- compiler-rt/test/sanitizer_common/lit.common.cfg.py +++ compiler-rt/test/sanitizer_common/lit.common.cfg.py @@ -73,3 +73,9 @@ if not config.parallelism_group: config.parallelism_group = 'shadow-memory' + +if config.host_os == 'NetBSD': + nb_commands_dir = os.path.join(config.compiler_rt_src_root, + "test", "sanitizer_common", "netbsd_commands") + config.substitutions.insert(0, + ('%run', 'sh ' + os.path.join(nb_commands_dir, 'run_noaslr.sh'))) Index: compiler-rt/test/msan/lit.cfg.py =================================================================== --- compiler-rt/test/msan/lit.cfg.py +++ compiler-rt/test/msan/lit.cfg.py @@ -45,3 +45,9 @@ config.substitutions.append( ('CHECK-%short-stack', 'CHECK-SHORT-STACK')) else: config.substitutions.append( ('CHECK-%short-stack', 'CHECK-FULL-STACK')) + +if config.host_os == 'NetBSD': + nb_commands_dir = os.path.join(config.compiler_rt_src_root, + "test", "sanitizer_common", "netbsd_commands") + config.substitutions.insert(0, + ('%run', 'sh ' + os.path.join(nb_commands_dir, 'run_noaslr.sh'))) Index: compiler-rt/test/asan/lit.cfg.py =================================================================== --- compiler-rt/test/asan/lit.cfg.py +++ compiler-rt/test/asan/lit.cfg.py @@ -237,3 +237,9 @@ if not config.parallelism_group: config.parallelism_group = 'shadow-memory' + +if config.host_os == 'NetBSD': + nb_commands_dir = os.path.join(config.compiler_rt_src_root, + "test", "sanitizer_common", "netbsd_commands") + config.substitutions.insert(0, + ('%run', 'sh ' + os.path.join(nb_commands_dir, 'run_noaslr.sh')))
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits