2019-08-14 10:47:11 +02:00
|
|
|
//===-- sanitizer_common_libcdep.cpp --------------------------------------===//
|
2013-11-04 22:33:31 +01:00
|
|
|
//
|
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
|
2013-11-04 22:33:31 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file is shared between AddressSanitizer and ThreadSanitizer
|
|
|
|
// run-time libraries.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-11-08 23:04:09 +01:00
|
|
|
#include "sanitizer_allocator_interface.h"
|
2018-10-31 12:14:23 +01:00
|
|
|
#include "sanitizer_common.h"
|
2014-05-22 09:09:21 +02:00
|
|
|
#include "sanitizer_flags.h"
|
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
|
|
|
#include "sanitizer_procmaps.h"
|
2013-11-04 22:33:31 +01:00
|
|
|
|
2015-10-21 09:32:45 +02:00
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
namespace __sanitizer {
|
|
|
|
|
2015-10-21 09:32:45 +02:00
|
|
|
static void (*SoftRssLimitExceededCallback)(bool exceeded);
|
|
|
|
void SetSoftRssLimitExceededCallback(void (*Callback)(bool exceeded)) {
|
|
|
|
CHECK_EQ(SoftRssLimitExceededCallback, nullptr);
|
|
|
|
SoftRssLimitExceededCallback = Callback;
|
|
|
|
}
|
|
|
|
|
2019-08-14 10:47:11 +02:00
|
|
|
#if (SANITIZER_LINUX || SANITIZER_NETBSD) && !SANITIZER_GO
|
2018-10-31 12:14:23 +01:00
|
|
|
// Weak default implementation for when sanitizer_stackdepot is not linked in.
|
2021-10-06 19:24:24 +02:00
|
|
|
SANITIZER_WEAK_ATTRIBUTE StackDepotStats StackDepotGetStats() { return {}; }
|
2018-10-31 12:14:23 +01:00
|
|
|
|
2020-06-01 21:15:18 +02:00
|
|
|
void *BackgroundThread(void *arg) {
|
2018-10-31 12:14:23 +01:00
|
|
|
const uptr hard_rss_limit_mb = common_flags()->hard_rss_limit_mb;
|
|
|
|
const uptr soft_rss_limit_mb = common_flags()->soft_rss_limit_mb;
|
|
|
|
const bool heap_profile = common_flags()->heap_profile;
|
2015-10-21 09:32:45 +02:00
|
|
|
uptr prev_reported_rss = 0;
|
|
|
|
uptr prev_reported_stack_depot_size = 0;
|
|
|
|
bool reached_soft_rss_limit = false;
|
2016-11-08 23:04:09 +01:00
|
|
|
uptr rss_during_last_reported_profile = 0;
|
2015-10-21 09:32:45 +02:00
|
|
|
while (true) {
|
|
|
|
SleepForMillis(100);
|
2018-10-31 12:14:23 +01:00
|
|
|
const uptr current_rss_mb = GetRSS() >> 20;
|
2015-10-21 09:32:45 +02:00
|
|
|
if (Verbosity()) {
|
|
|
|
// If RSS has grown 10% since last time, print some information.
|
|
|
|
if (prev_reported_rss * 11 / 10 < current_rss_mb) {
|
|
|
|
Printf("%s: RSS: %zdMb\n", SanitizerToolName, current_rss_mb);
|
|
|
|
prev_reported_rss = current_rss_mb;
|
|
|
|
}
|
|
|
|
// If stack depot has grown 10% since last time, print it too.
|
2021-10-06 19:24:24 +02:00
|
|
|
StackDepotStats stack_depot_stats = StackDepotGetStats();
|
|
|
|
if (prev_reported_stack_depot_size * 11 / 10 <
|
|
|
|
stack_depot_stats.allocated) {
|
|
|
|
Printf("%s: StackDepot: %zd ids; %zdM allocated\n", SanitizerToolName,
|
|
|
|
stack_depot_stats.n_uniq_ids, stack_depot_stats.allocated >> 20);
|
|
|
|
prev_reported_stack_depot_size = stack_depot_stats.allocated;
|
2015-10-21 09:32:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Check RSS against the limit.
|
|
|
|
if (hard_rss_limit_mb && hard_rss_limit_mb < current_rss_mb) {
|
|
|
|
Report("%s: hard rss limit exhausted (%zdMb vs %zdMb)\n",
|
|
|
|
SanitizerToolName, hard_rss_limit_mb, current_rss_mb);
|
|
|
|
DumpProcessMap();
|
|
|
|
Die();
|
|
|
|
}
|
|
|
|
if (soft_rss_limit_mb) {
|
|
|
|
if (soft_rss_limit_mb < current_rss_mb && !reached_soft_rss_limit) {
|
|
|
|
reached_soft_rss_limit = true;
|
|
|
|
Report("%s: soft rss limit exhausted (%zdMb vs %zdMb)\n",
|
|
|
|
SanitizerToolName, soft_rss_limit_mb, current_rss_mb);
|
|
|
|
if (SoftRssLimitExceededCallback)
|
|
|
|
SoftRssLimitExceededCallback(true);
|
|
|
|
} else if (soft_rss_limit_mb >= current_rss_mb &&
|
|
|
|
reached_soft_rss_limit) {
|
|
|
|
reached_soft_rss_limit = false;
|
|
|
|
if (SoftRssLimitExceededCallback)
|
|
|
|
SoftRssLimitExceededCallback(false);
|
|
|
|
}
|
|
|
|
}
|
2016-11-08 23:04:09 +01:00
|
|
|
if (heap_profile &&
|
|
|
|
current_rss_mb > rss_during_last_reported_profile * 1.1) {
|
|
|
|
Printf("\n\nHEAP PROFILE at RSS %zdMb\n", current_rss_mb);
|
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_print_memory_profile(90, 20);
|
2016-11-08 23:04:09 +01:00
|
|
|
rss_during_last_reported_profile = current_rss_mb;
|
|
|
|
}
|
2015-10-21 09:32:45 +02:00
|
|
|
}
|
|
|
|
}
|
2016-11-08 23:04:09 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
void WriteToSyslog(const char *msg) {
|
2021-05-12 14:37:22 +02:00
|
|
|
InternalScopedString msg_copy;
|
2016-11-08 23:04:09 +01:00
|
|
|
msg_copy.append("%s", msg);
|
2021-05-12 14:37:22 +02:00
|
|
|
const char *p = msg_copy.data();
|
2016-11-08 23:04:09 +01:00
|
|
|
|
|
|
|
// Print one line at a time.
|
|
|
|
// syslog, at least on Android, has an implicit message length limit.
|
2021-05-12 14:37:22 +02:00
|
|
|
while (char* q = internal_strchr(p, '\n')) {
|
2018-10-31 12:14:23 +01:00
|
|
|
*q = '\0';
|
|
|
|
WriteOneLineToSyslog(p);
|
|
|
|
p = q + 1;
|
|
|
|
}
|
|
|
|
// Print remaining characters, if there are any.
|
|
|
|
// Note that this will add an extra newline at the end.
|
|
|
|
// FIXME: buffer extra output. This would need a thread-local buffer, which
|
|
|
|
// on Android requires plugging into the tools (ex. ASan's) Thread class.
|
|
|
|
if (*p)
|
2016-11-08 23:04:09 +01:00
|
|
|
WriteOneLineToSyslog(p);
|
|
|
|
}
|
2015-10-21 09:32:45 +02:00
|
|
|
|
|
|
|
void MaybeStartBackgroudThread() {
|
2019-08-14 10:47:11 +02:00
|
|
|
#if (SANITIZER_LINUX || SANITIZER_NETBSD) && \
|
2016-11-08 23:04:09 +01:00
|
|
|
!SANITIZER_GO // Need to implement/test on other platforms.
|
2015-10-21 09:32:45 +02:00
|
|
|
// Start the background thread if one of the rss limits is given.
|
|
|
|
if (!common_flags()->hard_rss_limit_mb &&
|
2016-11-08 23:04:09 +01:00
|
|
|
!common_flags()->soft_rss_limit_mb &&
|
|
|
|
!common_flags()->heap_profile) return;
|
2015-10-21 09:32:45 +02:00
|
|
|
if (!&real_pthread_create) return; // Can't spawn the thread anyway.
|
|
|
|
internal_start_thread(BackgroundThread, nullptr);
|
2014-09-23 19:59:53 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-10-31 12:14:23 +01:00
|
|
|
static void (*sandboxing_callback)();
|
|
|
|
void SetSandboxingCallback(void (*f)()) {
|
|
|
|
sandboxing_callback = f;
|
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
|
|
|
}
|
|
|
|
|
2020-06-01 21:15:18 +02:00
|
|
|
uptr ReservedAddressRange::InitAligned(uptr size, uptr align,
|
|
|
|
const char *name) {
|
|
|
|
CHECK(IsPowerOfTwo(align));
|
|
|
|
if (align <= GetPageSizeCached())
|
|
|
|
return Init(size, name);
|
|
|
|
uptr start = Init(size + align, name);
|
|
|
|
start += align - (start & (align - 1));
|
|
|
|
return start;
|
|
|
|
}
|
|
|
|
|
2021-07-20 19:44:37 +02:00
|
|
|
#if !SANITIZER_FUCHSIA
|
2020-10-16 10:03:04 +02:00
|
|
|
|
|
|
|
// Reserve memory range [beg, end].
|
|
|
|
// We need to use inclusive range because end+1 may not be representable.
|
|
|
|
void ReserveShadowMemoryRange(uptr beg, uptr end, const char *name,
|
|
|
|
bool madvise_shadow) {
|
|
|
|
CHECK_EQ((beg % GetMmapGranularity()), 0);
|
|
|
|
CHECK_EQ(((end + 1) % GetMmapGranularity()), 0);
|
|
|
|
uptr size = end - beg + 1;
|
|
|
|
DecreaseTotalMmap(size); // Don't count the shadow against mmap_limit_mb.
|
|
|
|
if (madvise_shadow ? !MmapFixedSuperNoReserve(beg, size, name)
|
|
|
|
: !MmapFixedNoReserve(beg, size, name)) {
|
|
|
|
Report(
|
|
|
|
"ReserveShadowMemoryRange failed while trying to map 0x%zx bytes. "
|
|
|
|
"Perhaps you're using ulimit -v\n",
|
|
|
|
size);
|
|
|
|
Abort();
|
|
|
|
}
|
|
|
|
if (madvise_shadow && common_flags()->use_madv_dontdump)
|
|
|
|
DontDumpShadowMemory(beg, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProtectGap(uptr addr, uptr size, uptr zero_base_shadow_start,
|
|
|
|
uptr zero_base_max_shadow_start) {
|
|
|
|
if (!size)
|
|
|
|
return;
|
|
|
|
void *res = MmapFixedNoAccess(addr, size, "shadow gap");
|
|
|
|
if (addr == (uptr)res)
|
|
|
|
return;
|
|
|
|
// A few pages at the start of the address space can not be protected.
|
|
|
|
// But we really want to protect as much as possible, to prevent this memory
|
|
|
|
// being returned as a result of a non-FIXED mmap().
|
|
|
|
if (addr == zero_base_shadow_start) {
|
|
|
|
uptr step = GetMmapGranularity();
|
|
|
|
while (size > step && addr < zero_base_max_shadow_start) {
|
|
|
|
addr += step;
|
|
|
|
size -= step;
|
|
|
|
void *res = MmapFixedNoAccess(addr, size, "shadow gap");
|
|
|
|
if (addr == (uptr)res)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Report(
|
|
|
|
"ERROR: Failed to protect the shadow gap. "
|
|
|
|
"%s cannot proceed correctly. ABORTING.\n",
|
|
|
|
SanitizerToolName);
|
|
|
|
DumpProcessMap();
|
|
|
|
Die();
|
|
|
|
}
|
|
|
|
|
2021-07-20 19:44:37 +02:00
|
|
|
#endif // !SANITIZER_FUCHSIA
|
2020-10-16 10:03:04 +02:00
|
|
|
|
2013-11-04 22:33:31 +01:00
|
|
|
} // namespace __sanitizer
|
2014-09-23 19:59:53 +02: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
|
|
|
SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_sandbox_on_notify,
|
|
|
|
__sanitizer_sandbox_arguments *args) {
|
2018-10-31 12:14:23 +01:00
|
|
|
__sanitizer::PlatformPrepareForSandboxing(args);
|
2016-11-08 23:04:09 +01:00
|
|
|
if (__sanitizer::sandboxing_callback)
|
|
|
|
__sanitizer::sandboxing_callback();
|
2014-09-23 19:59:53 +02:00
|
|
|
}
|