[msan] Do not use 77 as exit code, instead use 1
authorFlorian Schmaus <flo@geekplace.eu>
Thu, 10 Dec 2020 20:47:16 +0000 (12:47 -0800)
committerEvgenii Stepanov <eugenis@google.com>
Thu, 10 Dec 2020 22:23:12 +0000 (14:23 -0800)
MSan uses 77 as exit code since it appeared with c5033786ba34 ("[msan]
MemorySanitizer runtime."). However, Test runners like the one from
Meson use the GNU standard approach where a exit code of 77 signals
that the test should be skipped [1]. As a result Meson's test runner
reports tests as skipped if MSan is enabled and finds issues:

build $ meson test
ninja: Entering directory `/home/user/code/project/build'
ninja: no work to do.
1/1 PROJECT:all / SimpleTest    SKIP           0.09s

I could not find any rationale why 77 was initially chosen, and I
found no other clang sanitizer that uses this value as exit
code. Hence I believe it is safe to change this to a safe
default. You can restore the old behavior by setting the environment
variable MSAN_OPTIONS to "exitcode=77", e.g.

export MSAN_OPTIONS="exitcode=77"

1: https://mesonbuild.com/Unit-tests.html#skipped-tests-and-hard-errors

Reviewed By: #sanitizers, eugenis

Differential Revision: https://reviews.llvm.org/D92490

compiler-rt/lib/msan/msan.cpp

index 7abb3b4..4be1630 100644 (file)
@@ -151,7 +151,6 @@ static void InitializeFlags() {
     // FIXME: test and enable.
     cf.check_printf = false;
     cf.intercept_tls_get_addr = true;
-    cf.exitcode = 77;
     OverrideCommonFlags(cf);
   }