2012-11-12 16:53:47 +01:00
|
|
|
//===-- sanitizer_internal_defs.h -------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-08-14 10:47:11 +02:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2012-11-12 16:53:47 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is shared between AddressSanitizer and ThreadSanitizer.
|
|
|
|
// It contains macro used in run-time libraries code.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SANITIZER_DEFS_H
|
|
|
|
#define SANITIZER_DEFS_H
|
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
#include "sanitizer_platform.h"
|
|
|
|
|
2015-10-21 09:32:45 +02:00
|
|
|
#ifndef SANITIZER_DEBUG
|
|
|
|
# define SANITIZER_DEBUG 0
|
|
|
|
#endif
|
|
|
|
|
2018-10-31 12:14:23 +01:00
|
|
|
#define SANITIZER_STRINGIFY_(S) #S
|
|
|
|
#define SANITIZER_STRINGIFY(S) SANITIZER_STRINGIFY_(S)
|
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
// Only use SANITIZER_*ATTRIBUTE* before the function return type!
|
|
|
|
#if SANITIZER_WINDOWS
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
#if SANITIZER_IMPORT_INTERFACE
|
|
|
|
# define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllimport)
|
|
|
|
#else
|
2013-11-04 22:33:31 +01:00
|
|
|
# define SANITIZER_INTERFACE_ATTRIBUTE __declspec(dllexport)
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
#endif
|
2013-02-13 11:46:01 +01:00
|
|
|
# define SANITIZER_WEAK_ATTRIBUTE
|
2016-11-08 23:04:09 +01:00
|
|
|
#elif SANITIZER_GO
|
2013-02-13 11:46:01 +01:00
|
|
|
# define SANITIZER_INTERFACE_ATTRIBUTE
|
|
|
|
# define SANITIZER_WEAK_ATTRIBUTE
|
|
|
|
#else
|
|
|
|
# define SANITIZER_INTERFACE_ATTRIBUTE __attribute__((visibility("default")))
|
|
|
|
# define SANITIZER_WEAK_ATTRIBUTE __attribute__((weak))
|
|
|
|
#endif
|
|
|
|
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
// TLS is handled differently on different platforms
|
2018-10-31 12:14:23 +01:00
|
|
|
#if SANITIZER_LINUX || SANITIZER_NETBSD || \
|
2020-11-13 17:03:23 +01:00
|
|
|
SANITIZER_FREEBSD
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
# define SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE \
|
|
|
|
__attribute__((tls_model("initial-exec"))) thread_local
|
|
|
|
#else
|
|
|
|
# define SANITIZER_TLS_INITIAL_EXEC_ATTRIBUTE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//--------------------------- WEAK FUNCTIONS ---------------------------------//
|
|
|
|
// When working with weak functions, to simplify the code and make it more
|
|
|
|
// portable, when possible define a default implementation using this macro:
|
|
|
|
//
|
|
|
|
// SANITIZER_INTERFACE_WEAK_DEF(<return_type>, <name>, <parameter list>)
|
|
|
|
//
|
|
|
|
// For example:
|
|
|
|
// SANITIZER_INTERFACE_WEAK_DEF(bool, compare, int a, int b) { return a > b; }
|
|
|
|
//
|
|
|
|
#if SANITIZER_WINDOWS
|
|
|
|
#include "sanitizer_win_defs.h"
|
|
|
|
# define SANITIZER_INTERFACE_WEAK_DEF(ReturnType, Name, ...) \
|
|
|
|
WIN_WEAK_EXPORT_DEF(ReturnType, Name, __VA_ARGS__)
|
|
|
|
#else
|
|
|
|
# define SANITIZER_INTERFACE_WEAK_DEF(ReturnType, Name, ...) \
|
|
|
|
extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE \
|
|
|
|
ReturnType Name(__VA_ARGS__)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// SANITIZER_SUPPORTS_WEAK_HOOKS means that we support real weak functions that
|
|
|
|
// will evaluate to a null pointer when not defined.
|
|
|
|
#ifndef SANITIZER_SUPPORTS_WEAK_HOOKS
|
2018-10-31 12:14:23 +01:00
|
|
|
#if (SANITIZER_LINUX || SANITIZER_SOLARIS) && !SANITIZER_GO
|
2018-01-17 20:31:43 +01:00
|
|
|
# define SANITIZER_SUPPORTS_WEAK_HOOKS 1
|
|
|
|
// Before Xcode 4.5, the Darwin linker doesn't reliably support undefined
|
|
|
|
// weak symbols. Mac OS X 10.9/Darwin 13 is the first release only supported
|
|
|
|
// by Xcode >= 4.5.
|
|
|
|
#elif SANITIZER_MAC && \
|
|
|
|
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090 && !SANITIZER_GO
|
2013-02-13 11:46:01 +01:00
|
|
|
# define SANITIZER_SUPPORTS_WEAK_HOOKS 1
|
|
|
|
#else
|
|
|
|
# define SANITIZER_SUPPORTS_WEAK_HOOKS 0
|
|
|
|
#endif
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
#endif // SANITIZER_SUPPORTS_WEAK_HOOKS
|
|
|
|
// For some weak hooks that will be called very often and we want to avoid the
|
|
|
|
// overhead of executing the default implementation when it is not necessary,
|
|
|
|
// we can use the flag SANITIZER_SUPPORTS_WEAK_HOOKS to only define the default
|
|
|
|
// implementation for platforms that doesn't support weak symbols. For example:
|
|
|
|
//
|
|
|
|
// #if !SANITIZER_SUPPORT_WEAK_HOOKS
|
|
|
|
// SANITIZER_INTERFACE_WEAK_DEF(bool, compare_hook, int a, int b) {
|
|
|
|
// return a > b;
|
|
|
|
// }
|
|
|
|
// #endif
|
|
|
|
//
|
|
|
|
// And then use it as: if (compare_hook) compare_hook(a, b);
|
|
|
|
//----------------------------------------------------------------------------//
|
|
|
|
|
2013-02-13 11:46:01 +01:00
|
|
|
|
2014-09-23 19:59:53 +02:00
|
|
|
// We can use .preinit_array section on Linux to call sanitizer initialization
|
|
|
|
// functions very early in the process startup (unless PIC macro is defined).
|
2018-10-31 12:14:23 +01:00
|
|
|
//
|
|
|
|
// On FreeBSD, .preinit_array functions are called with rtld_bind_lock writer
|
|
|
|
// lock held. It will lead to dead lock if unresolved PLT functions (which helds
|
|
|
|
// rtld_bind_lock reader lock) are called inside .preinit_array functions.
|
|
|
|
//
|
2014-09-23 19:59:53 +02:00
|
|
|
// FIXME: do we have anything like this on Mac?
|
2018-10-31 12:14:23 +01:00
|
|
|
#ifndef SANITIZER_CAN_USE_PREINIT_ARRAY
|
2020-11-13 17:03:23 +01:00
|
|
|
#if (SANITIZER_LINUX || SANITIZER_FUCHSIA || SANITIZER_NETBSD) && !defined(PIC)
|
2018-10-31 12:14:23 +01:00
|
|
|
#define SANITIZER_CAN_USE_PREINIT_ARRAY 1
|
|
|
|
// Before Solaris 11.4, .preinit_array is fully supported only with GNU ld.
|
|
|
|
// FIXME: Check for those conditions.
|
|
|
|
#elif SANITIZER_SOLARIS && !defined(PIC)
|
2014-09-23 19:59:53 +02:00
|
|
|
# define SANITIZER_CAN_USE_PREINIT_ARRAY 1
|
|
|
|
#else
|
|
|
|
# define SANITIZER_CAN_USE_PREINIT_ARRAY 0
|
2013-12-05 10:18:38 +01:00
|
|
|
#endif
|
2018-10-31 12:14:23 +01:00
|
|
|
#endif // SANITIZER_CAN_USE_PREINIT_ARRAY
|
2013-12-05 10:18:38 +01:00
|
|
|
|
2013-02-21 11:57:10 +01:00
|
|
|
// GCC does not understand __has_feature
|
2013-02-13 11:46:01 +01:00
|
|
|
#if !defined(__has_feature)
|
|
|
|
# define __has_feature(x) 0
|
|
|
|
#endif
|
|
|
|
|
2018-07-26 16:48:55 +02:00
|
|
|
// Older GCCs do not understand __has_attribute.
|
|
|
|
#if !defined(__has_attribute)
|
|
|
|
# define __has_attribute(x) 0
|
|
|
|
#endif
|
|
|
|
|
2013-02-13 11:46:01 +01:00
|
|
|
// For portability reasons we do not include stddef.h, stdint.h or any other
|
|
|
|
// system header, but we do need some basic types that are not defined
|
|
|
|
// in a portable way by the language itself.
|
|
|
|
namespace __sanitizer {
|
|
|
|
|
|
|
|
#if defined(_WIN64)
|
|
|
|
// 64-bit Windows uses LLP64 data model.
|
2019-11-05 14:54:57 +01:00
|
|
|
typedef unsigned long long uptr;
|
|
|
|
typedef signed long long sptr;
|
2013-02-13 11:46:01 +01:00
|
|
|
#else
|
2019-11-05 14:54:57 +01:00
|
|
|
typedef unsigned long uptr;
|
|
|
|
typedef signed long sptr;
|
2013-02-13 11:46:01 +01:00
|
|
|
#endif // defined(_WIN64)
|
|
|
|
#if defined(__x86_64__)
|
2014-05-22 09:09:21 +02:00
|
|
|
// Since x32 uses ILP32 data model in 64-bit hardware mode, we must use
|
2013-02-13 11:46:01 +01:00
|
|
|
// 64-bit pointer to unwind stack frame.
|
2019-11-05 14:54:57 +01:00
|
|
|
typedef unsigned long long uhwptr;
|
2013-02-13 11:46:01 +01:00
|
|
|
#else
|
2019-11-05 14:54:57 +01:00
|
|
|
typedef uptr uhwptr;
|
2013-02-13 11:46:01 +01:00
|
|
|
#endif
|
|
|
|
typedef unsigned char u8;
|
2019-11-05 14:54:57 +01:00
|
|
|
typedef unsigned short u16;
|
2013-02-13 11:46:01 +01:00
|
|
|
typedef unsigned int u32;
|
2019-11-05 14:54:57 +01:00
|
|
|
typedef unsigned long long u64;
|
|
|
|
typedef signed char s8;
|
|
|
|
typedef signed short s16;
|
|
|
|
typedef signed int s32;
|
|
|
|
typedef signed long long s64;
|
2015-10-21 09:32:45 +02:00
|
|
|
#if SANITIZER_WINDOWS
|
|
|
|
// On Windows, files are HANDLE, which is a synonim of void*.
|
|
|
|
// Use void* to avoid including <windows.h> everywhere.
|
|
|
|
typedef void* fd_t;
|
|
|
|
typedef unsigned error_t;
|
|
|
|
#else
|
2013-02-13 11:46:01 +01:00
|
|
|
typedef int fd_t;
|
2015-10-21 09:32:45 +02:00
|
|
|
typedef int error_t;
|
|
|
|
#endif
|
2018-10-31 12:14:23 +01:00
|
|
|
#if SANITIZER_SOLARIS && !defined(_LP64)
|
|
|
|
typedef long pid_t;
|
|
|
|
#else
|
2016-11-08 23:04:09 +01:00
|
|
|
typedef int pid_t;
|
2018-10-31 12:14:23 +01:00
|
|
|
#endif
|
2013-02-13 11:46:01 +01:00
|
|
|
|
2018-10-31 12:14:23 +01:00
|
|
|
#if SANITIZER_FREEBSD || SANITIZER_NETBSD || \
|
2020-11-13 17:03:23 +01:00
|
|
|
SANITIZER_MAC || \
|
2018-11-06 11:42:05 +01:00
|
|
|
(SANITIZER_SOLARIS && (defined(_LP64) || _FILE_OFFSET_BITS == 64)) || \
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
(SANITIZER_LINUX && defined(__x86_64__))
|
2013-11-04 22:33:31 +01:00
|
|
|
typedef u64 OFF_T;
|
|
|
|
#else
|
|
|
|
typedef uptr OFF_T;
|
|
|
|
#endif
|
|
|
|
typedef u64 OFF64_T;
|
2013-12-05 10:18:38 +01:00
|
|
|
|
|
|
|
#if (SANITIZER_WORDSIZE == 64) || SANITIZER_MAC
|
|
|
|
typedef uptr operator_new_size_type;
|
|
|
|
#else
|
2020-11-13 17:03:23 +01:00
|
|
|
# if defined(__s390__) && !defined(__s390x__)
|
2016-11-08 23:04:09 +01:00
|
|
|
// Special case: 31-bit s390 has unsigned long as size_t.
|
|
|
|
typedef unsigned long operator_new_size_type;
|
|
|
|
# else
|
2013-12-05 10:18:38 +01:00
|
|
|
typedef u32 operator_new_size_type;
|
2016-11-08 23:04:09 +01:00
|
|
|
# endif
|
2013-12-05 10:18:38 +01:00
|
|
|
#endif
|
2013-02-13 11:46:01 +01:00
|
|
|
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
typedef u64 tid_t;
|
2013-02-13 11:46:01 +01:00
|
|
|
|
2012-11-12 16:53:47 +01:00
|
|
|
// ----------- ATTENTION -------------
|
|
|
|
// This header should NOT include any other headers to avoid portability issues.
|
|
|
|
|
|
|
|
// Common defs.
|
|
|
|
#define INTERFACE_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE
|
2016-11-08 23:04:09 +01:00
|
|
|
#define SANITIZER_WEAK_DEFAULT_IMPL \
|
|
|
|
extern "C" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE NOINLINE
|
|
|
|
#define SANITIZER_WEAK_CXX_DEFAULT_IMPL \
|
|
|
|
extern "C++" SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE NOINLINE
|
2012-11-12 16:53:47 +01:00
|
|
|
|
|
|
|
// Platform-specific defs.
|
2012-11-23 15:46:25 +01:00
|
|
|
#if defined(_MSC_VER)
|
2013-11-04 22:33:31 +01:00
|
|
|
# define ALWAYS_INLINE __forceinline
|
2012-11-12 16:53:47 +01:00
|
|
|
// FIXME(timurrrr): do we need this on Windows?
|
|
|
|
# define ALIAS(x)
|
|
|
|
# define ALIGNED(x) __declspec(align(x))
|
|
|
|
# define FORMAT(f, a)
|
|
|
|
# define NOINLINE __declspec(noinline)
|
|
|
|
# define NORETURN __declspec(noreturn)
|
|
|
|
# define THREADLOCAL __declspec(thread)
|
2012-11-23 15:46:25 +01:00
|
|
|
# define LIKELY(x) (x)
|
|
|
|
# define UNLIKELY(x) (x)
|
2016-11-08 23:04:09 +01:00
|
|
|
# define PREFETCH(x) /* _mm_prefetch(x, _MM_HINT_NTA) */ (void)0
|
2018-10-31 12:14:23 +01:00
|
|
|
# define WARN_UNUSED_RESULT
|
2012-11-23 15:46:25 +01:00
|
|
|
#else // _MSC_VER
|
2013-11-04 22:33:31 +01:00
|
|
|
# define ALWAYS_INLINE inline __attribute__((always_inline))
|
2012-11-12 16:53:47 +01:00
|
|
|
# define ALIAS(x) __attribute__((alias(x)))
|
2013-11-04 22:33:31 +01:00
|
|
|
// Please only use the ALIGNED macro before the type.
|
|
|
|
// Using ALIGNED after the variable declaration is not portable!
|
2012-11-12 16:53:47 +01:00
|
|
|
# define ALIGNED(x) __attribute__((aligned(x)))
|
|
|
|
# define FORMAT(f, a) __attribute__((format(printf, f, a)))
|
|
|
|
# define NOINLINE __attribute__((noinline))
|
|
|
|
# define NORETURN __attribute__((noreturn))
|
|
|
|
# define THREADLOCAL __thread
|
|
|
|
# define LIKELY(x) __builtin_expect(!!(x), 1)
|
|
|
|
# define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
2013-01-23 12:41:33 +01:00
|
|
|
# if defined(__i386__) || defined(__x86_64__)
|
|
|
|
// __builtin_prefetch(x) generates prefetchnt0 on x86
|
|
|
|
# define PREFETCH(x) __asm__("prefetchnta (%0)" : : "r" (x))
|
|
|
|
# else
|
|
|
|
# define PREFETCH(x) __builtin_prefetch(x)
|
|
|
|
# endif
|
2018-10-31 12:14:23 +01:00
|
|
|
# define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
2012-11-23 15:46:25 +01:00
|
|
|
#endif // _MSC_VER
|
2012-11-12 16:53:47 +01:00
|
|
|
|
2014-05-22 09:09:21 +02:00
|
|
|
#if !defined(_MSC_VER) || defined(__clang__)
|
|
|
|
# define UNUSED __attribute__((unused))
|
|
|
|
# define USED __attribute__((used))
|
|
|
|
#else
|
|
|
|
# define UNUSED
|
|
|
|
# define USED
|
|
|
|
#endif
|
|
|
|
|
2015-10-21 09:32:45 +02:00
|
|
|
#if !defined(_MSC_VER) || defined(__clang__) || MSC_PREREQ(1900)
|
|
|
|
# define NOEXCEPT noexcept
|
|
|
|
#else
|
|
|
|
# define NOEXCEPT throw()
|
|
|
|
#endif
|
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
// Unaligned versions of basic types.
|
|
|
|
typedef ALIGNED(1) u16 uu16;
|
|
|
|
typedef ALIGNED(1) u32 uu32;
|
|
|
|
typedef ALIGNED(1) u64 uu64;
|
|
|
|
typedef ALIGNED(1) s16 us16;
|
|
|
|
typedef ALIGNED(1) s32 us32;
|
|
|
|
typedef ALIGNED(1) s64 us64;
|
|
|
|
|
|
|
|
#if SANITIZER_WINDOWS
|
2016-11-08 23:04:09 +01:00
|
|
|
} // namespace __sanitizer
|
2019-11-05 14:54:57 +01:00
|
|
|
typedef unsigned long DWORD;
|
2016-11-08 23:04:09 +01:00
|
|
|
namespace __sanitizer {
|
2012-11-12 16:53:47 +01:00
|
|
|
typedef DWORD thread_return_t;
|
|
|
|
# define THREAD_CALLING_CONV __stdcall
|
|
|
|
#else // _WIN32
|
|
|
|
typedef void* thread_return_t;
|
|
|
|
# define THREAD_CALLING_CONV
|
|
|
|
#endif // _WIN32
|
|
|
|
typedef thread_return_t (THREAD_CALLING_CONV *thread_callback_t)(void* arg);
|
|
|
|
|
|
|
|
// NOTE: Functions below must be defined in each run-time.
|
|
|
|
void NORETURN Die();
|
2013-11-04 22:33:31 +01:00
|
|
|
|
2012-11-12 16:53:47 +01:00
|
|
|
void NORETURN CheckFailed(const char *file, int line, const char *cond,
|
|
|
|
u64 v1, u64 v2);
|
|
|
|
|
|
|
|
// Check macro
|
|
|
|
#define RAW_CHECK_MSG(expr, msg) do { \
|
2014-05-22 09:09:21 +02:00
|
|
|
if (UNLIKELY(!(expr))) { \
|
2012-11-12 16:53:47 +01:00
|
|
|
RawWrite(msg); \
|
|
|
|
Die(); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define RAW_CHECK(expr) RAW_CHECK_MSG(expr, #expr)
|
|
|
|
|
|
|
|
#define CHECK_IMPL(c1, op, c2) \
|
|
|
|
do { \
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
__sanitizer::u64 v1 = (__sanitizer::u64)(c1); \
|
|
|
|
__sanitizer::u64 v2 = (__sanitizer::u64)(c2); \
|
2014-05-22 09:09:21 +02:00
|
|
|
if (UNLIKELY(!(v1 op v2))) \
|
2012-11-12 16:53:47 +01:00
|
|
|
__sanitizer::CheckFailed(__FILE__, __LINE__, \
|
|
|
|
"(" #c1 ") " #op " (" #c2 ")", v1, v2); \
|
|
|
|
} while (false) \
|
|
|
|
/**/
|
|
|
|
|
|
|
|
#define CHECK(a) CHECK_IMPL((a), !=, 0)
|
|
|
|
#define CHECK_EQ(a, b) CHECK_IMPL((a), ==, (b))
|
|
|
|
#define CHECK_NE(a, b) CHECK_IMPL((a), !=, (b))
|
|
|
|
#define CHECK_LT(a, b) CHECK_IMPL((a), <, (b))
|
|
|
|
#define CHECK_LE(a, b) CHECK_IMPL((a), <=, (b))
|
|
|
|
#define CHECK_GT(a, b) CHECK_IMPL((a), >, (b))
|
|
|
|
#define CHECK_GE(a, b) CHECK_IMPL((a), >=, (b))
|
|
|
|
|
2015-10-21 09:32:45 +02:00
|
|
|
#if SANITIZER_DEBUG
|
2012-11-12 16:53:47 +01:00
|
|
|
#define DCHECK(a) CHECK(a)
|
|
|
|
#define DCHECK_EQ(a, b) CHECK_EQ(a, b)
|
|
|
|
#define DCHECK_NE(a, b) CHECK_NE(a, b)
|
|
|
|
#define DCHECK_LT(a, b) CHECK_LT(a, b)
|
|
|
|
#define DCHECK_LE(a, b) CHECK_LE(a, b)
|
|
|
|
#define DCHECK_GT(a, b) CHECK_GT(a, b)
|
|
|
|
#define DCHECK_GE(a, b) CHECK_GE(a, b)
|
|
|
|
#else
|
|
|
|
#define DCHECK(a)
|
|
|
|
#define DCHECK_EQ(a, b)
|
|
|
|
#define DCHECK_NE(a, b)
|
|
|
|
#define DCHECK_LT(a, b)
|
|
|
|
#define DCHECK_LE(a, b)
|
|
|
|
#define DCHECK_GT(a, b)
|
|
|
|
#define DCHECK_GE(a, b)
|
|
|
|
#endif
|
|
|
|
|
2012-11-23 15:46:25 +01:00
|
|
|
#define UNREACHABLE(msg) do { \
|
|
|
|
CHECK(0 && msg); \
|
|
|
|
Die(); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define UNIMPLEMENTED() UNREACHABLE("unimplemented")
|
2012-11-12 16:53:47 +01:00
|
|
|
|
2020-10-16 10:03:04 +02:00
|
|
|
#define COMPILER_CHECK(pred) static_assert(pred, "")
|
2012-11-12 16:53:47 +01:00
|
|
|
|
|
|
|
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
|
|
|
|
|
|
|
|
// Limits for integral types. We have to redefine it in case we don't
|
|
|
|
// have stdint.h (like in Visual Studio 9).
|
|
|
|
#undef __INT64_C
|
|
|
|
#undef __UINT64_C
|
2012-11-23 15:46:25 +01:00
|
|
|
#if SANITIZER_WORDSIZE == 64
|
2012-11-12 16:53:47 +01:00
|
|
|
# define __INT64_C(c) c ## L
|
|
|
|
# define __UINT64_C(c) c ## UL
|
|
|
|
#else
|
|
|
|
# define __INT64_C(c) c ## LL
|
|
|
|
# define __UINT64_C(c) c ## ULL
|
2012-11-23 15:46:25 +01:00
|
|
|
#endif // SANITIZER_WORDSIZE == 64
|
2012-11-12 16:53:47 +01:00
|
|
|
#undef INT32_MIN
|
|
|
|
#define INT32_MIN (-2147483647-1)
|
|
|
|
#undef INT32_MAX
|
|
|
|
#define INT32_MAX (2147483647)
|
|
|
|
#undef UINT32_MAX
|
|
|
|
#define UINT32_MAX (4294967295U)
|
|
|
|
#undef INT64_MIN
|
|
|
|
#define INT64_MIN (-__INT64_C(9223372036854775807)-1)
|
|
|
|
#undef INT64_MAX
|
|
|
|
#define INT64_MAX (__INT64_C(9223372036854775807))
|
|
|
|
#undef UINT64_MAX
|
|
|
|
#define UINT64_MAX (__UINT64_C(18446744073709551615))
|
2018-10-31 12:14:23 +01:00
|
|
|
#undef UINTPTR_MAX
|
|
|
|
#if SANITIZER_WORDSIZE == 64
|
|
|
|
# define UINTPTR_MAX (18446744073709551615UL)
|
|
|
|
#else
|
|
|
|
# define UINTPTR_MAX (4294967295U)
|
|
|
|
#endif // SANITIZER_WORDSIZE == 64
|
2012-11-12 16:53:47 +01:00
|
|
|
|
|
|
|
enum LinkerInitialized { LINKER_INITIALIZED = 0 };
|
|
|
|
|
|
|
|
#if !defined(_MSC_VER) || defined(__clang__)
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
#if SANITIZER_S390_31
|
|
|
|
#define GET_CALLER_PC() \
|
|
|
|
(__sanitizer::uptr) __builtin_extract_return_addr(__builtin_return_address(0))
|
|
|
|
#else
|
|
|
|
#define GET_CALLER_PC() (__sanitizer::uptr) __builtin_return_address(0)
|
|
|
|
#endif
|
|
|
|
#define GET_CURRENT_FRAME() (__sanitizer::uptr) __builtin_frame_address(0)
|
2016-11-08 23:04:09 +01:00
|
|
|
inline void Trap() {
|
|
|
|
__builtin_trap();
|
|
|
|
}
|
2012-11-12 16:53:47 +01:00
|
|
|
#else
|
|
|
|
extern "C" void* _ReturnAddress(void);
|
2016-11-08 23:04:09 +01:00
|
|
|
extern "C" void* _AddressOfReturnAddress(void);
|
2012-11-12 16:53:47 +01:00
|
|
|
# pragma intrinsic(_ReturnAddress)
|
2016-11-08 23:04:09 +01:00
|
|
|
# pragma intrinsic(_AddressOfReturnAddress)
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
#define GET_CALLER_PC() (__sanitizer::uptr) _ReturnAddress()
|
2012-11-12 16:53:47 +01:00
|
|
|
// CaptureStackBackTrace doesn't need to know BP on Windows.
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
#define GET_CURRENT_FRAME() \
|
|
|
|
(((__sanitizer::uptr)_AddressOfReturnAddress()) + sizeof(__sanitizer::uptr))
|
2016-11-08 23:04:09 +01:00
|
|
|
|
|
|
|
extern "C" void __ud2(void);
|
|
|
|
# pragma intrinsic(__ud2)
|
|
|
|
inline void Trap() {
|
|
|
|
__ud2();
|
|
|
|
}
|
2012-11-12 16:53:47 +01:00
|
|
|
#endif
|
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
#define HANDLE_EINTR(res, f) \
|
|
|
|
{ \
|
|
|
|
int rverrno; \
|
|
|
|
do { \
|
|
|
|
res = (f); \
|
|
|
|
} while (internal_iserror(res, &rverrno) && rverrno == EINTR); \
|
2012-11-12 16:53:47 +01:00
|
|
|
}
|
|
|
|
|
2015-10-21 09:32:45 +02:00
|
|
|
// Forces the compiler to generate a frame pointer in the function.
|
ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch builtins...
* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
builtins, store max (log2 (align), 0) into uchar field instead of
align into uptr field.
(ubsan_expand_objsize_ifn): Use _v1 suffixed type mismatch builtins,
store uchar 0 field instead of uptr 0 field.
(instrument_nonnull_return): Use _v1 suffixed nonnull return builtin,
instead of passing one address of struct with 2 locations pass
two addresses of structs with 1 location each.
* sanitizer.def (BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_ABORT): Removed.
(BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1,
BUILT_IN_UBSAN_HANDLE_TYPE_MISMATCH_V1_ABORT,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1,
BUILT_IN_UBSAN_HANDLE_NONNULL_RETURN_V1_ABORT): New builtins.
* c-c++-common/ubsan/float-cast-overflow-1.c: Drop value keyword
from expected output regexps.
* c-c++-common/ubsan/float-cast-overflow-2.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-3.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-4.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-5.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-6.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-8.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
* c-c++-common/ubsan/float-cast-overflow-10.c: Likewise.
* g++.dg/ubsan/float-cast-overflow-bf.C: Likewise.
* gcc.dg/ubsan/float-cast-overflow-bf.c: Likewise.
* g++.dg/asan/default-options-1.C (__asan_default_options): Add
used attribute.
* g++.dg/asan/asan_test.C: Run with ASAN_OPTIONS=handle_segv=2
in the environment.
* All source files: Merge from upstream 315899.
* asan/Makefile.am (nodist_saninclude_HEADERS): Add
include/sanitizer/tsan_interface.h.
* asan/libtool-version: Bump the libasan SONAME.
* lsan/Makefile.am (sanitizer_lsan_files): Add lsan_common_mac.cc.
(lsan_files): Add lsan_linux.cc, lsan_mac.cc and lsan_malloc_mac.cc.
* sanitizer_common/Makefile.am (sanitizer_common_files): Add
sancov_flags.cc, sanitizer_allocator_checks.cc,
sanitizer_coverage_libcdep_new.cc, sanitizer_errno.cc,
sanitizer_file.cc, sanitizer_mac_libcdep.cc and
sanitizer_stoptheworld_mac.cc. Remove sanitizer_coverage_libcdep.cc
and sanitizer_coverage_mapping_libcdep.cc.
* tsan/Makefile.am (tsan_files): Add tsan_external.cc.
* ubsan/Makefile.am (DEFS): Add -DUBSAN_CAN_USE_CXXABI=1.
(ubsan_files): Add ubsan_init_standalone.cc and
ubsan_signals_standalone.cc.
* ubsan/libtool-version: Bump the libubsan SONAME.
* asan/Makefile.in: Regenerate.
* lsan/Makefile.in: Regenerate.
* sanitizer_common/Makefile.in: Regenerate.
* tsan/Makefile.in: Regenerate.
* ubsan/Makefile.in: Regenerate.
From-SVN: r253887
2017-10-19 13:23:59 +02:00
|
|
|
#define ENABLE_FRAME_POINTER \
|
|
|
|
do { \
|
|
|
|
volatile __sanitizer::uptr enable_fp; \
|
|
|
|
enable_fp = GET_CURRENT_FRAME(); \
|
|
|
|
(void)enable_fp; \
|
2015-10-21 09:32:45 +02:00
|
|
|
} while (0)
|
|
|
|
|
2016-11-08 23:04:09 +01:00
|
|
|
} // namespace __sanitizer
|
|
|
|
|
2019-11-05 14:54:57 +01:00
|
|
|
namespace __asan {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __dsan {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __dfsan {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __lsan {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __msan {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __hwasan {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __tsan {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __scudo {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __ubsan {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __xray {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __interception {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
|
|
|
namespace __hwasan {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
2020-11-13 17:03:23 +01:00
|
|
|
namespace __memprof {
|
|
|
|
using namespace __sanitizer;
|
|
|
|
}
|
2016-11-08 23:04:09 +01:00
|
|
|
|
2012-11-12 16:53:47 +01:00
|
|
|
#endif // SANITIZER_DEFS_H
|