From 2614d83aa06592aedbab82ff877bc461d0c481fd Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Wed, 10 Oct 2018 02:36:36 +0000 Subject: [PATCH] tests: pass halt_on_error=1 to UBSan By default, UBSan neither crashes nor exits with a non-zero exit code when undefined behavior has been detected. This is problematic because it makes it much harder to catch issues like https://github.com/systemd/systemd/issues/10346, https://github.com/systemd/systemd/issues/10347, and https://github.com/systemd/systemd/issues/10333. In fact, those issue were found just because I decided to grep the test log, which isn't something that I normally do :-) As it turns out, the only way to make UBSan signal that something is wrong that works more or less reliably everywhere is to pass halt_on_error=1 (though, it's probably worth noting that it's currently not set for PID1 in order not to trigger kernel panics). See https://reviews.llvm.org/D35085#804183 and https://chromium.googlesource.com/chromium/src/testing/libfuzzer/+/HEAD/reference.md --- test/test-functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index 9919728454..88e66fd72e 100644 --- a/test/test-functions +++ b/test/test-functions @@ -331,7 +331,7 @@ set -x DEFAULT_ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 DEFAULT_UBSAN_OPTIONS=print_stacktrace=1:print_summary=1 -DEFAULT_ENVIRONMENT="ASAN_OPTIONS=\$DEFAULT_ASAN_OPTIONS UBSAN_OPTIONS=\$DEFAULT_UBSAN_OPTIONS" +DEFAULT_ENVIRONMENT="ASAN_OPTIONS=\$DEFAULT_ASAN_OPTIONS UBSAN_OPTIONS=\$DEFAULT_UBSAN_OPTIONS:halt_on_error=1" mount -t proc proc /proc mount -t sysfs sysfs /sys