svn commit: r278497 - in vendor/compiler-rt/dist: . cmake cmake/Modules include include/sanitizer lib/asan lib/asan/scripts lib/asan/tests lib/builtins lib/dfsan lib/lsan lib/msan lib/msan/tests li...
Dimitry Andric
dim at FreeBSD.org
Tue Feb 10 07:45:48 UTC 2015
Author: dim
Date: Tue Feb 10 07:45:43 2015
New Revision: 278497
URL: https://svnweb.freebsd.org/changeset/base/278497
Log:
Import compiler-rt trunk r228651.
https://llvm.org/svn/llvm-project/compiler-rt/trunk@228651
Added:
vendor/compiler-rt/dist/include/sanitizer/coverage_interface.h (contents, props changed)
vendor/compiler-rt/dist/lib/asan/asan_activation_flags.inc (contents, props changed)
vendor/compiler-rt/dist/lib/asan/asan_allocator.cc (contents, props changed)
vendor/compiler-rt/dist/lib/asan/asan_flags.cc (contents, props changed)
vendor/compiler-rt/dist/lib/asan/asan_flags.inc (contents, props changed)
vendor/compiler-rt/dist/lib/dfsan/dfsan_flags.inc (contents, props changed)
vendor/compiler-rt/dist/lib/lsan/lsan_flags.inc (contents, props changed)
vendor/compiler-rt/dist/lib/msan/msan_flags.inc (contents, props changed)
vendor/compiler-rt/dist/lib/msan/msan_poisoning.cc (contents, props changed)
vendor/compiler-rt/dist/lib/msan/msan_poisoning.h (contents, props changed)
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flag_parser.cc (contents, props changed)
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flag_parser.h (contents, props changed)
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc (contents, props changed)
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_flags.inc (contents, props changed)
vendor/compiler-rt/dist/lib/ubsan/ubsan_flags.inc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/address-range-limit.mm
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/crashlog-stacktraces.c (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/dyld_insert_libraries_remove.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/linked-only.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/mixing-global-constructors.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-direct-activation.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-reset.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Linux/nohugepage_test.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Linux/quarantine_size_mb.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Linux/stack-overflow-sigbus.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Windows/iostream_sbo.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Windows/shadow_mapping_failure.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/Windows/thread_suspended.cc (contents, props changed)
vendor/compiler-rt/dist/test/asan/TestCases/asan_options-help.cc (contents, props changed)
vendor/compiler-rt/dist/test/msan/origin-store-long.cc (contents, props changed)
vendor/compiler-rt/dist/test/msan/realloc-large-origin.cc (contents, props changed)
vendor/compiler-rt/dist/test/msan/realloc-origin.cc (contents, props changed)
vendor/compiler-rt/dist/test/sanitizer_common/TestCases/Linux/hard_rss_limit_mb_test.cc (contents, props changed)
vendor/compiler-rt/dist/test/sanitizer_common/TestCases/Linux/sanitizer_set_death_callback_test.cc (contents, props changed)
vendor/compiler-rt/dist/test/sanitizer_common/TestCases/Linux/sched_getparam.cc (contents, props changed)
vendor/compiler-rt/dist/test/sanitizer_common/TestCases/Linux/soft_rss_limit_mb_test.cc (contents, props changed)
vendor/compiler-rt/dist/test/sanitizer_common/TestCases/options-help.cc (contents, props changed)
vendor/compiler-rt/dist/test/sanitizer_common/TestCases/options-include.cc (contents, props changed)
vendor/compiler-rt/dist/test/sanitizer_common/TestCases/options-invalid.cc (contents, props changed)
vendor/compiler-rt/dist/test/tsan/annotate_happens_before.cc (contents, props changed)
vendor/compiler-rt/dist/test/tsan/java_volatile.cc (contents, props changed)
vendor/compiler-rt/dist/test/tsan/real_deadlock_detector_stress_test.cc (contents, props changed)
vendor/compiler-rt/dist/test/tsan/restore_stack.cc (contents, props changed)
vendor/compiler-rt/dist/test/tsan/signal_reset.cc (contents, props changed)
vendor/compiler-rt/dist/test/tsan/signal_thread.cc (contents, props changed)
vendor/compiler-rt/dist/test/tsan/stack_sync_reuse.cc (contents, props changed)
vendor/compiler-rt/dist/test/tsan/test.h (contents, props changed)
vendor/compiler-rt/dist/test/ubsan/TestCases/Misc/coverage-levels.cc (contents, props changed)
Deleted:
vendor/compiler-rt/dist/lib/asan/asan_allocator2.cc
vendor/compiler-rt/dist/make/platform/darwin_fat.mk
vendor/compiler-rt/dist/test/tsan/process_sleep.h
Modified:
vendor/compiler-rt/dist/CMakeLists.txt
vendor/compiler-rt/dist/cmake/Modules/AddCompilerRT.cmake
vendor/compiler-rt/dist/cmake/Modules/CompilerRTCompile.cmake
vendor/compiler-rt/dist/cmake/config-ix.cmake
vendor/compiler-rt/dist/include/CMakeLists.txt
vendor/compiler-rt/dist/include/sanitizer/asan_interface.h
vendor/compiler-rt/dist/include/sanitizer/common_interface_defs.h
vendor/compiler-rt/dist/include/sanitizer/msan_interface.h
vendor/compiler-rt/dist/lib/asan/CMakeLists.txt
vendor/compiler-rt/dist/lib/asan/asan_activation.cc
vendor/compiler-rt/dist/lib/asan/asan_activation.h
vendor/compiler-rt/dist/lib/asan/asan_allocator.h
vendor/compiler-rt/dist/lib/asan/asan_debugging.cc
vendor/compiler-rt/dist/lib/asan/asan_fake_stack.cc
vendor/compiler-rt/dist/lib/asan/asan_flags.h
vendor/compiler-rt/dist/lib/asan/asan_globals.cc
vendor/compiler-rt/dist/lib/asan/asan_init_version.h
vendor/compiler-rt/dist/lib/asan/asan_interceptors.cc
vendor/compiler-rt/dist/lib/asan/asan_internal.h
vendor/compiler-rt/dist/lib/asan/asan_linux.cc
vendor/compiler-rt/dist/lib/asan/asan_mac.cc
vendor/compiler-rt/dist/lib/asan/asan_malloc_mac.cc
vendor/compiler-rt/dist/lib/asan/asan_mapping.h
vendor/compiler-rt/dist/lib/asan/asan_poisoning.cc
vendor/compiler-rt/dist/lib/asan/asan_poisoning.h
vendor/compiler-rt/dist/lib/asan/asan_report.cc
vendor/compiler-rt/dist/lib/asan/asan_rtl.cc
vendor/compiler-rt/dist/lib/asan/asan_stack.cc
vendor/compiler-rt/dist/lib/asan/asan_stack.h
vendor/compiler-rt/dist/lib/asan/scripts/asan_device_setup
vendor/compiler-rt/dist/lib/asan/scripts/asan_symbolize.py
vendor/compiler-rt/dist/lib/asan/tests/CMakeLists.txt
vendor/compiler-rt/dist/lib/asan/tests/asan_interface_test.cc
vendor/compiler-rt/dist/lib/asan/tests/asan_noinst_test.cc
vendor/compiler-rt/dist/lib/asan/tests/asan_test.cc
vendor/compiler-rt/dist/lib/builtins/CMakeLists.txt
vendor/compiler-rt/dist/lib/builtins/atomic.c
vendor/compiler-rt/dist/lib/builtins/clear_cache.c
vendor/compiler-rt/dist/lib/builtins/gcc_personality_v0.c
vendor/compiler-rt/dist/lib/builtins/int_types.h
vendor/compiler-rt/dist/lib/dfsan/CMakeLists.txt
vendor/compiler-rt/dist/lib/dfsan/dfsan.cc
vendor/compiler-rt/dist/lib/dfsan/dfsan.h
vendor/compiler-rt/dist/lib/dfsan/dfsan_custom.cc
vendor/compiler-rt/dist/lib/lsan/lsan.cc
vendor/compiler-rt/dist/lib/lsan/lsan_allocator.cc
vendor/compiler-rt/dist/lib/lsan/lsan_common.cc
vendor/compiler-rt/dist/lib/lsan/lsan_common.h
vendor/compiler-rt/dist/lib/msan/CMakeLists.txt
vendor/compiler-rt/dist/lib/msan/msan.cc
vendor/compiler-rt/dist/lib/msan/msan.h
vendor/compiler-rt/dist/lib/msan/msan_allocator.cc
vendor/compiler-rt/dist/lib/msan/msan_flags.h
vendor/compiler-rt/dist/lib/msan/msan_interceptors.cc
vendor/compiler-rt/dist/lib/msan/msan_linux.cc
vendor/compiler-rt/dist/lib/msan/msan_report.cc
vendor/compiler-rt/dist/lib/msan/msan_thread.cc
vendor/compiler-rt/dist/lib/msan/tests/CMakeLists.txt
vendor/compiler-rt/dist/lib/msan/tests/msan_test.cc
vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c
vendor/compiler-rt/dist/lib/sanitizer_common/CMakeLists.txt
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_internal.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_libcdep.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_deadlock_detector.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_internal_defs.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_libc.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_libc.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_list.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mutex.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_interceptors.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix_libcdep.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_quarantine.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stackdepot.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_unwind_posix_libcdep.cc
vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win.cc
vendor/compiler-rt/dist/lib/sanitizer_common/scripts/check_lint.sh
vendor/compiler-rt/dist/lib/sanitizer_common/scripts/sancov.py
vendor/compiler-rt/dist/lib/sanitizer_common/tests/CMakeLists.txt
vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_deadlock_detector_test.cc
vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_flags_test.cc
vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_libc_test.cc
vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_printf_test.cc
vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_procmaps_test.cc
vendor/compiler-rt/dist/lib/sanitizer_common/tests/sanitizer_test_utils.h
vendor/compiler-rt/dist/lib/tsan/CMakeLists.txt
vendor/compiler-rt/dist/lib/tsan/Makefile.old
vendor/compiler-rt/dist/lib/tsan/check_analyze.sh
vendor/compiler-rt/dist/lib/tsan/dd/dd_rtl.cc
vendor/compiler-rt/dist/lib/tsan/go/build.bat
vendor/compiler-rt/dist/lib/tsan/go/buildgo.sh
vendor/compiler-rt/dist/lib/tsan/go/tsan_go.cc
vendor/compiler-rt/dist/lib/tsan/rtl/Makefile.old
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_clock.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_defs.h
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_flags.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_flags.h
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface.h
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_java.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_java.h
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mman.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mman.h
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mutex.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mutex.h
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform.h
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_linux.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_mac.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc
vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_thread.cc
vendor/compiler-rt/dist/lib/tsan/tests/CMakeLists.txt
vendor/compiler-rt/dist/lib/tsan/tests/rtl/tsan_string.cc
vendor/compiler-rt/dist/lib/tsan/tests/unit/tsan_clock_test.cc
vendor/compiler-rt/dist/lib/tsan/tests/unit/tsan_mman_test.cc
vendor/compiler-rt/dist/lib/tsan/tests/unit/tsan_mutex_test.cc
vendor/compiler-rt/dist/lib/ubsan/CMakeLists.txt
vendor/compiler-rt/dist/lib/ubsan/ubsan_flags.cc
vendor/compiler-rt/dist/lib/ubsan/ubsan_flags.h
vendor/compiler-rt/dist/lib/ubsan/ubsan_init.cc
vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash.cc
vendor/compiler-rt/dist/make/platform/clang_darwin.mk
vendor/compiler-rt/dist/make/platform/darwin_bni.mk
vendor/compiler-rt/dist/test/asan/CMakeLists.txt
vendor/compiler-rt/dist/test/asan/TestCases/Android/coverage-android.cc
vendor/compiler-rt/dist/test/asan/TestCases/Android/lit.local.cfg
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/dyld_insert_libraries_reexec.cc
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/interception-in-shared-lib-test.cc
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/interface_symbols_darwin.c
vendor/compiler-rt/dist/test/asan/TestCases/Darwin/suppressions-darwin.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/asan_preload_test-2.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-caller-callee-total-count.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-direct-large.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-direct.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-disabled.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-levels.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-maybe-open-file.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-module-unloaded.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-sandboxing.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage-tracing.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/coverage.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/malloc-in-qsort.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/overflow-in-qsort.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/sized_delete_test.cc
vendor/compiler-rt/dist/test/asan/TestCases/Linux/stack-trace-dlclose.cc
vendor/compiler-rt/dist/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc
vendor/compiler-rt/dist/test/asan/TestCases/Posix/init-order-dlopen.cc
vendor/compiler-rt/dist/test/asan/TestCases/Posix/large_allocator_unpoisons_on_free.cc
vendor/compiler-rt/dist/test/asan/TestCases/Posix/shared-lib-test.cc
vendor/compiler-rt/dist/test/asan/TestCases/Posix/start-deactivated.cc
vendor/compiler-rt/dist/test/asan/TestCases/Posix/tsd_dtor_leak.cc
vendor/compiler-rt/dist/test/asan/TestCases/allocator_returns_null.cc
vendor/compiler-rt/dist/test/asan/TestCases/deep_call_stack.cc
vendor/compiler-rt/dist/test/asan/TestCases/default_options.cc
vendor/compiler-rt/dist/test/asan/TestCases/dlclose-test.cc
vendor/compiler-rt/dist/test/asan/TestCases/interception_failure_test.cc
vendor/compiler-rt/dist/test/asan/TestCases/log-path_test.cc
vendor/compiler-rt/dist/test/asan/TestCases/stack-overflow.cc
vendor/compiler-rt/dist/test/asan/TestCases/suppressions-function.cc
vendor/compiler-rt/dist/test/asan/TestCases/suppressions-interceptor.cc
vendor/compiler-rt/dist/test/asan/TestCases/suppressions-library.cc
vendor/compiler-rt/dist/test/asan/TestCases/zero_page_pc.cc
vendor/compiler-rt/dist/test/asan/Unit/lit.site.cfg.in
vendor/compiler-rt/dist/test/asan/android_commands/android_run.py
vendor/compiler-rt/dist/test/asan/lit.cfg
vendor/compiler-rt/dist/test/builtins/Unit/clear_cache_test.c
vendor/compiler-rt/dist/test/builtins/Unit/enable_execute_stack_test.c
vendor/compiler-rt/dist/test/lit.common.configured.in
vendor/compiler-rt/dist/test/lsan/TestCases/ignore_object.cc
vendor/compiler-rt/dist/test/lsan/TestCases/ignore_object_errors.cc
vendor/compiler-rt/dist/test/lsan/TestCases/leak_check_at_exit.cc
vendor/compiler-rt/dist/test/lsan/TestCases/leak_check_before_thread_started.cc
vendor/compiler-rt/dist/test/lsan/TestCases/suppressions_file.cc
vendor/compiler-rt/dist/test/msan/msan_print_shadow.cc
vendor/compiler-rt/dist/test/msan/select_float_origin.cc
vendor/compiler-rt/dist/test/msan/use-after-free.cc
vendor/compiler-rt/dist/test/profile/instrprof-basic.c
vendor/compiler-rt/dist/test/profile/instrprof-reset-counters.c
vendor/compiler-rt/dist/test/profile/instrprof-set-filename.c
vendor/compiler-rt/dist/test/profile/instrprof-without-libc.c
vendor/compiler-rt/dist/test/profile/instrprof-write-file-atexit-explicitly.c
vendor/compiler-rt/dist/test/profile/instrprof-write-file-only.c
vendor/compiler-rt/dist/test/profile/instrprof-write-file.c
vendor/compiler-rt/dist/test/tsan/CMakeLists.txt
vendor/compiler-rt/dist/test/tsan/aligned_vs_unaligned_race.cc
vendor/compiler-rt/dist/test/tsan/atomic_free.cc
vendor/compiler-rt/dist/test/tsan/atomic_free2.cc
vendor/compiler-rt/dist/test/tsan/atomic_norace.cc
vendor/compiler-rt/dist/test/tsan/atomic_race.cc
vendor/compiler-rt/dist/test/tsan/atomic_stack.cc
vendor/compiler-rt/dist/test/tsan/benign_race.cc
vendor/compiler-rt/dist/test/tsan/blacklist2.cc
vendor/compiler-rt/dist/test/tsan/cond_cancel.c
vendor/compiler-rt/dist/test/tsan/cond_race.cc
vendor/compiler-rt/dist/test/tsan/deadlock_detector_stress_test.cc
vendor/compiler-rt/dist/test/tsan/deep_stack1.cc
vendor/compiler-rt/dist/test/tsan/fd_close_norace.cc
vendor/compiler-rt/dist/test/tsan/fd_location.cc
vendor/compiler-rt/dist/test/tsan/fd_pipe_race.cc
vendor/compiler-rt/dist/test/tsan/fd_stdout_race.cc
vendor/compiler-rt/dist/test/tsan/fork_deadlock.cc
vendor/compiler-rt/dist/test/tsan/fork_multithreaded.cc
vendor/compiler-rt/dist/test/tsan/free_race.c
vendor/compiler-rt/dist/test/tsan/global_race.cc
vendor/compiler-rt/dist/test/tsan/global_race2.cc
vendor/compiler-rt/dist/test/tsan/global_race3.cc
vendor/compiler-rt/dist/test/tsan/halt_on_error.cc
vendor/compiler-rt/dist/test/tsan/ignore_free.cc
vendor/compiler-rt/dist/test/tsan/ignore_lib0.cc
vendor/compiler-rt/dist/test/tsan/ignore_lib1.cc
vendor/compiler-rt/dist/test/tsan/ignore_lib2.cc
vendor/compiler-rt/dist/test/tsan/ignore_lib3.cc
vendor/compiler-rt/dist/test/tsan/ignore_malloc.cc
vendor/compiler-rt/dist/test/tsan/ignore_race.cc
vendor/compiler-rt/dist/test/tsan/inlined_memcpy_race.cc
vendor/compiler-rt/dist/test/tsan/inlined_memcpy_race2.cc
vendor/compiler-rt/dist/test/tsan/java.h
vendor/compiler-rt/dist/test/tsan/java_finalizer.cc
vendor/compiler-rt/dist/test/tsan/java_lock.cc
vendor/compiler-rt/dist/test/tsan/java_lock_move.cc
vendor/compiler-rt/dist/test/tsan/java_lock_rec.cc
vendor/compiler-rt/dist/test/tsan/java_lock_rec_race.cc
vendor/compiler-rt/dist/test/tsan/java_move_overlap.cc
vendor/compiler-rt/dist/test/tsan/java_move_overlap_race.cc
vendor/compiler-rt/dist/test/tsan/java_race_move.cc
vendor/compiler-rt/dist/test/tsan/java_rwlock.cc
vendor/compiler-rt/dist/test/tsan/load_shared_lib.cc
vendor/compiler-rt/dist/test/tsan/malloc_stack.cc
vendor/compiler-rt/dist/test/tsan/map32bit.cc
vendor/compiler-rt/dist/test/tsan/memcpy_race.cc
vendor/compiler-rt/dist/test/tsan/mop_with_offset.cc
vendor/compiler-rt/dist/test/tsan/mop_with_offset2.cc
vendor/compiler-rt/dist/test/tsan/mutex_cycle2.c
vendor/compiler-rt/dist/test/tsan/mutexset1.cc
vendor/compiler-rt/dist/test/tsan/mutexset2.cc
vendor/compiler-rt/dist/test/tsan/mutexset3.cc
vendor/compiler-rt/dist/test/tsan/mutexset4.cc
vendor/compiler-rt/dist/test/tsan/mutexset5.cc
vendor/compiler-rt/dist/test/tsan/mutexset6.cc
vendor/compiler-rt/dist/test/tsan/mutexset7.cc
vendor/compiler-rt/dist/test/tsan/mutexset8.cc
vendor/compiler-rt/dist/test/tsan/pthread_atfork_deadlock.c
vendor/compiler-rt/dist/test/tsan/race_on_barrier.c
vendor/compiler-rt/dist/test/tsan/race_on_mutex.c
vendor/compiler-rt/dist/test/tsan/race_on_mutex2.c
vendor/compiler-rt/dist/test/tsan/race_on_puts.cc
vendor/compiler-rt/dist/test/tsan/race_on_read.cc
vendor/compiler-rt/dist/test/tsan/race_on_speculative_load.cc
vendor/compiler-rt/dist/test/tsan/race_on_write.cc
vendor/compiler-rt/dist/test/tsan/race_with_finished_thread.cc
vendor/compiler-rt/dist/test/tsan/signal_errno.cc
vendor/compiler-rt/dist/test/tsan/signal_malloc.cc
vendor/compiler-rt/dist/test/tsan/signal_recursive.cc
vendor/compiler-rt/dist/test/tsan/signal_sync.cc
vendor/compiler-rt/dist/test/tsan/signal_write.cc
vendor/compiler-rt/dist/test/tsan/simple_race.c
vendor/compiler-rt/dist/test/tsan/simple_race.cc
vendor/compiler-rt/dist/test/tsan/simple_stack.c
vendor/compiler-rt/dist/test/tsan/simple_stack2.cc
vendor/compiler-rt/dist/test/tsan/sleep_sync.cc
vendor/compiler-rt/dist/test/tsan/sleep_sync2.cc
vendor/compiler-rt/dist/test/tsan/stack_race.cc
vendor/compiler-rt/dist/test/tsan/stack_race2.cc
vendor/compiler-rt/dist/test/tsan/suppress_same_address.cc
vendor/compiler-rt/dist/test/tsan/suppressions_global.cc
vendor/compiler-rt/dist/test/tsan/suppressions_race.cc
vendor/compiler-rt/dist/test/tsan/suppressions_race2.cc
vendor/compiler-rt/dist/test/tsan/thread_detach.c
vendor/compiler-rt/dist/test/tsan/thread_leak3.c
vendor/compiler-rt/dist/test/tsan/thread_leak4.c
vendor/compiler-rt/dist/test/tsan/thread_leak5.c
vendor/compiler-rt/dist/test/tsan/thread_name.cc
vendor/compiler-rt/dist/test/tsan/thread_name2.cc
vendor/compiler-rt/dist/test/tsan/tiny_race.c
vendor/compiler-rt/dist/test/tsan/tls_race.cc
vendor/compiler-rt/dist/test/tsan/tls_race2.cc
vendor/compiler-rt/dist/test/tsan/unaligned_norace.cc
vendor/compiler-rt/dist/test/tsan/unaligned_race.cc
vendor/compiler-rt/dist/test/tsan/vptr_harmful_race.cc
vendor/compiler-rt/dist/test/tsan/vptr_harmful_race2.cc
vendor/compiler-rt/dist/test/tsan/vptr_harmful_race3.cc
vendor/compiler-rt/dist/test/tsan/vptr_harmful_race4.cc
vendor/compiler-rt/dist/test/tsan/write_in_reader_lock.cc
vendor/compiler-rt/dist/test/ubsan/TestCases/Float/cast-overflow.cpp
vendor/compiler-rt/dist/test/ubsan/TestCases/Integer/no-recover.cpp
vendor/compiler-rt/dist/test/ubsan/TestCases/Misc/nonnull-arg.cpp
vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/misaligned.cpp
vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
vendor/compiler-rt/dist/test/ubsan/TestCases/TypeCheck/vptr.cpp
vendor/compiler-rt/dist/unittests/lit.common.unit.configured.in
Modified: vendor/compiler-rt/dist/CMakeLists.txt
==============================================================================
--- vendor/compiler-rt/dist/CMakeLists.txt Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/CMakeLists.txt Tue Feb 10 07:45:43 2015 (r278497)
@@ -104,7 +104,8 @@ else()
# Get some LLVM variables from LLVMConfig.
include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
- set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR
+ ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
# Find Python interpreter.
set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5)
@@ -162,29 +163,6 @@ set(COMPILER_RT_BINARY_DIR ${CMAKE_CURRE
# Setup custom SDK sysroots.
set(COMPILER_RT_LINUX_SDK_SYSROOT ${COMPILER_RT_SOURCE_DIR}/SDKs/linux)
-# Detect whether the current target platform is 32-bit or 64-bit, and setup
-# the correct commandline flags needed to attempt to target 32-bit and 64-bit.
-if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND
- NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
- message(FATAL_ERROR "Please use architecture with 4 or 8 byte pointers.")
-endif()
-if (NOT MSVC)
- set(TARGET_64_BIT_CFLAGS "-m64")
- set(TARGET_32_BIT_CFLAGS "-m32")
-else()
- set(TARGET_64_BIT_CFLAGS "")
- set(TARGET_32_BIT_CFLAGS "")
-endif()
-
-function(get_target_flags_for_arch arch out_var)
- list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
- if(ARCH_INDEX EQUAL -1)
- message(FATAL_ERROR "Unsupported architecture: ${arch}")
- else()
- set(${out_var} ${TARGET_${arch}_CFLAGS} PARENT_SCOPE)
- endif()
-endfunction()
-
# We support running instrumented tests when we're not cross compiling
# and target a UNIX-like system or Windows.
# We can run tests on Android even when we are cross-compiling.
@@ -199,17 +177,12 @@ option(COMPILER_RT_DEBUG "Build runtimes
# COMPILER_RT_DEBUG_PYBOOL is used by lit.common.configured.in.
pythonize_bool(COMPILER_RT_DEBUG)
-# We have to support both static and dynamic/shared runtime on Windows.
-# Android only works with dynamic runtime.
-if(WIN32 OR ANDROID)
-option(COMPILER_RT_BUILD_SHARED_ASAN "Build shared version of AddressSanitizer runtime" ON)
-else()
-option(COMPILER_RT_BUILD_SHARED_ASAN "Build shared version of AddressSanitizer runtime" OFF)
-endif()
-
#================================
# Setup Compiler Flags
#================================
+include(CheckIncludeFile)
+check_include_file(unwind.h HAVE_UNWIND_H)
+
include(config-ix)
if(MSVC)
@@ -238,6 +211,7 @@ append_list_if(COMPILER_RT_HAS_FUNWIND_T
append_list_if(COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG -fno-stack-protector SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG -fno-function-sections SANITIZER_COMMON_CFLAGS)
+append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto SANITIZER_COMMON_CFLAGS)
if(MSVC)
# Replace the /MD[d] flags with /MT.
@@ -257,14 +231,28 @@ if(MSVC)
append_list_if(COMPILER_RT_HAS_GS_FLAG /GS- SANITIZER_COMMON_CFLAGS)
endif()
+append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 SANITIZER_COMMON_CFLAGS)
+
# Build with optimization, unless we're in debug mode. If we're using MSVC,
# always respect the optimization flags set by CMAKE_BUILD_TYPE instead.
if(NOT COMPILER_RT_DEBUG AND NOT MSVC)
list(APPEND SANITIZER_COMMON_CFLAGS -O3)
endif()
+# Determine if we should restrict stack frame sizes.
+# Stack frames on PowerPC and in debug biuld can be much larger than
+# anticipated.
+# FIXME: Fix all sanitizers and add -Wframe-larger-than to
+# SANITIZER_COMMON_FLAGS
+if(COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG AND NOT COMPILER_RT_DEBUG
+ AND NOT ${LLVM_NATIVE_ARCH} STREQUAL "PowerPC")
+ set(SANITIZER_LIMIT_FRAME_SIZE TRUE)
+else()
+ set(SANITIZER_LIMIT_FRAME_SIZE FALSE)
+endif()
+
# Build sanitizer runtimes with debug info.
-if(COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG)
+if(COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG AND NOT COMPILER_RT_DEBUG)
list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only)
elseif(COMPILER_RT_HAS_G_FLAG)
list(APPEND SANITIZER_COMMON_CFLAGS -g)
@@ -283,12 +271,27 @@ append_list_if(COMPILER_RT_HAS_WD4391_FL
append_list_if(COMPILER_RT_HAS_WD4722_FLAG /wd4722 SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WD4800_FLAG /wd4800 SANITIZER_COMMON_CFLAGS)
if(APPLE)
- # Obtain the iOS Simulator SDK path from xcodebuild.
- execute_process(
- COMMAND xcodebuild -version -sdk iphonesimulator Path
- OUTPUT_VARIABLE IOSSIM_SDK_DIR
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
+ macro(find_darwin_sdk_dir var sdk_name)
+ # Let's first try the internal SDK, otherwise use the public SDK.
+ execute_process(
+ COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path
+ OUTPUT_VARIABLE ${var}
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_FILE /dev/null
+ )
+ if(${var} STREQUAL "")
+ execute_process(
+ COMMAND xcodebuild -version -sdk ${sdk_name} Path
+ OUTPUT_VARIABLE ${var}
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_FILE /dev/null
+ )
+ endif()
+ endmacro()
+
+ find_darwin_sdk_dir(OSX_SDK_DIR macosx)
+ find_darwin_sdk_dir(IOSSIM_SDK_DIR iphonesimulator)
+
string(REGEX MATCH "-mmacosx-version-min="
MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")
set(SANITIZER_COMMON_SUPPORTED_DARWIN_OS osx)
@@ -298,10 +301,12 @@ if(APPLE)
set(SANITIZER_MIN_OSX_VERSION 10.7)
set(CMAKE_OSX_DEPLOYMENT_TARGET "") # We're setting the flag manually below.
- set(DARWIN_osx_CFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})
+ set(DARWIN_osx_CFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}
+ -isysroot ${OSX_SDK_DIR} -stdlib=libc++)
set(DARWIN_iossim_CFLAGS
-mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR})
- set(DARWIN_osx_LINKFLAGS)
+ set(DARWIN_osx_LINKFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}
+ -isysroot ${OSX_SDK_DIR} -stdlib=libc++)
set(DARWIN_iossim_LINKFLAGS
-Wl,-ios_simulator_version_min,7.0.0
-mios-simulator-version-min=7.0
Modified: vendor/compiler-rt/dist/cmake/Modules/AddCompilerRT.cmake
==============================================================================
--- vendor/compiler-rt/dist/cmake/Modules/AddCompilerRT.cmake Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/cmake/Modules/AddCompilerRT.cmake Tue Feb 10 07:45:43 2015 (r278497)
@@ -131,10 +131,11 @@ set(COMPILER_RT_GTEST_CFLAGS
-I${COMPILER_RT_GTEST_PATH}
)
+append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_TEST_CFLAGS)
+
if(MSVC)
# clang doesn't support exceptions on Windows yet.
- list(APPEND COMPILER_RT_TEST_CFLAGS
- -D_HAS_EXCEPTIONS=0)
+ list(APPEND COMPILER_RT_TEST_CFLAGS -D_HAS_EXCEPTIONS=0)
# We should teach clang to understand "#pragma intrinsic", see PR19898.
list(APPEND COMPILER_RT_TEST_CFLAGS -Wno-undefined-inline)
@@ -156,12 +157,20 @@ endif()
# using specified link flags. Make executable a part of provided
# test_suite.
# add_compiler_rt_test(<test_suite> <test_name>
+# SUBDIR <subdirectory for binary>
# OBJECTS <object files>
# DEPS <deps (e.g. runtime libs)>
# LINK_FLAGS <link flags>)
macro(add_compiler_rt_test test_suite test_name)
- parse_arguments(TEST "OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN})
- set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
+ parse_arguments(TEST "SUBDIR;OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN})
+ if(TEST_SUBDIR)
+ set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/${TEST_SUBDIR}/${test_name}")
+ else()
+ set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
+ endif()
+ if(MSVC)
+ set(output_bin "${output_bin}.exe")
+ endif()
# Use host compiler in a standalone build, and just-built Clang otherwise.
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND TEST_DEPS clang)
Modified: vendor/compiler-rt/dist/cmake/Modules/CompilerRTCompile.cmake
==============================================================================
--- vendor/compiler-rt/dist/cmake/Modules/CompilerRTCompile.cmake Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/cmake/Modules/CompilerRTCompile.cmake Tue Feb 10 07:45:43 2015 (r278497)
@@ -9,7 +9,7 @@ macro(clang_compile object_file source)
parse_arguments(SOURCE "CFLAGS;DEPS" "" ${ARGN})
get_filename_component(source_rpath ${source} REALPATH)
if(NOT COMPILER_RT_STANDALONE_BUILD)
- list(APPEND SOURCE_DEPS clang)
+ list(APPEND SOURCE_DEPS clang compiler-rt-headers)
endif()
if (TARGET CompilerRTUnitTestCheckCxx)
list(APPEND SOURCE_DEPS CompilerRTUnitTestCheckCxx)
Modified: vendor/compiler-rt/dist/cmake/config-ix.cmake
==============================================================================
--- vendor/compiler-rt/dist/cmake/config-ix.cmake Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/cmake/config-ix.cmake Tue Feb 10 07:45:43 2015 (r278497)
@@ -1,6 +1,7 @@
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
include(CheckSymbolExists)
+include(TestBigEndian)
# CodeGen options.
check_cxx_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)
@@ -16,6 +17,8 @@ check_cxx_compiler_flag(-ffreestanding
check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
check_cxx_compiler_flag(-std=c++11 COMPILER_RT_HAS_STD_CXX11_FLAG)
check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
+check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
+check_cxx_compiler_flag(-msse3 COMPILER_RT_HAS_MSSE3_FLAG)
check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)
@@ -26,7 +29,7 @@ check_cxx_compiler_flag(/Oy COMPILER_RT_
check_cxx_compiler_flag(-gline-tables-only COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG)
check_cxx_compiler_flag(-g COMPILER_RT_HAS_G_FLAG)
check_cxx_compiler_flag(/Zi COMPILER_RT_HAS_Zi_FLAG)
-
+
# Warnings.
check_cxx_compiler_flag(-Wall COMPILER_RT_HAS_WALL_FLAG)
check_cxx_compiler_flag(-Werror COMPILER_RT_HAS_WERROR_FLAG)
@@ -120,6 +123,13 @@ macro(detect_target_arch)
endif()
endmacro()
+# Detect whether the current target platform is 32-bit or 64-bit, and setup
+# the correct commandline flags needed to attempt to target 32-bit and 64-bit.
+if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND
+ NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
+ message(FATAL_ERROR "Please use architecture with 4 or 8 byte pointers.")
+endif()
+
# Generate the COMPILER_RT_SUPPORTED_ARCH list.
if(ANDROID)
# Can't rely on LLVM_NATIVE_ARCH in cross-compilation.
@@ -128,28 +138,34 @@ if(ANDROID)
set(COMPILER_RT_OS_SUFFIX "-android")
else()
if("${LLVM_NATIVE_ARCH}" STREQUAL "X86")
- if (NOT MSVC)
- test_target_arch(x86_64 ${TARGET_64_BIT_CFLAGS})
+ if(NOT MSVC)
+ test_target_arch(x86_64 "-m64")
+ test_target_arch(i386 "-m32")
+ else()
+ test_target_arch(i386 "")
endif()
- test_target_arch(i386 ${TARGET_32_BIT_CFLAGS})
elseif("${LLVM_NATIVE_ARCH}" STREQUAL "PowerPC")
- test_target_arch(powerpc64 ${TARGET_64_BIT_CFLAGS})
- test_target_arch(powerpc64le ${TARGET_64_BIT_CFLAGS})
+ TEST_BIG_ENDIAN(HOST_IS_BIG_ENDIAN)
+ if(HOST_IS_BIG_ENDIAN)
+ test_target_arch(powerpc64 "-m64")
+ else()
+ test_target_arch(powerpc64le "-m64")
+ endif()
elseif("${LLVM_NATIVE_ARCH}" STREQUAL "Mips")
if("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "mipsel|mips64el")
# regex for mipsel, mips64el
- test_target_arch(mipsel ${TARGET_32_BIT_CFLAGS})
- test_target_arch(mips64el ${TARGET_64_BIT_CFLAGS})
+ test_target_arch(mipsel "-m32")
+ test_target_arch(mips64el "-m64")
else()
- test_target_arch(mips ${TARGET_32_BIT_CFLAGS})
- test_target_arch(mips64 ${TARGET_64_BIT_CFLAGS})
+ test_target_arch(mips "-m32")
+ test_target_arch(mips64 "-m64")
endif()
elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "arm")
test_target_arch(arm "-march=armv7-a")
elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch32")
test_target_arch(aarch32 "-march=armv8-a")
elseif("${COMPILER_RT_TEST_TARGET_ARCH}" MATCHES "aarch64")
- test_target_arch(aarch64 "-march=aarch64")
+ test_target_arch(aarch64 "-march=armv8-a")
endif()
set(COMPILER_RT_OS_SUFFIX "")
endif()
@@ -168,7 +184,16 @@ function(filter_available_targets out_va
set(${out_var} ${archs} PARENT_SCOPE)
endfunction()
-# Arhcitectures supported by compiler-rt libraries.
+function(get_target_flags_for_arch arch out_var)
+ list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
+ if(ARCH_INDEX EQUAL -1)
+ message(FATAL_ERROR "Unsupported architecture: ${arch}")
+ else()
+ set(${out_var} ${TARGET_${arch}_CFLAGS} PARENT_SCOPE)
+ endif()
+endfunction()
+
+# Architectures supported by compiler-rt libraries.
filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
x86_64 i386 i686 powerpc64 powerpc64le arm aarch64 mips mips64 mipsel mips64el)
filter_available_targets(ASAN_SUPPORTED_ARCH
@@ -183,7 +208,7 @@ filter_available_targets(MSAN_SUPPORTED_
filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386 i686 arm mips mips64
mipsel mips64el aarch64 powerpc64 powerpc64le)
filter_available_targets(TSAN_SUPPORTED_ARCH x86_64)
-filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386 i686 arm aarch64 mips mipsel)
+filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386 i686 arm aarch64 mips mipsel mips64 mips64el)
if(ANDROID)
set(OS_NAME "Android")
@@ -205,6 +230,12 @@ else()
set(COMPILER_RT_HAS_ASAN FALSE)
endif()
+if (OS_NAME MATCHES "Linux|FreeBSD|Windows")
+ set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE)
+else()
+ set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE)
+endif()
+
# TODO: Add builtins support.
if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
Modified: vendor/compiler-rt/dist/include/CMakeLists.txt
==============================================================================
--- vendor/compiler-rt/dist/include/CMakeLists.txt Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/include/CMakeLists.txt Tue Feb 10 07:45:43 2015 (r278497)
@@ -2,6 +2,7 @@ set(SANITIZER_HEADERS
sanitizer/allocator_interface.h
sanitizer/asan_interface.h
sanitizer/common_interface_defs.h
+ sanitizer/coverage_interface.h
sanitizer/dfsan_interface.h
sanitizer/linux_syscall_hooks.h
sanitizer/lsan_interface.h
Modified: vendor/compiler-rt/dist/include/sanitizer/asan_interface.h
==============================================================================
--- vendor/compiler-rt/dist/include/sanitizer/asan_interface.h Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/include/sanitizer/asan_interface.h Tue Feb 10 07:45:43 2015 (r278497)
@@ -114,8 +114,7 @@ extern "C" {
// Returns the old value.
int __asan_set_error_exit_code(int exit_code);
- // Sets the callback to be called right before death on error.
- // Passing 0 will unset the callback.
+ // Deprecated. Call __sanitizer_set_death_callback instead.
void __asan_set_death_callback(void (*callback)(void));
void __asan_set_error_report_callback(void (*callback)(const char*));
Modified: vendor/compiler-rt/dist/include/sanitizer/common_interface_defs.h
==============================================================================
--- vendor/compiler-rt/dist/include/sanitizer/common_interface_defs.h Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/include/sanitizer/common_interface_defs.h Tue Feb 10 07:45:43 2015 (r278497)
@@ -62,18 +62,6 @@ extern "C" {
void __sanitizer_unaligned_store32(void *p, uint32_t x);
void __sanitizer_unaligned_store64(void *p, uint64_t x);
- // Initialize coverage.
- void __sanitizer_cov_init();
- // Record and dump coverage info.
- void __sanitizer_cov_dump();
- // Open <name>.sancov.packed in the coverage directory and return the file
- // descriptor. Returns -1 on failure, or if coverage dumping is disabled.
- // This is intended for use by sandboxing code.
- intptr_t __sanitizer_maybe_open_cov_file(const char *name);
- // Get the number of total unique covered entities (blocks, edges, calls).
- // This can be useful for coverage-directed in-process fuzzers.
- uintptr_t __sanitizer_get_total_unique_coverage();
-
// Annotate the current state of a contiguous container, such as
// std::vector, std::string or similar.
// A contiguous container is a container that keeps all of its elements
@@ -120,6 +108,9 @@ extern "C" {
// Print the stack trace leading to this call. Useful for debugging user code.
void __sanitizer_print_stack_trace();
+ // Sets the callback to be called right before death on error.
+ // Passing 0 will unset the callback.
+ void __sanitizer_set_death_callback(void (*callback)(void));
#ifdef __cplusplus
} // extern "C"
#endif
Added: vendor/compiler-rt/dist/include/sanitizer/coverage_interface.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/compiler-rt/dist/include/sanitizer/coverage_interface.h Tue Feb 10 07:45:43 2015 (r278497)
@@ -0,0 +1,46 @@
+//===-- sanitizer/coverage_interface.h --------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Public interface for sanitizer coverage.
+//===----------------------------------------------------------------------===//
+
+#ifndef SANITIZER_COVERAG_INTERFACE_H
+#define SANITIZER_COVERAG_INTERFACE_H
+
+#include <sanitizer/common_interface_defs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ // Initialize coverage.
+ void __sanitizer_cov_init();
+ // Record and dump coverage info.
+ void __sanitizer_cov_dump();
+ // Open <name>.sancov.packed in the coverage directory and return the file
+ // descriptor. Returns -1 on failure, or if coverage dumping is disabled.
+ // This is intended for use by sandboxing code.
+ intptr_t __sanitizer_maybe_open_cov_file(const char *name);
+ // Get the number of total unique covered entities (blocks, edges, calls).
+ // This can be useful for coverage-directed in-process fuzzers.
+ uintptr_t __sanitizer_get_total_unique_coverage();
+
+ // Reset the basic-block (edge) coverage to the initial state.
+ // Useful for in-process fuzzing to start collecting coverage from scratch.
+ // Experimental, will likely not work for multi-threaded process.
+ void __sanitizer_reset_coverage();
+ // Set *data to the array of covered PCs and return the size of that array.
+ // Some of the entries in *data will be zero.
+ uintptr_t __sanitizer_get_coverage_guards(uintptr_t **data);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // SANITIZER_COVERAG_INTERFACE_H
Modified: vendor/compiler-rt/dist/include/sanitizer/msan_interface.h
==============================================================================
--- vendor/compiler-rt/dist/include/sanitizer/msan_interface.h Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/include/sanitizer/msan_interface.h Tue Feb 10 07:45:43 2015 (r278497)
@@ -38,7 +38,9 @@ extern "C" {
contents). */
void __msan_unpoison_string(const volatile char *a);
- /* Make memory region fully uninitialized (without changing its contents). */
+ /* 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);
/* Make memory region partially uninitialized (without changing its contents).
Modified: vendor/compiler-rt/dist/lib/asan/CMakeLists.txt
==============================================================================
--- vendor/compiler-rt/dist/lib/asan/CMakeLists.txt Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/lib/asan/CMakeLists.txt Tue Feb 10 07:45:43 2015 (r278497)
@@ -1,10 +1,11 @@
# Build for the AddressSanitizer runtime support library.
set(ASAN_SOURCES
- asan_allocator2.cc
+ asan_allocator.cc
asan_activation.cc
asan_debugging.cc
asan_fake_stack.cc
+ asan_flags.cc
asan_globals.cc
asan_interceptors.cc
asan_linux.cc
@@ -64,8 +65,8 @@ if(APPLE)
add_compiler_rt_darwin_object_library(RTAsan ${os}
ARCH ${ASAN_SUPPORTED_ARCH}
SOURCES ${ASAN_SOURCES} ${ASAN_CXX_SOURCES}
- CFLAGS ${ASAN_CFLAGS}
- DEFS ${ASAN_COMMON_DEFINITIONS})
+ CFLAGS ${ASAN_DYNAMIC_CFLAGS}
+ DEFS ${ASAN_DYNAMIC_DEFINITIONS})
endforeach()
else()
foreach(arch ${ASAN_SUPPORTED_ARCH})
@@ -78,12 +79,10 @@ else()
add_compiler_rt_object_library(RTAsan_preinit ${arch}
SOURCES ${ASAN_PREINIT_SOURCES} CFLAGS ${ASAN_CFLAGS}
DEFS ${ASAN_COMMON_DEFINITIONS})
- if (COMPILER_RT_BUILD_SHARED_ASAN)
- add_compiler_rt_object_library(RTAsan_dynamic ${arch}
- SOURCES ${ASAN_SOURCES} ${ASAN_CXX_SOURCES}
- CFLAGS ${ASAN_DYNAMIC_CFLAGS}
- DEFS ${ASAN_DYNAMIC_DEFINITIONS})
- endif()
+ add_compiler_rt_object_library(RTAsan_dynamic ${arch}
+ SOURCES ${ASAN_SOURCES} ${ASAN_CXX_SOURCES}
+ CFLAGS ${ASAN_DYNAMIC_CFLAGS}
+ DEFS ${ASAN_DYNAMIC_DEFINITIONS})
endforeach()
endif()
@@ -97,8 +96,8 @@ if(APPLE)
$<TARGET_OBJECTS:RTInterception.${os}>
$<TARGET_OBJECTS:RTSanitizerCommon.${os}>
$<TARGET_OBJECTS:RTLSanCommon.${os}>
- CFLAGS ${ASAN_CFLAGS}
- DEFS ${ASAN_COMMON_DEFINITIONS})
+ CFLAGS ${ASAN_DYNAMIC_CFLAGS}
+ DEFS ${ASAN_DYNAMIC_DEFINITIONS})
add_dependencies(asan clang_rt.asan_${os}_dynamic)
endforeach()
else()
@@ -128,28 +127,25 @@ else()
DEFS ${ASAN_COMMON_DEFINITIONS})
add_dependencies(asan clang_rt.asan_cxx-${arch})
- if (COMPILER_RT_BUILD_SHARED_ASAN)
- add_compiler_rt_runtime(clang_rt.asan-preinit-${arch} ${arch} STATIC
- SOURCES $<TARGET_OBJECTS:RTAsan_preinit.${arch}>
- CFLAGS ${ASAN_CFLAGS}
- DEFS ${ASAN_COMMON_DEFINITIONS})
- add_dependencies(asan clang_rt.asan-preinit-${arch})
+ add_compiler_rt_runtime(clang_rt.asan-preinit-${arch} ${arch} STATIC
+ SOURCES $<TARGET_OBJECTS:RTAsan_preinit.${arch}>
+ CFLAGS ${ASAN_CFLAGS}
+ DEFS ${ASAN_COMMON_DEFINITIONS})
+ add_dependencies(asan clang_rt.asan-preinit-${arch})
- if (WIN32)
- set(SHARED_ASAN_NAME clang_rt.asan_dynamic-${arch}${COMPILER_RT_OS_SUFFIX})
- else()
- set(SHARED_ASAN_NAME clang_rt.asan-${arch}${COMPILER_RT_OS_SUFFIX})
- endif()
-
- add_compiler_rt_runtime(clang_rt.asan-dynamic-${arch} ${arch} SHARED
- OUTPUT_NAME ${SHARED_ASAN_NAME}
- SOURCES $<TARGET_OBJECTS:RTAsan_dynamic.${arch}>
- ${ASAN_COMMON_RUNTIME_OBJECTS}
- CFLAGS ${ASAN_DYNAMIC_CFLAGS}
- DEFS ${ASAN_DYNAMIC_DEFINITIONS})
- target_link_libraries(clang_rt.asan-dynamic-${arch} ${ASAN_DYNAMIC_LIBS})
- add_dependencies(asan clang_rt.asan-dynamic-${arch})
+ if (WIN32)
+ set(SHARED_ASAN_NAME clang_rt.asan_dynamic-${arch}${COMPILER_RT_OS_SUFFIX})
+ else()
+ set(SHARED_ASAN_NAME clang_rt.asan-${arch}${COMPILER_RT_OS_SUFFIX})
endif()
+ add_compiler_rt_runtime(clang_rt.asan-dynamic-${arch} ${arch} SHARED
+ OUTPUT_NAME ${SHARED_ASAN_NAME}
+ SOURCES $<TARGET_OBJECTS:RTAsan_dynamic.${arch}>
+ ${ASAN_COMMON_RUNTIME_OBJECTS}
+ CFLAGS ${ASAN_DYNAMIC_CFLAGS}
+ DEFS ${ASAN_DYNAMIC_DEFINITIONS})
+ target_link_libraries(clang_rt.asan-dynamic-${arch} ${ASAN_DYNAMIC_LIBS})
+ add_dependencies(asan clang_rt.asan-dynamic-${arch})
if (UNIX AND NOT ${arch} STREQUAL "i386" AND NOT ${arch} STREQUAL "i686")
add_sanitizer_rt_symbols(clang_rt.asan_cxx-${arch})
Modified: vendor/compiler-rt/dist/lib/asan/asan_activation.cc
==============================================================================
--- vendor/compiler-rt/dist/lib/asan/asan_activation.cc Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/lib/asan/asan_activation.cc Tue Feb 10 07:45:43 2015 (r278497)
@@ -16,40 +16,106 @@
#include "asan_allocator.h"
#include "asan_flags.h"
#include "asan_internal.h"
+#include "asan_poisoning.h"
+#include "asan_stack.h"
#include "sanitizer_common/sanitizer_flags.h"
namespace __asan {
static struct AsanDeactivatedFlags {
- int quarantine_size;
- int max_redzone;
+ AllocatorOptions allocator_options;
int malloc_context_size;
bool poison_heap;
- bool alloc_dealloc_mismatch;
- bool allocator_may_return_null;
+ bool coverage;
+ const char *coverage_dir;
+
+ void RegisterActivationFlags(FlagParser *parser, Flags *f, CommonFlags *cf) {
+#define ASAN_ACTIVATION_FLAG(Type, Name) \
+ RegisterFlag(parser, #Name, "", &f->Name);
+#define COMMON_ACTIVATION_FLAG(Type, Name) \
+ RegisterFlag(parser, #Name, "", &cf->Name);
+#include "asan_activation_flags.inc"
+#undef ASAN_ACTIVATION_FLAG
+#undef COMMON_ACTIVATION_FLAG
+
+ RegisterIncludeFlag(parser, cf);
+ }
+
+ void OverrideFromActivationFlags() {
+ Flags f;
+ CommonFlags cf;
+ FlagParser parser;
+ RegisterActivationFlags(&parser, &f, &cf);
+
+ // Copy the current activation flags.
+ allocator_options.CopyTo(&f, &cf);
+ cf.malloc_context_size = malloc_context_size;
+ f.poison_heap = poison_heap;
+ cf.coverage = coverage;
+ cf.coverage_dir = coverage_dir;
+ cf.verbosity = Verbosity();
+ cf.help = false; // this is activation-specific help
+
+ // Check if activation flags need to be overriden.
+ if (const char *env = GetEnv("ASAN_ACTIVATION_OPTIONS")) {
+ parser.ParseString(env);
+ }
+
+ // Override from getprop asan.options.
+ char buf[100];
+ GetExtraActivationFlags(buf, sizeof(buf));
+ parser.ParseString(buf);
+
+ SetVerbosity(cf.verbosity);
+
+ if (Verbosity()) ReportUnrecognizedFlags();
+
+ if (cf.help) parser.PrintFlagDescriptions();
+
+ allocator_options.SetFrom(&f, &cf);
+ malloc_context_size = cf.malloc_context_size;
+ poison_heap = f.poison_heap;
+ coverage = cf.coverage;
+ coverage_dir = cf.coverage_dir;
+ }
+
+ void Print() {
+ Report(
+ "quarantine_size_mb %d, max_redzone %d, poison_heap %d, "
+ "malloc_context_size %d, alloc_dealloc_mismatch %d, "
+ "allocator_may_return_null %d, coverage %d, coverage_dir %s\n",
+ allocator_options.quarantine_size_mb, allocator_options.max_redzone,
+ poison_heap, malloc_context_size,
+ allocator_options.alloc_dealloc_mismatch,
+ allocator_options.may_return_null, coverage, coverage_dir);
+ }
} asan_deactivated_flags;
static bool asan_is_deactivated;
-void AsanStartDeactivated() {
+void AsanDeactivate() {
+ CHECK(!asan_is_deactivated);
VReport(1, "Deactivating ASan\n");
- // Save flag values.
- asan_deactivated_flags.quarantine_size = flags()->quarantine_size;
- asan_deactivated_flags.max_redzone = flags()->max_redzone;
- asan_deactivated_flags.poison_heap = flags()->poison_heap;
- asan_deactivated_flags.malloc_context_size =
- common_flags()->malloc_context_size;
- asan_deactivated_flags.alloc_dealloc_mismatch =
- flags()->alloc_dealloc_mismatch;
- asan_deactivated_flags.allocator_may_return_null =
- common_flags()->allocator_may_return_null;
-
- flags()->quarantine_size = 0;
- flags()->max_redzone = 16;
- flags()->poison_heap = false;
- common_flags()->malloc_context_size = 0;
- flags()->alloc_dealloc_mismatch = false;
- common_flags()->allocator_may_return_null = true;
+
+ // Stash runtime state.
+ GetAllocatorOptions(&asan_deactivated_flags.allocator_options);
+ asan_deactivated_flags.malloc_context_size = GetMallocContextSize();
+ asan_deactivated_flags.poison_heap = CanPoisonMemory();
+ asan_deactivated_flags.coverage = common_flags()->coverage;
+ asan_deactivated_flags.coverage_dir = common_flags()->coverage_dir;
+
+ // Deactivate the runtime.
+ SetCanPoisonMemory(false);
+ SetMallocContextSize(1);
+ ReInitializeCoverage(false, nullptr);
+
+ AllocatorOptions disabled = asan_deactivated_flags.allocator_options;
+ disabled.quarantine_size_mb = 0;
+ disabled.min_redzone = 16; // Redzone must be at least 16 bytes long.
+ disabled.max_redzone = 16;
+ disabled.alloc_dealloc_mismatch = false;
+ disabled.may_return_null = true;
+ ReInitializeAllocator(disabled);
asan_is_deactivated = true;
}
@@ -58,31 +124,19 @@ void AsanActivate() {
if (!asan_is_deactivated) return;
VReport(1, "Activating ASan\n");
- // Restore flag values.
- // FIXME: this is not atomic, and there may be other threads alive.
- flags()->quarantine_size = asan_deactivated_flags.quarantine_size;
- flags()->max_redzone = asan_deactivated_flags.max_redzone;
- flags()->poison_heap = asan_deactivated_flags.poison_heap;
- common_flags()->malloc_context_size =
- asan_deactivated_flags.malloc_context_size;
- flags()->alloc_dealloc_mismatch =
- asan_deactivated_flags.alloc_dealloc_mismatch;
- common_flags()->allocator_may_return_null =
- asan_deactivated_flags.allocator_may_return_null;
-
- ParseExtraActivationFlags();
+ asan_deactivated_flags.OverrideFromActivationFlags();
- ReInitializeAllocator();
+ SetCanPoisonMemory(asan_deactivated_flags.poison_heap);
+ SetMallocContextSize(asan_deactivated_flags.malloc_context_size);
+ ReInitializeCoverage(asan_deactivated_flags.coverage,
+ asan_deactivated_flags.coverage_dir);
+ ReInitializeAllocator(asan_deactivated_flags.allocator_options);
asan_is_deactivated = false;
- VReport(
- 1,
- "quarantine_size %d, max_redzone %d, poison_heap %d, "
- "malloc_context_size %d, alloc_dealloc_mismatch %d, "
- "allocator_may_return_null %d\n",
- flags()->quarantine_size, flags()->max_redzone, flags()->poison_heap,
- common_flags()->malloc_context_size, flags()->alloc_dealloc_mismatch,
- common_flags()->allocator_may_return_null);
+ if (Verbosity()) {
+ Report("Activated with flags:\n");
+ asan_deactivated_flags.Print();
+ }
}
} // namespace __asan
Modified: vendor/compiler-rt/dist/lib/asan/asan_activation.h
==============================================================================
--- vendor/compiler-rt/dist/lib/asan/asan_activation.h Tue Feb 10 07:35:16 2015 (r278496)
+++ vendor/compiler-rt/dist/lib/asan/asan_activation.h Tue Feb 10 07:45:43 2015 (r278497)
@@ -16,7 +16,7 @@
#define ASAN_ACTIVATION_H
namespace __asan {
-void AsanStartDeactivated();
+void AsanDeactivate();
void AsanActivate();
} // namespace __asan
Added: vendor/compiler-rt/dist/lib/asan/asan_activation_flags.inc
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/compiler-rt/dist/lib/asan/asan_activation_flags.inc Tue Feb 10 07:45:43 2015 (r278497)
@@ -0,0 +1,35 @@
+//===-- asan_activation_flags.inc -------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// A subset of ASan (and common) runtime flags supported at activation time.
+//
+//===----------------------------------------------------------------------===//
+#ifndef ASAN_ACTIVATION_FLAG
+# error "Define ASAN_ACTIVATION_FLAG prior to including this file!"
+#endif
+
+#ifndef COMMON_ACTIVATION_FLAG
+# error "Define COMMON_ACTIVATION_FLAG prior to including this file!"
+#endif
+
+// ASAN_ACTIVATION_FLAG(Type, Name)
+// See COMMON_FLAG in sanitizer_flags.inc for more details.
+
+ASAN_ACTIVATION_FLAG(int, redzone)
+ASAN_ACTIVATION_FLAG(int, max_redzone)
+ASAN_ACTIVATION_FLAG(int, quarantine_size_mb)
+ASAN_ACTIVATION_FLAG(bool, alloc_dealloc_mismatch)
+ASAN_ACTIVATION_FLAG(bool, poison_heap)
+
+COMMON_ACTIVATION_FLAG(bool, allocator_may_return_null)
+COMMON_ACTIVATION_FLAG(int, malloc_context_size)
+COMMON_ACTIVATION_FLAG(bool, coverage)
+COMMON_ACTIVATION_FLAG(const char *, coverage_dir)
+COMMON_ACTIVATION_FLAG(int, verbosity)
+COMMON_ACTIVATION_FLAG(bool, help)
Added: vendor/compiler-rt/dist/lib/asan/asan_allocator.cc
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ vendor/compiler-rt/dist/lib/asan/asan_allocator.cc Tue Feb 10 07:45:43 2015 (r278497)
@@ -0,0 +1,909 @@
+//===-- asan_allocator.cc -------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of AddressSanitizer, an address sanity checker.
+//
+// Implementation of ASan's memory allocator, 2-nd version.
+// This variant uses the allocator from sanitizer_common, i.e. the one shared
+// with ThreadSanitizer and MemorySanitizer.
+//
+//===----------------------------------------------------------------------===//
+#include "asan_allocator.h"
+
+#include "asan_mapping.h"
+#include "asan_poisoning.h"
+#include "asan_report.h"
+#include "asan_stack.h"
+#include "asan_thread.h"
+#include "sanitizer_common/sanitizer_allocator_interface.h"
+#include "sanitizer_common/sanitizer_flags.h"
+#include "sanitizer_common/sanitizer_internal_defs.h"
+#include "sanitizer_common/sanitizer_list.h"
+#include "sanitizer_common/sanitizer_stackdepot.h"
+#include "sanitizer_common/sanitizer_quarantine.h"
+#include "lsan/lsan_common.h"
+
+namespace __asan {
+
+// Valid redzone sizes are 16, 32, 64, ... 2048, so we encode them in 3 bits.
+// We use adaptive redzones: for larger allocation larger redzones are used.
+static u32 RZLog2Size(u32 rz_log) {
+ CHECK_LT(rz_log, 8);
+ return 16 << rz_log;
+}
+
+static u32 RZSize2Log(u32 rz_size) {
+ CHECK_GE(rz_size, 16);
+ CHECK_LE(rz_size, 2048);
+ CHECK(IsPowerOfTwo(rz_size));
+ u32 res = Log2(rz_size) - 4;
+ CHECK_EQ(rz_size, RZLog2Size(res));
+ return res;
+}
+
+static AsanAllocator &get_allocator();
+
+// The memory chunk allocated from the underlying allocator looks like this:
+// L L L L L L H H U U U U U U R R
+// L -- left redzone words (0 or more bytes)
+// H -- ChunkHeader (16 bytes), which is also a part of the left redzone.
+// U -- user memory.
+// R -- right redzone (0 or more bytes)
+// ChunkBase consists of ChunkHeader and other bytes that overlap with user
+// memory.
+
+// If the left redzone is greater than the ChunkHeader size we store a magic
+// value in the first uptr word of the memory block and store the address of
+// ChunkBase in the next uptr.
+// M B L L L L L L L L L H H U U U U U U
+// | ^
+// ---------------------|
+// M -- magic value kAllocBegMagic
+// B -- address of ChunkHeader pointing to the first 'H'
+static const uptr kAllocBegMagic = 0xCC6E96B9;
+
+struct ChunkHeader {
+ // 1-st 8 bytes.
+ u32 chunk_state : 8; // Must be first.
+ u32 alloc_tid : 24;
+
+ u32 free_tid : 24;
+ u32 from_memalign : 1;
+ u32 alloc_type : 2;
+ u32 rz_log : 3;
+ u32 lsan_tag : 2;
+ // 2-nd 8 bytes
+ // This field is used for small sizes. For large sizes it is equal to
+ // SizeClassMap::kMaxSize and the actual size is stored in the
+ // SecondaryAllocator's metadata.
+ u32 user_requested_size;
+ u32 alloc_context_id;
+};
+
+struct ChunkBase : ChunkHeader {
+ // Header2, intersects with user memory.
+ u32 free_context_id;
+};
+
+static const uptr kChunkHeaderSize = sizeof(ChunkHeader);
+static const uptr kChunkHeader2Size = sizeof(ChunkBase) - kChunkHeaderSize;
+COMPILER_CHECK(kChunkHeaderSize == 16);
+COMPILER_CHECK(kChunkHeader2Size <= 16);
+
+// Every chunk of memory allocated by this allocator can be in one of 3 states:
+// CHUNK_AVAILABLE: the chunk is in the free list and ready to be allocated.
+// CHUNK_ALLOCATED: the chunk is allocated and not yet freed.
+// CHUNK_QUARANTINE: the chunk was freed and put into quarantine zone.
+enum {
+ CHUNK_AVAILABLE = 0, // 0 is the default value even if we didn't set it.
+ CHUNK_ALLOCATED = 2,
+ CHUNK_QUARANTINE = 3
+};
+
+struct AsanChunk: ChunkBase {
+ uptr Beg() { return reinterpret_cast<uptr>(this) + kChunkHeaderSize; }
+ uptr UsedSize(bool locked_version = false) {
+ if (user_requested_size != SizeClassMap::kMaxSize)
+ return user_requested_size;
+ return *reinterpret_cast<uptr *>(
+ get_allocator().GetMetaData(AllocBeg(locked_version)));
+ }
+ void *AllocBeg(bool locked_version = false) {
+ if (from_memalign) {
+ if (locked_version)
+ return get_allocator().GetBlockBeginFastLocked(
+ reinterpret_cast<void *>(this));
+ return get_allocator().GetBlockBegin(reinterpret_cast<void *>(this));
+ }
+ return reinterpret_cast<void*>(Beg() - RZLog2Size(rz_log));
+ }
+ bool AddrIsInside(uptr addr, bool locked_version = false) {
+ return (addr >= Beg()) && (addr < Beg() + UsedSize(locked_version));
+ }
+};
+
+struct QuarantineCallback {
+ explicit QuarantineCallback(AllocatorCache *cache)
+ : cache_(cache) {
+ }
+
+ void Recycle(AsanChunk *m) {
+ CHECK_EQ(m->chunk_state, CHUNK_QUARANTINE);
+ atomic_store((atomic_uint8_t*)m, CHUNK_AVAILABLE, memory_order_relaxed);
+ CHECK_NE(m->alloc_tid, kInvalidTid);
+ CHECK_NE(m->free_tid, kInvalidTid);
+ PoisonShadow(m->Beg(),
+ RoundUpTo(m->UsedSize(), SHADOW_GRANULARITY),
+ kAsanHeapLeftRedzoneMagic);
+ void *p = reinterpret_cast<void *>(m->AllocBeg());
+ if (p != m) {
+ uptr *alloc_magic = reinterpret_cast<uptr *>(p);
+ CHECK_EQ(alloc_magic[0], kAllocBegMagic);
+ // Clear the magic value, as allocator internals may overwrite the
+ // contents of deallocated chunk, confusing GetAsanChunk lookup.
+ alloc_magic[0] = 0;
+ CHECK_EQ(alloc_magic[1], reinterpret_cast<uptr>(m));
+ }
+
+ // Statistics.
+ AsanStats &thread_stats = GetCurrentThreadStats();
+ thread_stats.real_frees++;
+ thread_stats.really_freed += m->UsedSize();
+
+ get_allocator().Deallocate(cache_, p);
+ }
+
+ void *Allocate(uptr size) {
+ return get_allocator().Allocate(cache_, size, 1, false);
+ }
+
+ void Deallocate(void *p) {
+ get_allocator().Deallocate(cache_, p);
+ }
+
+ AllocatorCache *cache_;
+};
+
+typedef Quarantine<QuarantineCallback, AsanChunk> AsanQuarantine;
+typedef AsanQuarantine::Cache QuarantineCache;
+
+void AsanMapUnmapCallback::OnMap(uptr p, uptr size) const {
+ PoisonShadow(p, size, kAsanHeapLeftRedzoneMagic);
+ // Statistics.
+ AsanStats &thread_stats = GetCurrentThreadStats();
+ thread_stats.mmaps++;
+ thread_stats.mmaped += size;
+}
+void AsanMapUnmapCallback::OnUnmap(uptr p, uptr size) const {
+ PoisonShadow(p, size, 0);
+ // We are about to unmap a chunk of user memory.
+ // Mark the corresponding shadow memory as not needed.
+ FlushUnneededASanShadowMemory(p, size);
+ // Statistics.
+ AsanStats &thread_stats = GetCurrentThreadStats();
+ thread_stats.munmaps++;
+ thread_stats.munmaped += size;
+}
+
+// We can not use THREADLOCAL because it is not supported on some of the
+// platforms we care about (OSX 10.6, Android).
+// static THREADLOCAL AllocatorCache cache;
+AllocatorCache *GetAllocatorCache(AsanThreadLocalMallocStorage *ms) {
+ CHECK(ms);
+ return &ms->allocator_cache;
+}
+
+QuarantineCache *GetQuarantineCache(AsanThreadLocalMallocStorage *ms) {
+ CHECK(ms);
+ CHECK_LE(sizeof(QuarantineCache), sizeof(ms->quarantine_cache));
+ return reinterpret_cast<QuarantineCache *>(ms->quarantine_cache);
+}
+
+void AllocatorOptions::SetFrom(const Flags *f, const CommonFlags *cf) {
+ quarantine_size_mb = f->quarantine_size_mb;
+ min_redzone = f->redzone;
+ max_redzone = f->max_redzone;
+ may_return_null = cf->allocator_may_return_null;
+ alloc_dealloc_mismatch = f->alloc_dealloc_mismatch;
+}
+
+void AllocatorOptions::CopyTo(Flags *f, CommonFlags *cf) {
+ f->quarantine_size_mb = quarantine_size_mb;
+ f->redzone = min_redzone;
+ f->max_redzone = max_redzone;
+ cf->allocator_may_return_null = may_return_null;
+ f->alloc_dealloc_mismatch = alloc_dealloc_mismatch;
+}
+
+struct Allocator {
+ static const uptr kMaxAllowedMallocSize =
+ FIRST_32_SECOND_64(3UL << 30, 64UL << 30);
+ static const uptr kMaxThreadLocalQuarantine =
+ FIRST_32_SECOND_64(1 << 18, 1 << 20);
+
+ AsanAllocator allocator;
+ AsanQuarantine quarantine;
+ StaticSpinMutex fallback_mutex;
+ AllocatorCache fallback_allocator_cache;
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list