sanitizer_common: make internal/external headers compatible
This is a follow up to 4f3f4d6722
("sanitizer_common: fix __sanitizer_get_module_and_offset_for_pc signature mismatch")
which fixes a similar problem for msan build.
I am getting the following error compiling a unit test for code that
uses sanitizer_common headers and googletest transitively includes
sanitizer interface headers:
In file included from third_party/gwp_sanitizers/singlestep_test.cpp:3:
In file included from sanitizer_common/sanitizer_common.h:19:
sanitizer_interface_internal.h:41:5: error: typedef redefinition with different types
('struct __sanitizer_sandbox_arguments' vs 'struct __sanitizer_sandbox_arguments')
} __sanitizer_sandbox_arguments;
common_interface_defs.h:39:3: note: previous definition is here
} __sanitizer_sandbox_arguments;
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D119546
This commit is contained in:
@@ -12,11 +12,13 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "asan_poisoning.h"
|
||||
|
||||
#include "asan_report.h"
|
||||
#include "asan_stack.h"
|
||||
#include "sanitizer_common/sanitizer_atomic.h"
|
||||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_interface_internal.h"
|
||||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
|
||||
namespace __asan {
|
||||
|
||||
|
||||
@@ -11,17 +11,19 @@
|
||||
// This file contains error reporting code.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "asan_report.h"
|
||||
|
||||
#include "asan_descriptions.h"
|
||||
#include "asan_errors.h"
|
||||
#include "asan_flags.h"
|
||||
#include "asan_descriptions.h"
|
||||
#include "asan_internal.h"
|
||||
#include "asan_mapping.h"
|
||||
#include "asan_report.h"
|
||||
#include "asan_scariness_score.h"
|
||||
#include "asan_stack.h"
|
||||
#include "asan_thread.h"
|
||||
#include "sanitizer_common/sanitizer_common.h"
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_interface_internal.h"
|
||||
#include "sanitizer_common/sanitizer_report_decorator.h"
|
||||
#include "sanitizer_common/sanitizer_stackdepot.h"
|
||||
#include "sanitizer_common/sanitizer_symbolizer.h"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "lsan/lsan_common.h"
|
||||
#include "sanitizer_common/sanitizer_atomic.h"
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_interface_internal.h"
|
||||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
#include "sanitizer_common/sanitizer_symbolizer.h"
|
||||
#include "ubsan/ubsan_init.h"
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
|
||||
#include "lsan.h"
|
||||
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_flag_parser.h"
|
||||
#include "lsan_allocator.h"
|
||||
#include "lsan_common.h"
|
||||
#include "lsan_thread.h"
|
||||
#include "sanitizer_common/sanitizer_flag_parser.h"
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_interface_internal.h"
|
||||
|
||||
bool lsan_inited;
|
||||
bool lsan_init_is_running;
|
||||
|
||||
@@ -12,20 +12,22 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "msan.h"
|
||||
|
||||
#include "msan_chained_origin_depot.h"
|
||||
#include "msan_origin.h"
|
||||
#include "msan_poisoning.h"
|
||||
#include "msan_report.h"
|
||||
#include "msan_thread.h"
|
||||
#include "msan_poisoning.h"
|
||||
#include "sanitizer_common/sanitizer_atomic.h"
|
||||
#include "sanitizer_common/sanitizer_common.h"
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_flag_parser.h"
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_interface_internal.h"
|
||||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
#include "sanitizer_common/sanitizer_procmaps.h"
|
||||
#include "sanitizer_common/sanitizer_stackdepot.h"
|
||||
#include "sanitizer_common/sanitizer_stacktrace.h"
|
||||
#include "sanitizer_common/sanitizer_symbolizer.h"
|
||||
#include "sanitizer_common/sanitizer_stackdepot.h"
|
||||
#include "ubsan/ubsan_flags.h"
|
||||
#include "ubsan/ubsan_init.h"
|
||||
|
||||
|
||||
@@ -11,10 +11,12 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "sanitizer_common.h"
|
||||
|
||||
#include "sanitizer_allocator_interface.h"
|
||||
#include "sanitizer_allocator_internal.h"
|
||||
#include "sanitizer_atomic.h"
|
||||
#include "sanitizer_flags.h"
|
||||
#include "sanitizer_interface_internal.h"
|
||||
#include "sanitizer_libc.h"
|
||||
#include "sanitizer_placement_new.h"
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#define SANITIZER_COMMON_H
|
||||
|
||||
#include "sanitizer_flags.h"
|
||||
#include "sanitizer_interface_internal.h"
|
||||
#include "sanitizer_internal_defs.h"
|
||||
#include "sanitizer_libc.h"
|
||||
#include "sanitizer_list.h"
|
||||
@@ -286,7 +285,7 @@ void SetStackSizeLimitInBytes(uptr limit);
|
||||
bool AddressSpaceIsUnlimited();
|
||||
void SetAddressSpaceUnlimited();
|
||||
void AdjustStackSize(void *attr);
|
||||
void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args);
|
||||
void PlatformPrepareForSandboxing(void *args);
|
||||
void SetSandboxingCallback(void (*f)());
|
||||
|
||||
void InitializeCoverage(bool enabled, const char *coverage_dir);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "sanitizer_allocator_interface.h"
|
||||
#include "sanitizer_common.h"
|
||||
#include "sanitizer_flags.h"
|
||||
#include "sanitizer_interface_internal.h"
|
||||
#include "sanitizer_procmaps.h"
|
||||
#include "sanitizer_stackdepot.h"
|
||||
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
#include "sanitizer_platform.h"
|
||||
|
||||
#if !SANITIZER_FUCHSIA
|
||||
#include "sancov_flags.h"
|
||||
#include "sanitizer_allocator_internal.h"
|
||||
#include "sanitizer_atomic.h"
|
||||
#include "sanitizer_common.h"
|
||||
#include "sanitizer_file.h"
|
||||
# include "sancov_flags.h"
|
||||
# include "sanitizer_allocator_internal.h"
|
||||
# include "sanitizer_atomic.h"
|
||||
# include "sanitizer_common.h"
|
||||
# include "sanitizer_file.h"
|
||||
# include "sanitizer_interface_internal.h"
|
||||
|
||||
using namespace __sanitizer;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "sanitizer_common.h"
|
||||
#include "sanitizer_file.h"
|
||||
# include "sanitizer_interface_internal.h"
|
||||
|
||||
namespace __sanitizer {
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#ifndef SANITIZER_FILE_H
|
||||
#define SANITIZER_FILE_H
|
||||
|
||||
#include "sanitizer_interface_internal.h"
|
||||
#include "sanitizer_internal_defs.h"
|
||||
#include "sanitizer_libc.h"
|
||||
#include "sanitizer_mutex.h"
|
||||
|
||||
@@ -14,17 +14,18 @@
|
||||
#include "sanitizer_fuchsia.h"
|
||||
#if SANITIZER_FUCHSIA
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <zircon/errors.h>
|
||||
#include <zircon/process.h>
|
||||
#include <zircon/syscalls.h>
|
||||
#include <zircon/utc.h>
|
||||
# include <pthread.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
# include <zircon/errors.h>
|
||||
# include <zircon/process.h>
|
||||
# include <zircon/syscalls.h>
|
||||
# include <zircon/utc.h>
|
||||
|
||||
#include "sanitizer_common.h"
|
||||
#include "sanitizer_libc.h"
|
||||
#include "sanitizer_mutex.h"
|
||||
# include "sanitizer_common.h"
|
||||
# include "sanitizer_interface_internal.h"
|
||||
# include "sanitizer_libc.h"
|
||||
# include "sanitizer_mutex.h"
|
||||
|
||||
namespace __sanitizer {
|
||||
|
||||
@@ -89,7 +90,7 @@ void InitializePlatformEarly() {}
|
||||
void MaybeReexec() {}
|
||||
void CheckASLR() {}
|
||||
void CheckMPROTECT() {}
|
||||
void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args) {}
|
||||
void PlatformPrepareForSandboxing(void *args) {}
|
||||
void DisableCoreDumperIfNecessary() {}
|
||||
void InstallDeadlySignalHandlers(SignalHandlerType handler) {}
|
||||
void SetAlternateSignalStack() {}
|
||||
|
||||
@@ -290,7 +290,7 @@ bool IsAccessibleMemoryRange(uptr beg, uptr size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args) {
|
||||
void PlatformPrepareForSandboxing(void *args) {
|
||||
// Some kinds of sandboxes may forbid filesystem access, so we won't be able
|
||||
// to read the file mappings from /proc/self/maps. Luckily, neither the
|
||||
// process will be able to load additional libraries, so it's fine to use the
|
||||
|
||||
@@ -517,7 +517,7 @@ void ReExec() {
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
void PlatformPrepareForSandboxing(__sanitizer_sandbox_arguments *args) {}
|
||||
void PlatformPrepareForSandboxing(void *args) {}
|
||||
|
||||
bool StackSizeIsUnlimited() {
|
||||
UNIMPLEMENTED();
|
||||
|
||||
@@ -11,17 +11,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include <algorithm>
|
||||
|
||||
// This ensures that including both internal sanitizer_common headers
|
||||
// and the interface headers does not lead to compilation failures.
|
||||
// Both may be included in unit tests, where googletest transitively
|
||||
// pulls in sanitizer interface headers.
|
||||
// The headers are specifically included using relative paths,
|
||||
// because a compiler may use a different mismatching version
|
||||
// of sanitizer headers.
|
||||
#include "../../../include/sanitizer/asan_interface.h"
|
||||
#include "../../../include/sanitizer/msan_interface.h"
|
||||
#include "../../../include/sanitizer/tsan_interface.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "sanitizer_common/sanitizer_allocator_internal.h"
|
||||
#include "sanitizer_common/sanitizer_common.h"
|
||||
#include "sanitizer_common/sanitizer_file.h"
|
||||
#include "sanitizer_common/sanitizer_flags.h"
|
||||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
#include "sanitizer_common/sanitizer_platform.h"
|
||||
|
||||
#include "sanitizer_pthread_wrappers.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace __sanitizer {
|
||||
|
||||
static bool IsSorted(const uptr *array, uptr n) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "sanitizer_common/sanitizer_atomic.h"
|
||||
#include "sanitizer_common/sanitizer_common.h"
|
||||
#include "sanitizer_common/sanitizer_file.h"
|
||||
#include "sanitizer_common/sanitizer_interface_internal.h"
|
||||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
#include "sanitizer_common/sanitizer_placement_new.h"
|
||||
#include "sanitizer_common/sanitizer_stackdepot.h"
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
|
||||
#include "ubsan_platform.h"
|
||||
#if CAN_SANITIZE_UB
|
||||
#include "ubsan_diag.h"
|
||||
#include "ubsan_init.h"
|
||||
#include "ubsan_flags.h"
|
||||
#include "sanitizer_common/sanitizer_common.h"
|
||||
#include "sanitizer_common/sanitizer_interface_internal.h"
|
||||
#include "sanitizer_common/sanitizer_libc.h"
|
||||
#include "sanitizer_common/sanitizer_mutex.h"
|
||||
#include "sanitizer_common/sanitizer_symbolizer.h"
|
||||
#include "ubsan_diag.h"
|
||||
#include "ubsan_flags.h"
|
||||
#include "ubsan_init.h"
|
||||
|
||||
using namespace __ubsan;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user