From: Nick Terrell Date: Thu, 23 Sep 2021 18:48:39 +0000 (-0700) Subject: [build] Fix oss-fuzz build with the dataflow sanitizer X-Git-Tag: v1.5.1~1^2~96^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7ef97a013b55d04121ed09a8db2457c005fee41;p=thirdparty%2Fzstd.git [build] Fix oss-fuzz build with the dataflow sanitizer The dataflow sanitizer requires all code to be instrumented. We can't instrument the ASM function, so we have to disable it. --- diff --git a/lib/common/compiler.h b/lib/common/compiler.h index 9d7d968ce..e5292d773 100644 --- a/lib/common/compiler.h +++ b/lib/common/compiler.h @@ -233,6 +233,15 @@ # endif #endif +/* detects whether we are being compiled undef dfsan */ +#ifndef ZSTD_DATAFLOW_SANITIZER +# if __has_feature(dataflow_sanitizer) +# define ZSTD_DATAFLOW_SANITIZER 1 +# else +# define ZSTD_DATAFLOW_SANITIZER 0 +# endif +#endif + #if ZSTD_MEMORY_SANITIZER /* Not all platforms that support msan provide sanitizers/msan_interface.h. * We therefore declare the functions we need ourselves, rather than trying to diff --git a/lib/decompress/huf_decompress.c b/lib/decompress/huf_decompress.c index 2efca7dd5..128b08019 100644 --- a/lib/decompress/huf_decompress.c +++ b/lib/decompress/huf_decompress.c @@ -47,7 +47,7 @@ * Disable when MSAN is enabled. */ #if defined(__linux__) || defined(__linux) || defined(__APPLE__) -# if ZSTD_MEMORY_SANITIZER +# if ZSTD_MEMORY_SANITIZER || ZSTD_DATAFLOW_SANITIZER # define HUF_ASM_SUPPORTED 0 # else # define HUF_ASM_SUPPORTED 1