1 //===- FuzzerDFSan.h - Internal header for the Fuzzer -----------*- C++ -* ===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_FUZZER_DFSAN_H
13 #define LLVM_FUZZER_DFSAN_H
15 #define LLVM_FUZZER_SUPPORTS_DFSAN 0
16 #if defined(__has_include)
17 # if __has_include(<sanitizer/dfsan_interface.h>)
18 # if defined (__linux__)
19 # undef LLVM_FUZZER_SUPPORTS_DFSAN
20 # define LLVM_FUZZER_SUPPORTS_DFSAN 1
21 # include <sanitizer/dfsan_interface.h>
24 #endif // defined(__has_include)
26 #if LLVM_FUZZER_SUPPORTS_DFSAN
30 dfsan_label dfsan_create_label(const char *desc, void *userdata);
32 void dfsan_set_label(dfsan_label label, void *addr, size_t size);
34 void dfsan_add_label(dfsan_label label, void *addr, size_t size);
36 const struct dfsan_label_info *dfsan_get_label_info(dfsan_label label);
38 dfsan_label dfsan_read_label(const void *addr, size_t size);
42 static bool ReallyHaveDFSan() {
43 return &dfsan_create_label != nullptr;
47 // When compiling with a compiler which does not support dfsan,
48 // this code is still expected to build (but not necessary work).
49 typedef unsigned short dfsan_label;
50 struct dfsan_label_info {
56 static bool ReallyHaveDFSan() { return false; }
61 #endif // LLVM_FUZZER_DFSAN_H