fuzz-unit-file: add __has_feature(memory_sanitizer) when skipping ListenNetlink=

https://clang.llvm.org/docs/MemorySanitizer.html#id5 documents this
check as the way to detect MemorySanitizer at compilation time. We
only need to skip the test if MemorySanitizer is used.

Also, use this condition in cg_slice_to_path(). There, the code that is
conditionalized is not harmful in any way (it's just unnecessary), so remove
the FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION condition.

Fixes #8482.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-03-26 15:28:03 +02:00
parent 483ed8a6a0
commit 989290dbf1
3 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
ll = l + strspn(l, WHITESPACE);
if (startswith(ll, "ListenNetlink=")) {
if (HAS_FEATURE_MEMORY_SANITIZER && startswith(ll, "ListenNetlink=")) {
/* ListenNetlink causes a false positive in msan,
* let's skip this for now. */
log_notice("Skipping test because ListenNetlink= is present");