]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Don't Include `sanitizer/msan_interface.h`, Since Not All Platforms Provide It 1780/head
authorW. Felix Handte <w@felixhandte.com>
Mon, 16 Sep 2019 16:08:03 +0000 (12:08 -0400)
committerW. Felix Handte <w@felixhandte.com>
Mon, 16 Sep 2019 16:08:03 +0000 (12:08 -0400)
Instead, explicitly declare the functions we use.

lib/common/mem.h

index 3dc4f4286262c4864632e63b5e12d45923de9bf9..2b115ddb6a3b019e25ce556fa69785c49eed4718 100644 (file)
@@ -55,7 +55,23 @@ MEM_STATIC void MEM_check(void) { MEM_STATIC_ASSERT((sizeof(size_t)==4) || (size
 #endif
 
 #if defined (MEMORY_SANITIZER)
-#  include <sanitizer/msan_interface.h>
+/* Not all platforms that support msan provide sanitizers/msan_interface.h.
+ * We therefore declare the functions we need ourselves, rather than trying to
+ * include the header file... */
+
+#include <stdint.h> /* intptr_t */
+
+/* Make memory region fully initialized (without changing its contents). */
+void __msan_unpoison(const volatile void *a, size_t size);
+
+/* Make memory region fully uninitialized (without changing its contents).
+   This is a legacy interface that does not update origin information. Use
+   __msan_allocated_memory() instead. */
+void __msan_poison(const volatile void *a, size_t size);
+
+/* Returns the offset of the first (at least partially) poisoned byte in the
+   memory range, or -1 if the whole range is good. */
+intptr_t __msan_test_shadow(const volatile void *x, size_t size);
 #endif
 
 #if defined (MEMORY_SANITIZER)