Date: Sat, 6 Feb 2016 13:39:20 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r295349 - in projects/clang380-import: contrib/compiler-rt/include/sanitizer contrib/compiler-rt/lib/asan contrib/compiler-rt/lib/asan/scripts contrib/compiler-rt/lib/asan/tests contrib... Message-ID: <201602061339.u16DdKAN047230@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Feb 6 13:39:20 2016 New Revision: 295349 URL: https://svnweb.freebsd.org/changeset/base/295349 Log: Merge compiler-rt release_38 branch r258968. Note that there is still a problem on amd64, causing SIGBUS in the early startup of Address Sanitizer. This is being investigated. Added: projects/clang380-import/contrib/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/arm/aeabi_cdcmp.S projects/clang380-import/contrib/compiler-rt/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c projects/clang380-import/contrib/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/arm/aeabi_cfcmp.S projects/clang380-import/contrib/compiler-rt/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c projects/clang380-import/contrib/compiler-rt/lib/builtins/arm/aeabi_drsub.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/arm/aeabi_drsub.c projects/clang380-import/contrib/compiler-rt/lib/builtins/arm/aeabi_frsub.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/arm/aeabi_frsub.c projects/clang380-import/contrib/compiler-rt/lib/builtins/divtc3.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/divtc3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/emutls.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/emutls.c projects/clang380-import/contrib/compiler-rt/lib/builtins/i386/chkstk2.S - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/i386/chkstk2.S projects/clang380-import/contrib/compiler-rt/lib/builtins/x86_64/chkstk2.S - copied unchanged from r295050, vendor/compiler-rt/dist/lib/builtins/x86_64/chkstk2.S projects/clang380-import/contrib/compiler-rt/lib/cfi/ - copied from r295050, vendor/compiler-rt/dist/lib/cfi/ projects/clang380-import/contrib/compiler-rt/lib/dfsan/dfsan_platform.h - copied unchanged from r295050, vendor/compiler-rt/dist/lib/dfsan/dfsan_platform.h projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfData.inc - copied unchanged from r295050, vendor/compiler-rt/dist/lib/profile/InstrProfData.inc projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/profile/InstrProfilingPlatformLinux.c projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingPort.h - copied unchanged from r295050, vendor/compiler-rt/dist/lib/profile/InstrProfilingPort.h projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingValue.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/profile/InstrProfilingValue.c projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingWriter.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/profile/InstrProfilingWriter.c projects/clang380-import/contrib/compiler-rt/lib/profile/WindowsMMap.c - copied unchanged from r295050, vendor/compiler-rt/dist/lib/profile/WindowsMMap.c projects/clang380-import/contrib/compiler-rt/lib/profile/WindowsMMap.h - copied unchanged from r295050, vendor/compiler-rt/dist/lib/profile/WindowsMMap.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_nolibc.cc - copied unchanged from r295050, vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_nolibc.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_malloc_mac.inc - copied unchanged from r295050, vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_malloc_mac.inc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc - copied unchanged from r295050, vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_syscall_linux_aarch64.inc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cc - copied unchanged from r295050, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors_mac.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc - copied unchanged from r295050, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_libdispatch_mac.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_malloc_mac.cc - copied unchanged from r295050, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_malloc_mac.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc - copied unchanged from r295050, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_posix.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_ppc_regs.h - copied unchanged from r295050, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_ppc_regs.h projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S - copied unchanged from r295050, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_aarch64.S projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_ppc64.S - copied unchanged from r295050, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_ppc64.S projects/clang380-import/contrib/compiler-rt/lib/ubsan/ubsan_checks.inc - copied unchanged from r295050, vendor/compiler-rt/dist/lib/ubsan/ubsan_checks.inc projects/clang380-import/lib/libclang_rt/asan_dynamic/ projects/clang380-import/lib/libclang_rt/asan_dynamic/Makefile (contents, props changed) Deleted: projects/clang380-import/contrib/compiler-rt/lib/asan/scripts/ projects/clang380-import/contrib/compiler-rt/lib/asan/tests/ projects/clang380-import/contrib/compiler-rt/lib/cfi/CMakeLists.txt projects/clang380-import/contrib/compiler-rt/lib/dfsan/scripts/ projects/clang380-import/contrib/compiler-rt/lib/msan/tests/ projects/clang380-import/contrib/compiler-rt/lib/safestack/CMakeLists.txt projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_process_libcdep.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/scripts/ projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/tests/ projects/clang380-import/contrib/compiler-rt/lib/tsan/analyze_libtsan.sh projects/clang380-import/contrib/compiler-rt/lib/tsan/check_analyze.sh projects/clang380-import/contrib/compiler-rt/lib/tsan/check_cmake.sh projects/clang380-import/contrib/compiler-rt/lib/tsan/check_memcpy.sh projects/clang380-import/contrib/compiler-rt/lib/tsan/go/build.bat projects/clang380-import/contrib/compiler-rt/lib/tsan/go/buildgo.sh projects/clang380-import/contrib/compiler-rt/lib/tsan/tests/ Modified: projects/clang380-import/contrib/compiler-rt/include/sanitizer/asan_interface.h projects/clang380-import/contrib/compiler-rt/include/sanitizer/common_interface_defs.h projects/clang380-import/contrib/compiler-rt/include/sanitizer/coverage_interface.h projects/clang380-import/contrib/compiler-rt/include/sanitizer/dfsan_interface.h projects/clang380-import/contrib/compiler-rt/include/sanitizer/lsan_interface.h projects/clang380-import/contrib/compiler-rt/include/sanitizer/msan_interface.h projects/clang380-import/contrib/compiler-rt/lib/asan/README.txt projects/clang380-import/contrib/compiler-rt/lib/asan/asan_activation.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_allocator.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_allocator.h projects/clang380-import/contrib/compiler-rt/lib/asan/asan_debugging.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_fake_stack.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_flags.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_flags.inc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_globals.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_init_version.h projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interceptors.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interceptors.h projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interface_internal.h projects/clang380-import/contrib/compiler-rt/lib/asan/asan_internal.h projects/clang380-import/contrib/compiler-rt/lib/asan/asan_linux.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_mac.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_malloc_linux.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_malloc_mac.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_mapping.h projects/clang380-import/contrib/compiler-rt/lib/asan/asan_new_delete.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_poisoning.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_posix.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_report.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_report.h projects/clang380-import/contrib/compiler-rt/lib/asan/asan_rtl.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_stack.h projects/clang380-import/contrib/compiler-rt/lib/asan/asan_thread.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_thread.h projects/clang380-import/contrib/compiler-rt/lib/asan/asan_win.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_win_dll_thunk.cc projects/clang380-import/contrib/compiler-rt/lib/asan/asan_win_dynamic_runtime_thunk.cc projects/clang380-import/contrib/compiler-rt/lib/builtins/README.txt projects/clang380-import/contrib/compiler-rt/lib/builtins/assembly.h projects/clang380-import/contrib/compiler-rt/lib/builtins/atomic.c projects/clang380-import/contrib/compiler-rt/lib/builtins/atomic_flag_clear.c projects/clang380-import/contrib/compiler-rt/lib/builtins/atomic_flag_clear_explicit.c projects/clang380-import/contrib/compiler-rt/lib/builtins/atomic_flag_test_and_set.c projects/clang380-import/contrib/compiler-rt/lib/builtins/atomic_flag_test_and_set_explicit.c projects/clang380-import/contrib/compiler-rt/lib/builtins/atomic_signal_fence.c projects/clang380-import/contrib/compiler-rt/lib/builtins/atomic_thread_fence.c projects/clang380-import/contrib/compiler-rt/lib/builtins/comparedf2.c projects/clang380-import/contrib/compiler-rt/lib/builtins/comparesf2.c projects/clang380-import/contrib/compiler-rt/lib/builtins/comparetf2.c projects/clang380-import/contrib/compiler-rt/lib/builtins/divdc3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/divsc3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/divxc3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/enable_execute_stack.c projects/clang380-import/contrib/compiler-rt/lib/builtins/extendhfsf2.c projects/clang380-import/contrib/compiler-rt/lib/builtins/fixunsdfdi.c projects/clang380-import/contrib/compiler-rt/lib/builtins/fixunssfdi.c projects/clang380-import/contrib/compiler-rt/lib/builtins/floatdidf.c projects/clang380-import/contrib/compiler-rt/lib/builtins/floatditf.c projects/clang380-import/contrib/compiler-rt/lib/builtins/floatsitf.c projects/clang380-import/contrib/compiler-rt/lib/builtins/floatundidf.c projects/clang380-import/contrib/compiler-rt/lib/builtins/fp_add_impl.inc projects/clang380-import/contrib/compiler-rt/lib/builtins/fp_extend.h projects/clang380-import/contrib/compiler-rt/lib/builtins/fp_extend_impl.inc projects/clang380-import/contrib/compiler-rt/lib/builtins/fp_fixint_impl.inc projects/clang380-import/contrib/compiler-rt/lib/builtins/fp_fixuint_impl.inc projects/clang380-import/contrib/compiler-rt/lib/builtins/fp_lib.h projects/clang380-import/contrib/compiler-rt/lib/builtins/fp_mul_impl.inc projects/clang380-import/contrib/compiler-rt/lib/builtins/fp_trunc.h projects/clang380-import/contrib/compiler-rt/lib/builtins/fp_trunc_impl.inc projects/clang380-import/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c projects/clang380-import/contrib/compiler-rt/lib/builtins/i386/chkstk.S projects/clang380-import/contrib/compiler-rt/lib/builtins/int_lib.h projects/clang380-import/contrib/compiler-rt/lib/builtins/int_math.h projects/clang380-import/contrib/compiler-rt/lib/builtins/int_types.h projects/clang380-import/contrib/compiler-rt/lib/builtins/int_util.c projects/clang380-import/contrib/compiler-rt/lib/builtins/int_util.h projects/clang380-import/contrib/compiler-rt/lib/builtins/muldc3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/mulsc3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/mulxc3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/ppc/DD.h projects/clang380-import/contrib/compiler-rt/lib/builtins/ppc/divtc3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/ppc/multc3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/subdf3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/subsf3.c projects/clang380-import/contrib/compiler-rt/lib/builtins/truncdfhf2.c projects/clang380-import/contrib/compiler-rt/lib/builtins/truncsfhf2.c projects/clang380-import/contrib/compiler-rt/lib/builtins/x86_64/chkstk.S projects/clang380-import/contrib/compiler-rt/lib/dfsan/dfsan.cc projects/clang380-import/contrib/compiler-rt/lib/dfsan/dfsan.h projects/clang380-import/contrib/compiler-rt/lib/dfsan/dfsan_custom.cc projects/clang380-import/contrib/compiler-rt/lib/dfsan/done_abilist.txt projects/clang380-import/contrib/compiler-rt/lib/interception/interception_linux.h projects/clang380-import/contrib/compiler-rt/lib/interception/interception_win.cc projects/clang380-import/contrib/compiler-rt/lib/interception/interception_win.h projects/clang380-import/contrib/compiler-rt/lib/lsan/lsan.cc projects/clang380-import/contrib/compiler-rt/lib/lsan/lsan_allocator.cc projects/clang380-import/contrib/compiler-rt/lib/lsan/lsan_common.cc projects/clang380-import/contrib/compiler-rt/lib/lsan/lsan_common.h projects/clang380-import/contrib/compiler-rt/lib/lsan/lsan_common_linux.cc projects/clang380-import/contrib/compiler-rt/lib/lsan/lsan_flags.inc projects/clang380-import/contrib/compiler-rt/lib/lsan/lsan_interceptors.cc projects/clang380-import/contrib/compiler-rt/lib/lsan/lsan_thread.cc projects/clang380-import/contrib/compiler-rt/lib/msan/msan.cc projects/clang380-import/contrib/compiler-rt/lib/msan/msan.h projects/clang380-import/contrib/compiler-rt/lib/msan/msan_allocator.cc projects/clang380-import/contrib/compiler-rt/lib/msan/msan_chained_origin_depot.cc projects/clang380-import/contrib/compiler-rt/lib/msan/msan_flags.inc projects/clang380-import/contrib/compiler-rt/lib/msan/msan_interceptors.cc projects/clang380-import/contrib/compiler-rt/lib/msan/msan_interface_internal.h projects/clang380-import/contrib/compiler-rt/lib/msan/msan_linux.cc projects/clang380-import/contrib/compiler-rt/lib/msan/msan_new_delete.cc projects/clang380-import/contrib/compiler-rt/lib/msan/msan_thread.h projects/clang380-import/contrib/compiler-rt/lib/profile/GCDAProfiling.c projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfiling.c projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfiling.h projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingBuffer.c projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingFile.c projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingInternal.h projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingPlatformOther.c projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingRuntime.cc projects/clang380-import/contrib/compiler-rt/lib/profile/InstrProfilingUtil.c projects/clang380-import/contrib/compiler-rt/lib/safestack/safestack.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_addrhashmap.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_allocator_internal.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_asm.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_format.inc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_flag_parser.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_flags.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_interface_internal.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_lfstack.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_libc.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_libignore.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_list.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_mac.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_persistent_allocator.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_posix.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_printf.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_common.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_linux.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_quarantine.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_printer.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_suppressions.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.h projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cc projects/clang380-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_win.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_clock.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_defs.h projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_dense_alloc.h projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_flags.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_flags.inc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interceptors.h projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interface_ann.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_mman.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_mman.h projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_mutex.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_mutex.h projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_new_delete.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_platform.h projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_platform_windows.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_report.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl.h projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_stat.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_stat.h projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_suppressions.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_symbolize.cc projects/clang380-import/contrib/compiler-rt/lib/tsan/rtl/tsan_sync.h projects/clang380-import/contrib/compiler-rt/lib/ubsan/ubsan_diag.cc projects/clang380-import/contrib/compiler-rt/lib/ubsan/ubsan_diag.h projects/clang380-import/contrib/compiler-rt/lib/ubsan/ubsan_flags.cc projects/clang380-import/contrib/compiler-rt/lib/ubsan/ubsan_flags.inc projects/clang380-import/contrib/compiler-rt/lib/ubsan/ubsan_handlers.cc projects/clang380-import/contrib/compiler-rt/lib/ubsan/ubsan_handlers.h projects/clang380-import/contrib/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cc projects/clang380-import/lib/libclang_rt/Makefile projects/clang380-import/lib/libclang_rt/asan/Makefile projects/clang380-import/lib/libclang_rt/profile/Makefile projects/clang380-import/lib/libclang_rt/safestack/Makefile projects/clang380-import/lib/libclang_rt/ubsan_standalone/Makefile projects/clang380-import/lib/libcompiler_rt/Makefile Directory Properties: projects/clang380-import/contrib/compiler-rt/ (props changed) Modified: projects/clang380-import/contrib/compiler-rt/include/sanitizer/asan_interface.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/include/sanitizer/asan_interface.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/include/sanitizer/asan_interface.h Sat Feb 6 13:39:20 2016 (r295349) @@ -110,10 +110,6 @@ extern "C" { void __asan_report_error(void *pc, void *bp, void *sp, void *addr, int is_write, size_t access_size); - // Sets the exit code to use when reporting an error. - // Returns the old value. - int __asan_set_error_exit_code(int exit_code); - // Deprecated. Call __sanitizer_set_death_callback instead. void __asan_set_death_callback(void (*callback)(void)); Modified: projects/clang380-import/contrib/compiler-rt/include/sanitizer/common_interface_defs.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/include/sanitizer/common_interface_defs.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/include/sanitizer/common_interface_defs.h Sat Feb 6 13:39:20 2016 (r295349) @@ -105,12 +105,31 @@ extern "C" { int __sanitizer_verify_contiguous_container(const void *beg, const void *mid, const void *end); + // Similar to __sanitizer_verify_contiguous_container but returns the address + // of the first improperly poisoned byte otherwise. Returns null if the area + // is poisoned properly. + const void *__sanitizer_contiguous_container_find_bad_address( + const void *beg, const void *mid, const void *end); + // 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)); + + // Interceptor hooks. + // Whenever a libc function interceptor is called it checks if the + // corresponding weak hook is defined, and it so -- calls it. + // The primary use case is data-flow-guided fuzzing, where the fuzzer needs + // to know what is being passed to libc functions, e.g. memcmp. + // FIXME: implement more hooks. + void __sanitizer_weak_hook_memcmp(void *called_pc, const void *s1, + const void *s2, size_t n, int result); + void __sanitizer_weak_hook_strncmp(void *called_pc, const char *s1, + const char *s2, size_t n, int result); + void __sanitizer_weak_hook_strcmp(void *called_pc, const char *s1, + const char *s2, int result); #ifdef __cplusplus } // extern "C" #endif Modified: projects/clang380-import/contrib/compiler-rt/include/sanitizer/coverage_interface.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/include/sanitizer/coverage_interface.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/include/sanitizer/coverage_interface.h Sat Feb 6 13:39:20 2016 (r295349) @@ -27,9 +27,11 @@ extern "C" { // 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). + // Get the number of unique covered blocks (or edges). // This can be useful for coverage-directed in-process fuzzers. uintptr_t __sanitizer_get_total_unique_coverage(); + // Get the number of unique indirect caller-callee pairs. + uintptr_t __sanitizer_get_total_unique_caller_callee_pairs(); // Reset the basic-block (edge) coverage to the initial state. // Useful for in-process fuzzing to start collecting coverage from scratch. @@ -39,6 +41,13 @@ extern "C" { // Some of the entries in *data will be zero. uintptr_t __sanitizer_get_coverage_guards(uintptr_t **data); + // Set *data to the growing buffer with covered PCs and return the size + // of the buffer. The entries are never zero. + // When only unique pcs are collected, the size is equal to + // __sanitizer_get_total_unique_coverage. + // WARNING: EXPERIMENTAL API. + uintptr_t __sanitizer_get_coverage_pc_buffer(uintptr_t **data); + // The coverage instrumentation may optionally provide imprecise counters. // Rather than exposing the counter values to the user we instead map // the counters to a bitset. Modified: projects/clang380-import/contrib/compiler-rt/include/sanitizer/dfsan_interface.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/include/sanitizer/dfsan_interface.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/include/sanitizer/dfsan_interface.h Sat Feb 6 13:39:20 2016 (r295349) @@ -91,16 +91,18 @@ void dfsan_set_write_callback(dfsan_writ /// <label> <parent label 1> <parent label 2> <label description if any> void dfsan_dump_labels(int fd); +/// Interceptor hooks. /// Whenever a dfsan's custom function is called the corresponding /// hook is called it non-zero. The hooks should be defined by the user. /// The primary use case is taint-guided fuzzing, where the fuzzer /// needs to see the parameters of the function and the labels. /// FIXME: implement more hooks. - -/// memcmp hook. void dfsan_weak_hook_memcmp(void *caller_pc, const void *s1, const void *s2, size_t n, dfsan_label s1_label, dfsan_label s2_label, dfsan_label n_label); +void dfsan_weak_hook_strncmp(void *caller_pc, const char *s1, const char *s2, + size_t n, dfsan_label s1_label, + dfsan_label s2_label, dfsan_label n_label); #ifdef __cplusplus } // extern "C" Modified: projects/clang380-import/contrib/compiler-rt/include/sanitizer/lsan_interface.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/include/sanitizer/lsan_interface.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/include/sanitizer/lsan_interface.h Sat Feb 6 13:39:20 2016 (r295349) @@ -43,7 +43,7 @@ extern "C" { // Check for leaks now. This function behaves identically to the default // end-of-process leak check. In particular, it will terminate the process if - // leaks are found and the exit_code flag is non-zero. + // leaks are found and the exitcode runtime flag is non-zero. // Subsequent calls to this function will have no effect and end-of-process // leak check will not run. Effectively, end-of-process leak check is moved to // the time of first invocation of this function. Modified: projects/clang380-import/contrib/compiler-rt/include/sanitizer/msan_interface.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/include/sanitizer/msan_interface.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/include/sanitizer/msan_interface.h Sat Feb 6 13:39:20 2016 (r295349) @@ -61,10 +61,6 @@ extern "C" { * is not. */ void __msan_check_mem_is_initialized(const volatile void *x, size_t size); - /* Set exit code when error(s) were detected. - Value of 0 means don't change the program exit code. */ - void __msan_set_exit_code(int exit_code); - /* For testing: __msan_set_expect_umr(1); ... some buggy code ... @@ -92,14 +88,22 @@ extern "C" { Memory will be marked uninitialized, with origin at the call site. */ void __msan_allocated_memory(const volatile void* data, size_t size); + /* Tell MSan about newly destroyed memory. Mark memory as uninitialized. */ + void __sanitizer_dtor_callback(const volatile void* data, size_t size); + /* This function may be optionally provided by user and should return a string containing Msan runtime options. See msan_flags.h for details. */ const char* __msan_default_options(); - /* 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 __msan_set_death_callback(void (*callback)(void)); + /* Update shadow for the application copy of size bytes from src to dst. + Src and dst are application addresses. This function does not copy the + actual application memory, it only updates shadow and origin for such + copy. Source and destination regions can overlap. */ + void __msan_copy_shadow(const volatile void *dst, const volatile void *src, + size_t size); #ifdef __cplusplus } // extern "C" #endif Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/README.txt ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/README.txt Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/README.txt Sat Feb 6 13:39:20 2016 (r295349) @@ -23,4 +23,4 @@ from the root of your CMake build tree: make check-asan For more instructions see: -http://code.google.com/p/address-sanitizer/wiki/HowToBuild +https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_activation.cc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_activation.cc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_activation.cc Sat Feb 6 13:39:20 2016 (r295349) @@ -38,7 +38,7 @@ static struct AsanDeactivatedFlags { #undef ASAN_ACTIVATION_FLAG #undef COMMON_ACTIVATION_FLAG - RegisterIncludeFlag(parser, cf); + RegisterIncludeFlags(parser, cf); } void OverrideFromActivationFlags() { @@ -61,11 +61,6 @@ static struct AsanDeactivatedFlags { parser.ParseString(env); } - // Override from getprop asan.options. - char buf[100]; - GetExtraActivationFlags(buf, sizeof(buf)); - parser.ParseString(buf); - SetVerbosity(cf.verbosity); if (Verbosity()) ReportUnrecognizedFlags(); @@ -124,6 +119,8 @@ void AsanActivate() { if (!asan_is_deactivated) return; VReport(1, "Activating ASan\n"); + UpdateProcessName(); + asan_deactivated_flags.OverrideFromActivationFlags(); SetCanPoisonMemory(asan_deactivated_flags.poison_heap); Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_allocator.cc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_allocator.cc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_allocator.cc Sat Feb 6 13:39:20 2016 (r295349) @@ -14,8 +14,8 @@ // with ThreadSanitizer and MemorySanitizer. // //===----------------------------------------------------------------------===// -#include "asan_allocator.h" +#include "asan_allocator.h" #include "asan_mapping.h" #include "asan_poisoning.h" #include "asan_report.h" @@ -541,7 +541,7 @@ struct Allocator { u8 chunk_state = m->chunk_state; if (chunk_state != CHUNK_ALLOCATED) ReportInvalidFree(old_ptr, chunk_state, stack); - CHECK_NE(REAL(memcpy), (void*)0); + CHECK_NE(REAL(memcpy), nullptr); uptr memcpy_size = Min(new_size, m->UsedSize()); // If realloc() races with free(), we may start copying freed memory. // However, we will report racy double-free later anyway. @@ -579,7 +579,7 @@ struct Allocator { // Assumes alloc_beg == allocator.GetBlockBegin(alloc_beg). AsanChunk *GetAsanChunk(void *alloc_beg) { - if (!alloc_beg) return 0; + if (!alloc_beg) return nullptr; if (!allocator.FromPrimary(alloc_beg)) { uptr *meta = reinterpret_cast<uptr *>(allocator.GetMetaData(alloc_beg)); AsanChunk *m = reinterpret_cast<AsanChunk *>(meta[1]); @@ -619,7 +619,7 @@ struct Allocator { // The address is in the chunk's left redzone, so maybe it is actually // a right buffer overflow from the other chunk to the left. // Search a bit to the left to see if there is another chunk. - AsanChunk *m2 = 0; + AsanChunk *m2 = nullptr; for (uptr l = 1; l < GetPageSizeCached(); l++) { m2 = GetAsanChunkByAddr(addr - l); if (m2 == m1) continue; // Still the same chunk. @@ -653,7 +653,7 @@ static AsanAllocator &get_allocator() { } bool AsanChunkView::IsValid() { - return chunk_ != 0 && chunk_->chunk_state != CHUNK_AVAILABLE; + return chunk_ && chunk_->chunk_state != CHUNK_AVAILABLE; } uptr AsanChunkView::Beg() { return chunk_->Beg(); } uptr AsanChunkView::End() { return Beg() + UsedSize(); } @@ -723,11 +723,11 @@ void *asan_calloc(uptr nmemb, uptr size, } void *asan_realloc(void *p, uptr size, BufferedStackTrace *stack) { - if (p == 0) + if (!p) return instance.Allocate(size, 8, stack, FROM_MALLOC, true); if (size == 0) { instance.Deallocate(p, 0, stack, FROM_MALLOC); - return 0; + return nullptr; } return instance.Reallocate(p, size, stack); } @@ -755,7 +755,7 @@ int asan_posix_memalign(void **memptr, u } uptr asan_malloc_usable_size(void *ptr, uptr pc, uptr bp) { - if (ptr == 0) return 0; + if (!ptr) return 0; uptr usable_size = instance.AllocationSize(reinterpret_cast<uptr>(ptr)); if (flags()->check_malloc_usable_size && (usable_size == 0)) { GET_STACK_TRACE_FATAL(pc, bp); @@ -780,7 +780,7 @@ void AsanSoftRssLimitExceededCallback(bo instance.allocator.SetRssLimitIsExceeded(exceeded); } -} // namespace __asan +} // namespace __asan // --- Implementation of LSan-specific functions --- {{{1 namespace __lsan { @@ -881,7 +881,7 @@ int __sanitizer_get_ownership(const void } uptr __sanitizer_get_allocated_size(const void *p) { - if (p == 0) return 0; + if (!p) return 0; uptr ptr = reinterpret_cast<uptr>(p); uptr allocated_size = instance.AllocationSize(ptr); // Die if p is not malloced or if it is already freed. @@ -904,5 +904,5 @@ SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_ void __sanitizer_free_hook(void *ptr) { (void)ptr; } -} // extern "C" +} // extern "C" #endif Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_allocator.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_allocator.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_allocator.h Sat Feb 6 13:39:20 2016 (r295349) @@ -114,6 +114,11 @@ struct AsanMapUnmapCallback { # if defined(__powerpc64__) const uptr kAllocatorSpace = 0xa0000000000ULL; const uptr kAllocatorSize = 0x20000000000ULL; // 2T. +# elif defined(__aarch64__) +// AArch64/SANITIZIER_CAN_USER_ALLOCATOR64 is only for 42-bit VMA +// so no need to different values for different VMA. +const uptr kAllocatorSpace = 0x10000000000ULL; +const uptr kAllocatorSize = 0x10000000000ULL; // 3T. # else const uptr kAllocatorSpace = 0x600000000000ULL; const uptr kAllocatorSize = 0x40000000000ULL; // 4T. Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_debugging.cc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_debugging.cc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_debugging.cc Sat Feb 6 13:39:20 2016 (r295349) @@ -108,14 +108,14 @@ static uptr AsanGetStack(uptr addr, uptr return 0; } -} // namespace __asan +} // namespace __asan using namespace __asan; SANITIZER_INTERFACE_ATTRIBUTE const char *__asan_locate_address(uptr addr, char *name, uptr name_size, uptr *region_address, uptr *region_size) { - AddressDescription descr = { name, name_size, 0, 0, 0 }; + AddressDescription descr = { name, name_size, 0, 0, nullptr }; AsanLocateAddress(addr, &descr); if (region_address) *region_address = descr.region_address; if (region_size) *region_size = descr.region_size; Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_fake_stack.cc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_fake_stack.cc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_fake_stack.cc Sat Feb 6 13:39:20 2016 (r295349) @@ -11,6 +11,7 @@ // // FakeStack is used to detect use-after-return bugs. //===----------------------------------------------------------------------===// + #include "asan_allocator.h" #include "asan_poisoning.h" #include "asan_thread.h" @@ -32,7 +33,8 @@ ALWAYS_INLINE void SetShadow(uptr ptr, u if (class_id <= 6) { for (uptr i = 0; i < (1U << class_id); i++) { shadow[i] = magic; - SanitizerBreakOptimization(0); // Make sure this does not become memset. + // Make sure this does not become memset. + SanitizerBreakOptimization(nullptr); } } else { // The size class is too big, it's cheaper to poison only size bytes. @@ -80,7 +82,9 @@ void FakeStack::PoisonAll(u8 magic) { magic); } +#if !defined(_MSC_VER) || defined(__clang__) ALWAYS_INLINE USED +#endif FakeFrame *FakeStack::Allocate(uptr stack_size_log, uptr class_id, uptr real_stack) { CHECK_LT(class_id, kNumberOfSizeClasses); @@ -106,7 +110,7 @@ FakeFrame *FakeStack::Allocate(uptr stac *SavedFlagPtr(reinterpret_cast<uptr>(res), class_id) = &flags[pos]; return res; } - return 0; // We are out of fake stack. + return nullptr; // We are out of fake stack. } uptr FakeStack::AddrIsInFakeStack(uptr ptr, uptr *frame_beg, uptr *frame_end) { @@ -183,7 +187,7 @@ void SetTLSFakeStack(FakeStack *fs) { } static FakeStack *GetFakeStack() { AsanThread *t = GetCurrentThread(); - if (!t) return 0; + if (!t) return nullptr; return t->fake_stack(); } @@ -191,7 +195,7 @@ static FakeStack *GetFakeStackFast() { if (FakeStack *fs = GetTLSFakeStack()) return fs; if (!__asan_option_detect_stack_use_after_return) - return 0; + return nullptr; return GetFakeStack(); } @@ -212,7 +216,7 @@ ALWAYS_INLINE void OnFree(uptr ptr, uptr SetShadow(ptr, size, class_id, kMagic8); } -} // namespace __asan +} // namespace __asan // ---------------------- Interface ---------------- {{{1 using namespace __asan; @@ -245,13 +249,13 @@ SANITIZER_INTERFACE_ATTRIBUTE void *__asan_addr_is_in_fake_stack(void *fake_stack, void *addr, void **beg, void **end) { FakeStack *fs = reinterpret_cast<FakeStack*>(fake_stack); - if (!fs) return 0; + if (!fs) return nullptr; uptr frame_beg, frame_end; FakeFrame *frame = reinterpret_cast<FakeFrame *>(fs->AddrIsInFakeStack( reinterpret_cast<uptr>(addr), &frame_beg, &frame_end)); - if (!frame) return 0; + if (!frame) return nullptr; if (frame->magic != kCurrentStackFrameMagic) - return 0; + return nullptr; if (beg) *beg = reinterpret_cast<void*>(frame_beg); if (end) *end = reinterpret_cast<void*>(frame_end); return reinterpret_cast<void*>(frame->real_stack); @@ -276,4 +280,4 @@ void __asan_allocas_unpoison(uptr top, u REAL(memset)(reinterpret_cast<void*>(MemToShadow(top)), 0, (bottom - top) / SHADOW_GRANULARITY); } -} // extern "C" +} // extern "C" Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_flags.cc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_flags.cc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_flags.cc Sat Feb 6 13:39:20 2016 (r295349) @@ -65,6 +65,7 @@ void InitializeFlags() { cf.external_symbolizer_path = GetEnv("ASAN_SYMBOLIZER_PATH"); cf.malloc_context_size = kDefaultMallocContextSize; cf.intercept_tls_get_addr = true; + cf.exitcode = 1; OverrideCommonFlags(cf); } Flags *f = flags(); @@ -115,14 +116,6 @@ void InitializeFlags() { ubsan_parser.ParseString(GetEnv("UBSAN_OPTIONS")); #endif - // Let activation flags override current settings. On Android they come - // from a system property. On other platforms this is no-op. - if (!flags()->start_deactivated) { - char buf[100]; - GetExtraActivationFlags(buf, sizeof(buf)); - asan_parser.ParseString(buf); - } - SetVerbosity(common_flags()->verbosity); // TODO(eugenis): dump all flags at verbosity>=2? Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_flags.inc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_flags.inc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_flags.inc Sat Feb 6 13:39:20 2016 (r295349) @@ -44,9 +44,6 @@ ASAN_FLAG( "to find more errors.") ASAN_FLAG(bool, replace_intrin, true, "If set, uses custom wrappers for memset/memcpy/memmove intinsics.") -ASAN_FLAG(bool, mac_ignore_invalid_free, false, - "Ignore invalid free() calls to work around some bugs. Used on OS X " - "only.") ASAN_FLAG(bool, detect_stack_use_after_return, false, "Enables stack-use-after-return checking at run-time.") ASAN_FLAG(int, min_uar_stack_size_log, 16, // We can't do smaller anyway. @@ -62,8 +59,6 @@ ASAN_FLAG( "bytes that will be filled with malloc_fill_byte on malloc.") ASAN_FLAG(int, malloc_fill_byte, 0xbe, "Value used to fill the newly allocated memory.") -ASAN_FLAG(int, exitcode, ASAN_DEFAULT_FAILURE_EXITCODE, - "Override the program exit status if the tool found an error.") ASAN_FLAG(bool, allow_user_poisoning, true, "If set, user may manually mark memory regions as poisoned or " "unpoisoned.") @@ -77,10 +72,7 @@ ASAN_FLAG(bool, check_malloc_usable_size "295.*.") ASAN_FLAG(bool, unmap_shadow_on_exit, false, "If set, explicitly unmaps the (huge) shadow at exit.") -ASAN_FLAG( - bool, abort_on_error, false, - "If set, the tool calls abort() instead of _exit() after printing the " - "error report.") +ASAN_FLAG(bool, protect_shadow_gap, true, "If set, mprotect the shadow gap") ASAN_FLAG(bool, print_stats, false, "Print various statistics after printing an error message or if " "atexit=1.") @@ -104,8 +96,8 @@ ASAN_FLAG(bool, poison_array_cookie, tru "Poison (or not) the array cookie after operator new[].") // Turn off alloc/dealloc mismatch checker on Mac and Windows for now. -// https://code.google.com/p/address-sanitizer/issues/detail?id=131 -// https://code.google.com/p/address-sanitizer/issues/detail?id=309 +// https://github.com/google/sanitizers/issues/131 +// https://github.com/google/sanitizers/issues/309 // TODO(glider,timurrrr): Fix known issues and enable this back. ASAN_FLAG(bool, alloc_dealloc_mismatch, (SANITIZER_MAC == 0) && (SANITIZER_WINDOWS == 0), @@ -113,9 +105,6 @@ ASAN_FLAG(bool, alloc_dealloc_mismatch, ASAN_FLAG(bool, new_delete_type_mismatch, true, "Report errors on mismatch betwen size of new and delete.") -ASAN_FLAG(bool, strict_memcmp, true, - "If true, assume that memcmp(p1, p2, n) always reads n bytes before " - "comparing p1 and p2.") ASAN_FLAG( bool, strict_init_order, false, "If true, assume that dynamic initializers can never access globals from " @@ -134,8 +123,8 @@ ASAN_FLAG( "The bigger the value the harder we try.") ASAN_FLAG( bool, detect_container_overflow, true, - "If true, honor the container overflow annotations. " - "See https://code.google.com/p/address-sanitizer/wiki/ContainerOverflow") + "If true, honor the container overflow annotations. See " + "https://github.com/google/sanitizers/wiki/AddressSanitizerContainerOverflow") ASAN_FLAG(int, detect_odr_violation, 2, "If >=2, detect violation of One-Definition-Rule (ODR); " "If ==1, detect ODR-violation only if the two variables " @@ -143,3 +132,6 @@ ASAN_FLAG(int, detect_odr_violation, 2, ASAN_FLAG(bool, dump_instruction_bytes, false, "If true, dump 16 bytes starting at the instruction that caused SEGV") ASAN_FLAG(const char *, suppressions, "", "Suppressions file name.") +ASAN_FLAG(bool, halt_on_error, true, + "Crash the program after printing the first error report " + "(WARNING: USE AT YOUR OWN RISK!)") Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_globals.cc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_globals.cc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_globals.cc Sat Feb 6 13:39:20 2016 (r295349) @@ -11,6 +11,7 @@ // // Handle globals. //===----------------------------------------------------------------------===// + #include "asan_interceptors.h" #include "asan_internal.h" #include "asan_mapping.h" @@ -167,7 +168,7 @@ static void RegisterGlobal(const Global l->next = list_of_all_globals; list_of_all_globals = l; if (g->has_dynamic_init) { - if (dynamic_init_globals == 0) { + if (!dynamic_init_globals) { dynamic_init_globals = new(allocator_for_globals) VectorOfGlobals(kDynamicInitGlobalsInitialCapacity); } @@ -206,7 +207,7 @@ void StopInitOrderChecking() { } } -} // namespace __asan +} // namespace __asan // ---------------------- Interface ---------------- {{{1 using namespace __asan; // NOLINT Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_init_version.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_init_version.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_init_version.h Sat Feb 6 13:39:20 2016 (r295349) @@ -27,8 +27,8 @@ extern "C" { // v3=>v4: added '__asan_global_source_location' to __asan_global. // v4=>v5: changed the semantics and format of __asan_stack_malloc_ and // __asan_stack_free_ functions. - #define __asan_init __asan_init_v5 - #define __asan_init_name "__asan_init_v5" + // v5=>v6: changed the name of the version check symbol + #define __asan_version_mismatch_check __asan_version_mismatch_check_v6 } #endif // ASAN_INIT_VERSION_H Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interceptors.cc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interceptors.cc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interceptors.cc Sat Feb 6 13:39:20 2016 (r295349) @@ -11,8 +11,8 @@ // // Intercept various libc functions. //===----------------------------------------------------------------------===// -#include "asan_interceptors.h" +#include "asan_interceptors.h" #include "asan_allocator.h" #include "asan_internal.h" #include "asan_mapping.h" @@ -27,6 +27,12 @@ #include "sanitizer_common/sanitizer_posix.h" #endif +#if defined(__i386) && SANITIZER_LINUX +#define ASAN_PTHREAD_CREATE_VERSION "GLIBC_2.1" +#elif defined(__mips__) && SANITIZER_LINUX +#define ASAN_PTHREAD_CREATE_VERSION "GLIBC_2.2" +#endif + namespace __asan { // Return true if we can quickly decide that the region is unpoisoned. @@ -69,7 +75,7 @@ struct AsanInterceptorContext { } \ if (!suppressed) { \ GET_CURRENT_PC_BP_SP; \ - __asan_report_error(pc, bp, sp, __bad, isWrite, __size, 0); \ + ReportGenericError(pc, bp, sp, __bad, isWrite, __size, 0, false);\ } \ } \ } while (0) @@ -105,7 +111,7 @@ static inline bool RangesOverlap(const c static inline uptr MaybeRealStrnlen(const char *s, uptr maxlen) { #if ASAN_INTERCEPT_STRNLEN - if (REAL(strnlen) != 0) { + if (REAL(strnlen)) { return REAL(strnlen)(s, maxlen); } #endif @@ -123,7 +129,7 @@ int OnExit() { return 0; } -} // namespace __asan +} // namespace __asan // ---------------------- Wrappers ---------------- {{{1 using namespace __asan; // NOLINT @@ -172,7 +178,7 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free, } while (false) #define COMMON_INTERCEPTOR_BLOCK_REAL(name) REAL(name) // Strict init-order checking is dlopen-hostile: -// https://code.google.com/p/address-sanitizer/issues/detail?id=178 +// https://github.com/google/sanitizers/issues/178 #define COMMON_INTERCEPTOR_ON_DLOPEN(filename, flag) \ if (flags()->strict_init_order) { \ StopInitOrderChecking(); \ @@ -216,7 +222,7 @@ static thread_return_t THREAD_CALLING_CO ThreadStartParam *param = reinterpret_cast<ThreadStartParam *>(arg); AsanThread *t = nullptr; while ((t = reinterpret_cast<AsanThread *>( - atomic_load(¶m->t, memory_order_acquire))) == 0) + atomic_load(¶m->t, memory_order_acquire))) == nullptr) internal_sched_yield(); SetCurrentThread(t); return t->ThreadStart(GetTid(), ¶m->is_registered); @@ -231,7 +237,7 @@ INTERCEPTOR(int, pthread_create, void *t StopInitOrderChecking(); GET_STACK_TRACE_THREAD; int detached = 0; - if (attr != 0) + if (attr) REAL(pthread_attr_getdetachstate)(attr, &detached); ThreadStartParam param; atomic_store(¶m.t, 0, memory_order_relaxed); @@ -270,14 +276,14 @@ INTERCEPTOR(void*, bsd_signal, int signu } return 0; } -#else +#endif + INTERCEPTOR(void*, signal, int signum, void *handler) { if (!IsDeadlySignal(signum) || common_flags()->allow_user_segv_handler) { return REAL(signal)(signum, handler); } - return 0; + return nullptr; } -#endif INTERCEPTOR(int, sigaction, int signum, const struct sigaction *act, struct sigaction *oldact) { @@ -292,7 +298,7 @@ int real_sigaction(int signum, const voi return REAL(sigaction)(signum, (const struct sigaction *)act, (struct sigaction *)oldact); } -} // namespace __sanitizer +} // namespace __sanitizer #elif SANITIZER_POSIX // We need to have defined REAL(sigaction) on posix systems. @@ -363,40 +369,6 @@ INTERCEPTOR(void, __cxa_throw, void *a, } #endif -static inline int CharCmp(unsigned char c1, unsigned char c2) { - return (c1 == c2) ? 0 : (c1 < c2) ? -1 : 1; -} - -INTERCEPTOR(int, memcmp, const void *a1, const void *a2, uptr size) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, memcmp); - if (UNLIKELY(!asan_inited)) return internal_memcmp(a1, a2, size); - ENSURE_ASAN_INITED(); - if (flags()->replace_intrin) { - if (flags()->strict_memcmp) { - // Check the entire regions even if the first bytes of the buffers are - // different. - ASAN_READ_RANGE(ctx, a1, size); - ASAN_READ_RANGE(ctx, a2, size); - // Fallthrough to REAL(memcmp) below. - } else { - unsigned char c1 = 0, c2 = 0; - const unsigned char *s1 = (const unsigned char*)a1; - const unsigned char *s2 = (const unsigned char*)a2; - uptr i; - for (i = 0; i < size; i++) { - c1 = s1[i]; - c2 = s2[i]; - if (c1 != c2) break; - } - ASAN_READ_RANGE(ctx, s1, Min(i + 1, size)); - ASAN_READ_RANGE(ctx, s2, Min(i + 1, size)); - return CharCmp(c1, c2); - } - } - return REAL(memcmp(a1, a2, size)); -} - // memcpy is called during __asan_init() from the internals of printf(...). // We do not treat memcpy with to==from as a bug. // See http://llvm.org/bugs/show_bug.cgi?id=11763. @@ -743,7 +715,7 @@ INTERCEPTOR(int, __cxa_atexit, void (*fu #endif ENSURE_ASAN_INITED(); int res = REAL(__cxa_atexit)(func, arg, dso_handle); - REAL(__cxa_atexit)(AtCxaAtexit, 0, 0); + REAL(__cxa_atexit)(AtCxaAtexit, nullptr, nullptr); return res; } #endif // ASAN_INTERCEPT___CXA_ATEXIT @@ -767,7 +739,6 @@ void InitializeAsanInterceptors() { InitializeCommonInterceptors(); // Intercept mem* functions. - ASAN_INTERCEPT_FUNC(memcmp); ASAN_INTERCEPT_FUNC(memmove); ASAN_INTERCEPT_FUNC(memset); if (PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE) { @@ -806,9 +777,8 @@ void InitializeAsanInterceptors() { ASAN_INTERCEPT_FUNC(sigaction); #if SANITIZER_ANDROID ASAN_INTERCEPT_FUNC(bsd_signal); -#else - ASAN_INTERCEPT_FUNC(signal); #endif + ASAN_INTERCEPT_FUNC(signal); #endif #if ASAN_INTERCEPT_SWAPCONTEXT ASAN_INTERCEPT_FUNC(swapcontext); @@ -827,7 +797,11 @@ void InitializeAsanInterceptors() { // Intercept threading-related functions #if ASAN_INTERCEPT_PTHREAD_CREATE +#if defined(ASAN_PTHREAD_CREATE_VERSION) + ASAN_INTERCEPT_FUNC_VER(pthread_create, ASAN_PTHREAD_CREATE_VERSION); +#else ASAN_INTERCEPT_FUNC(pthread_create); +#endif ASAN_INTERCEPT_FUNC(pthread_join); #endif @@ -845,4 +819,4 @@ void InitializeAsanInterceptors() { VReport(1, "AddressSanitizer: libc interceptors initialized\n"); } -} // namespace __asan +} // namespace __asan Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interceptors.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interceptors.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interceptors.h Sat Feb 6 13:39:20 2016 (r295349) @@ -98,6 +98,12 @@ DECLARE_REAL(int, sigaction, int signum, if ((!INTERCEPT_FUNCTION(name) || !REAL(name))) \ VReport(1, "AddressSanitizer: failed to intercept '" #name "'\n"); \ } while (0) +#define ASAN_INTERCEPT_FUNC_VER(name, ver) \ + do { \ + if ((!INTERCEPT_FUNCTION_VER(name, ver) || !REAL(name))) \ + VReport( \ + 1, "AddressSanitizer: failed to intercept '" #name "@@" #ver "'\n"); \ + } while (0) #else // OS X interceptors don't need to be initialized with INTERCEPT_FUNCTION. #define ASAN_INTERCEPT_FUNC(name) Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interface_internal.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interface_internal.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_interface_internal.h Sat Feb 6 13:39:20 2016 (r295349) @@ -27,10 +27,14 @@ using __sanitizer::uptr; extern "C" { // This function should be called at the very beginning of the process, // before any instrumented code is executed and before any call to malloc. - // Please note that __asan_init is a macro that is replaced with - // __asan_init_vXXX at compile-time. SANITIZER_INTERFACE_ATTRIBUTE void __asan_init(); + // This function exists purely to get a linker/loader error when using + // incompatible versions of instrumentation and runtime library. Please note + // that __asan_version_mismatch_check is a macro that is replaced with + // __asan_version_mismatch_check_vXXX at compile-time. + SANITIZER_INTERFACE_ATTRIBUTE void __asan_version_mismatch_check(); + // This structure is used to describe the source location of a place where // global was defined. struct __asan_global_source_location { @@ -131,8 +135,6 @@ extern "C" { uptr addr, int is_write, uptr access_size, u32 exp); SANITIZER_INTERFACE_ATTRIBUTE - int __asan_set_error_exit_code(int exit_code); - SANITIZER_INTERFACE_ATTRIBUTE void __asan_set_death_callback(void (*callback)(void)); SANITIZER_INTERFACE_ATTRIBUTE void __asan_set_error_report_callback(void (*callback)(const char*)); @@ -165,6 +167,19 @@ extern "C" { SANITIZER_INTERFACE_ATTRIBUTE void __asan_loadN(uptr p, uptr size); SANITIZER_INTERFACE_ATTRIBUTE void __asan_storeN(uptr p, uptr size); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_load1_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_load2_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_load4_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_load8_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_load16_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_store1_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_store2_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_store4_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_store8_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_store16_noabort(uptr p); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_loadN_noabort(uptr p, uptr size); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_storeN_noabort(uptr p, uptr size); + SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_load1(uptr p, u32 exp); SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_load2(uptr p, u32 exp); SANITIZER_INTERFACE_ATTRIBUTE void __asan_exp_load4(uptr p, u32 exp); Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_internal.h ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_internal.h Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_internal.h Sat Feb 6 13:39:20 2016 (r295349) @@ -21,8 +21,6 @@ #include "sanitizer_common/sanitizer_stacktrace.h" #include "sanitizer_common/sanitizer_libc.h" -#define ASAN_DEFAULT_FAILURE_EXITCODE 1 - #if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) # error "The AddressSanitizer run-time should not be" " instrumented by AddressSanitizer" @@ -75,12 +73,9 @@ void *AsanDoesNotSupportStaticLinkage(); void AsanCheckDynamicRTPrereqs(); void AsanCheckIncompatibleRT(); -void AsanOnSIGSEGV(int, void *siginfo, void *context); +void AsanOnDeadlySignal(int, void *siginfo, void *context); -void DisableReexec(); -void MaybeReexec(); void ReadContextStack(void *context, uptr *stack, uptr *ssize); -void AsanPlatformThreadInit(); void StopInitOrderChecking(); // Wrapper for TLS/TSD. Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_linux.cc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_linux.cc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_linux.cc Sat Feb 6 13:39:20 2016 (r295349) @@ -70,14 +70,6 @@ namespace __asan { void InitializePlatformInterceptors() {} -void DisableReexec() { - // No need to re-exec on Linux. -} - -void MaybeReexec() { - // No need to re-exec on Linux. -} - void *AsanDoesNotSupportStaticLinkage() { // This will fail to link with -static. return &_DYNAMIC; // defined in link.h @@ -117,7 +109,7 @@ void AsanCheckDynamicRTPrereqs() { return; // Ensure that dynamic RT is the first DSO in the list - const char *first_dso_name = 0; + const char *first_dso_name = nullptr; dl_iterate_phdr(FindFirstDSOCallback, &first_dso_name); if (first_dso_name && !IsDynamicRTName(first_dso_name)) { Report("ASan runtime does not come first in initial library list; " @@ -142,7 +134,8 @@ void AsanCheckIncompatibleRT() { // system libraries, causing crashes later in ASan initialization. MemoryMappingLayout proc_maps(/*cache_enabled*/true); char filename[128]; - while (proc_maps.Next(0, 0, 0, filename, sizeof(filename), 0)) { + while (proc_maps.Next(nullptr, nullptr, nullptr, filename, + sizeof(filename), nullptr)) { if (IsDynamicRTName(filename)) { Report("Your application is linked against " "incompatible ASan runtimes.\n"); @@ -155,11 +148,7 @@ void AsanCheckIncompatibleRT() { } } } -#endif // SANITIZER_ANDROID - -void AsanPlatformThreadInit() { - // Nothing here for now. -} +#endif // SANITIZER_ANDROID #if !SANITIZER_ANDROID void ReadContextStack(void *context, uptr *stack, uptr *ssize) { @@ -177,6 +166,6 @@ void *AsanDlSymNext(const char *sym) { return dlsym(RTLD_NEXT, sym); } -} // namespace __asan +} // namespace __asan -#endif // SANITIZER_FREEBSD || SANITIZER_LINUX +#endif // SANITIZER_FREEBSD || SANITIZER_LINUX Modified: projects/clang380-import/contrib/compiler-rt/lib/asan/asan_mac.cc ============================================================================== --- projects/clang380-import/contrib/compiler-rt/lib/asan/asan_mac.cc Sat Feb 6 11:16:15 2016 (r295348) +++ projects/clang380-import/contrib/compiler-rt/lib/asan/asan_mac.cc Sat Feb 6 13:39:20 2016 (r295349) @@ -24,26 +24,17 @@ #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_mac.h" -#if !SANITIZER_IOS -#include <crt_externs.h> // for _NSGetArgv and _NSGetEnviron -#else -extern "C" { - extern char ***_NSGetArgv(void); -} -#endif - -#include <dlfcn.h> // for dladdr() +#include <fcntl.h> +#include <libkern/OSAtomic.h> #include <mach-o/dyld.h> #include <mach-o/loader.h> +#include <pthread.h> +#include <stdlib.h> // for free() #include <sys/mman.h> #include <sys/resource.h> #include <sys/sysctl.h> #include <sys/ucontext.h> -#include <fcntl.h> -#include <pthread.h> -#include <stdlib.h> // for free() #include <unistd.h> -#include <libkern/OSAtomic.h> namespace __asan { @@ -52,187 +43,12 @@ void InitializePlatformInterceptors() {} bool PlatformHasDifferentMemcpyAndMemmove() { // On OS X 10.7 memcpy() and memmove() are both resolved // into memmove$VARIANT$sse42. - // See also http://code.google.com/p/address-sanitizer/issues/detail?id=34. + // See also https://github.com/google/sanitizers/issues/34. // TODO(glider): need to check dynamically that memcpy() and memmove() are // actually the same function. return GetMacosVersion() == MACOS_VERSION_SNOW_LEOPARD; } -extern "C" -void __asan_init(); - -static const char kDyldInsertLibraries[] = "DYLD_INSERT_LIBRARIES"; -LowLevelAllocator allocator_for_env; - -// Change the value of the env var |name|, leaking the original value. -// If |name_value| is NULL, the variable is deleted from the environment, -// otherwise the corresponding "NAME=value" string is replaced with -// |name_value|. -void LeakyResetEnv(const char *name, const char *name_value) { - char **env = GetEnviron(); - uptr name_len = internal_strlen(name); - while (*env != 0) { - uptr len = internal_strlen(*env); - if (len > name_len) { - const char *p = *env; - if (!internal_memcmp(p, name, name_len) && p[name_len] == '=') { - // Match. - if (name_value) { - // Replace the old value with the new one. - *env = const_cast<char*>(name_value); - } else { - // Shift the subsequent pointers back. - char **del = env; - do { - del[0] = del[1]; - } while (*del++); - } - } - } - env++; - } -} - -static bool reexec_disabled = false; - -void DisableReexec() { - reexec_disabled = true; -} - -bool DyldNeedsEnvVariable() { -// If running on OS X 10.11+ or iOS 9.0+, dyld will interpose even if -// DYLD_INSERT_LIBRARIES is not set. - -#if SANITIZER_IOSSIM - // GetMacosVersion will not work for the simulator, whose kernel version - // is tied to the host. Use a weak linking hack for the simulator. - // This API was introduced in the same version of the OS as the dyld - // optimization. - - // Check for presence of a symbol that is available on OS X 10.11+, iOS 9.0+. - return (dlsym(RTLD_NEXT, "mach_memory_info") == nullptr); -#else - return (GetMacosVersion() <= MACOS_VERSION_YOSEMITE); -#endif -} - -void MaybeReexec() { - if (reexec_disabled) return; - - // Make sure the dynamic ASan runtime library is preloaded so that the - // wrappers work. If it is not, set DYLD_INSERT_LIBRARIES and re-exec - // ourselves. - Dl_info info; - CHECK(dladdr((void*)((uptr)__asan_init), &info)); - char *dyld_insert_libraries = - const_cast<char*>(GetEnv(kDyldInsertLibraries)); - uptr old_env_len = dyld_insert_libraries ? - internal_strlen(dyld_insert_libraries) : 0; - uptr fname_len = internal_strlen(info.dli_fname); - const char *dylib_name = StripModuleName(info.dli_fname); - uptr dylib_name_len = internal_strlen(dylib_name); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602061339.u16DdKAN047230>