From owner-svn-src-projects@freebsd.org Sat Sep 3 21:41:32 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E432CBCDDBE for ; Sat, 3 Sep 2016 21:41:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 641082D9; Sat, 3 Sep 2016 21:41:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u83LfV5c058799; Sat, 3 Sep 2016 21:41:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u83LfUZV058781; Sat, 3 Sep 2016 21:41:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201609032141.u83LfUZV058781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 3 Sep 2016 21:41:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r305364 - in projects/clang390-import: contrib/compiler-rt contrib/compiler-rt/include/sanitizer contrib/compiler-rt/lib/asan contrib/compiler-rt/lib/builtins contrib/compiler-rt/lib/bu... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2016 21:41:33 -0000 Author: dim Date: Sat Sep 3 21:41:29 2016 New Revision: 305364 URL: https://svnweb.freebsd.org/changeset/base/305364 Log: Update compiler-rt to 3.9.0 release, and update the build glue for libcompiler_rt and libclang_rt. Added: projects/clang390-import/contrib/compiler-rt/include/sanitizer/esan_interface.h - copied unchanged from r305361, vendor/compiler-rt/dist/include/sanitizer/esan_interface.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_memory_profile.cc - copied unchanged from r305361, vendor/compiler-rt/dist/lib/asan/asan_memory_profile.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_scariness_score.h - copied unchanged from r305361, vendor/compiler-rt/dist/lib/asan/asan_scariness_score.h projects/clang390-import/contrib/compiler-rt/lib/builtins/cpu_model.c - copied unchanged from r305361, vendor/compiler-rt/dist/lib/builtins/cpu_model.c projects/clang390-import/contrib/compiler-rt/lib/esan/ - copied from r305361, vendor/compiler-rt/dist/lib/esan/ projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingMerge.c - copied unchanged from r305361, vendor/compiler-rt/dist/lib/profile/InstrProfilingMerge.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingMergeFile.c - copied unchanged from r305361, vendor/compiler-rt/dist/lib/profile/InstrProfilingMergeFile.c projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux_s390.cc - copied unchanged from r305361, vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_s390.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux_x86_64.S - copied unchanged from r305361, vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_x86_64.S projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_termination.cc - copied unchanged from r305361, vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_termination.cc projects/clang390-import/contrib/compiler-rt/lib/scudo/ - copied from r305361, vendor/compiler-rt/dist/lib/scudo/ projects/clang390-import/contrib/compiler-rt/lib/stats/ - copied from r305361, vendor/compiler-rt/dist/lib/stats/ projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_debugging.cc - copied unchanged from r305361, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_debugging.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_preinit.cc - copied unchanged from r305361, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_preinit.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_proc.cc - copied unchanged from r305361, vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_proc.cc projects/clang390-import/lib/libclang_rt/stats/ projects/clang390-import/lib/libclang_rt/stats/Makefile (contents, props changed) projects/clang390-import/lib/libclang_rt/stats_client/ projects/clang390-import/lib/libclang_rt/stats_client/Makefile (contents, props changed) Deleted: projects/clang390-import/contrib/compiler-rt/lib/esan/CMakeLists.txt projects/clang390-import/contrib/compiler-rt/lib/scudo/CMakeLists.txt projects/clang390-import/contrib/compiler-rt/lib/stats/CMakeLists.txt Modified: projects/clang390-import/contrib/compiler-rt/LICENSE.TXT projects/clang390-import/contrib/compiler-rt/include/sanitizer/allocator_interface.h projects/clang390-import/contrib/compiler-rt/include/sanitizer/common_interface_defs.h projects/clang390-import/contrib/compiler-rt/include/sanitizer/linux_syscall_hooks.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_activation.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_allocator.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_allocator.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_fake_stack.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_fake_stack.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_flags.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_flags.inc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_globals.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_init_version.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interceptors.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interceptors.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interface_internal.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_internal.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_linux.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_mac.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_malloc_linux.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_malloc_win.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_mapping.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_new_delete.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_poisoning.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_posix.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_report.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_report.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_rtl.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_stack.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_suppressions.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_thread.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_thread.h projects/clang390-import/contrib/compiler-rt/lib/asan/asan_win.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_win_dll_thunk.cc projects/clang390-import/contrib/compiler-rt/lib/asan/asan_win_dynamic_runtime_thunk.cc projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/adddf3vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/addsf3vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_dcmp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_fcmp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_idivmod.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_ldivmod.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_memcmp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_memcpy.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_memmove.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_memset.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_uidivmod.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/aeabi_uldivmod.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/bswapdi2.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/bswapsi2.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/clzdi2.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/clzsi2.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/comparesf2.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/divdf3vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/divmodsi4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/divsf3vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/divsi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/eqdf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/eqsf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/extendsfdf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/fixdfsivfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/fixsfsivfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/fixunsdfsivfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/fixunssfsivfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/floatsidfvfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/floatsisfvfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/floatunssidfvfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/floatunssisfvfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/gedf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/gesf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/gtdf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/gtsf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/ledf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/lesf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/ltdf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/ltsf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/modsi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/muldf3vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/mulsf3vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/nedf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/negdf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/negsf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/nesf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/restore_vfp_d8_d15_regs.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/save_vfp_d8_d15_regs.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/subdf3vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/subsf3vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/switch16.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/switch32.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/switch8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/switchu8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_add_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_add_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_and_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_and_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_max_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_max_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_min_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_min_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_nand_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_nand_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_or_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_or_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_sub_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_sub_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_umax_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_umax_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_umin_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_umin_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_xor_4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_fetch_and_xor_8.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/sync_synchronize.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/truncdfsf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/udivmodsi4.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/udivsi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/umodsi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/unorddf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/arm/unordsf2vfp.S projects/clang390-import/contrib/compiler-rt/lib/builtins/assembly.h projects/clang390-import/contrib/compiler-rt/lib/builtins/clear_cache.c projects/clang390-import/contrib/compiler-rt/lib/builtins/emutls.c projects/clang390-import/contrib/compiler-rt/lib/builtins/floatdidf.c projects/clang390-import/contrib/compiler-rt/lib/builtins/floattidf.c projects/clang390-import/contrib/compiler-rt/lib/builtins/floatundidf.c projects/clang390-import/contrib/compiler-rt/lib/builtins/floatuntidf.c projects/clang390-import/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/ashldi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/ashrdi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/divdi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/floatdidf.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/floatdisf.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/floatdixf.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/floatundidf.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/floatundisf.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/floatundixf.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/lshrdi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/moddi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/muldi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/udivdi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/i386/umoddi3.S projects/clang390-import/contrib/compiler-rt/lib/builtins/int_lib.h projects/clang390-import/contrib/compiler-rt/lib/builtins/ppc/restFP.S projects/clang390-import/contrib/compiler-rt/lib/builtins/ppc/saveFP.S projects/clang390-import/contrib/compiler-rt/lib/builtins/x86_64/floatundidf.S projects/clang390-import/contrib/compiler-rt/lib/builtins/x86_64/floatundisf.S projects/clang390-import/contrib/compiler-rt/lib/builtins/x86_64/floatundixf.S projects/clang390-import/contrib/compiler-rt/lib/cfi/cfi.cc projects/clang390-import/contrib/compiler-rt/lib/dfsan/dfsan.cc projects/clang390-import/contrib/compiler-rt/lib/interception/interception_win.cc projects/clang390-import/contrib/compiler-rt/lib/interception/interception_win.h projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan.cc projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan.h projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan_allocator.cc projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan_common.cc projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan_common.h projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan_common_linux.cc projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan_flags.inc projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan_interceptors.cc projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan_thread.cc projects/clang390-import/contrib/compiler-rt/lib/lsan/lsan_thread.h projects/clang390-import/contrib/compiler-rt/lib/msan/msan.cc projects/clang390-import/contrib/compiler-rt/lib/msan/msan.h projects/clang390-import/contrib/compiler-rt/lib/msan/msan_interceptors.cc projects/clang390-import/contrib/compiler-rt/lib/msan/msan_linux.cc projects/clang390-import/contrib/compiler-rt/lib/msan/msan_report.cc projects/clang390-import/contrib/compiler-rt/lib/profile/GCDAProfiling.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfData.inc projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfiling.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfiling.h projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingBuffer.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingFile.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingInternal.h projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingPlatformOther.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingPort.h projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingUtil.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingUtil.h projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingValue.c projects/clang390-import/contrib/compiler-rt/lib/profile/InstrProfilingWriter.c projects/clang390-import/contrib/compiler-rt/lib/profile/WindowsMMap.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_allocator.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_allocator_interface.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_allocator_internal.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_atomic_msvc.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_nolibc.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_coverage_mapping_libcdep.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector1.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_deadlock_detector_interface.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_flags.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_flags.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_flags.inc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_interface_internal.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_libc.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_list.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_posix.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_posix.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_common.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_mac.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_quarantine.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_internal.h projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_mac.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_thread_registry.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_tls_get_addr.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc projects/clang390-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_win.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/dd/dd_interceptors.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/go/test.c projects/clang390-import/contrib/compiler-rt/lib/tsan/go/tsan_go.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_defs.h projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_flags.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_flags.inc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interceptors.h projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interface.h projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_interface_java.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_malloc_mac.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_mman.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_mman.h projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_mutex.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_mutex.h projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_new_delete.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_platform.h projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_report.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_report.h projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl.h projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_mutex.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_report.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_stat.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_stat.h projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_suppressions.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_sync.cc projects/clang390-import/contrib/compiler-rt/lib/tsan/rtl/tsan_sync.h projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_diag.cc projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_flags.cc projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_handlers.cc projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_handlers.h projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cc projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_handlers_cxx.h projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_platform.h projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_type_hash.h projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cc projects/clang390-import/contrib/compiler-rt/lib/ubsan/ubsan_value.cc projects/clang390-import/lib/libclang_rt/Makefile projects/clang390-import/lib/libclang_rt/Makefile.inc projects/clang390-import/lib/libclang_rt/asan-preinit/Makefile projects/clang390-import/lib/libclang_rt/asan/Makefile projects/clang390-import/lib/libclang_rt/asan_cxx/Makefile projects/clang390-import/lib/libclang_rt/asan_dynamic/Makefile projects/clang390-import/lib/libclang_rt/include/Makefile projects/clang390-import/lib/libclang_rt/profile/Makefile projects/clang390-import/lib/libclang_rt/safestack/Makefile projects/clang390-import/lib/libclang_rt/ubsan_standalone/Makefile projects/clang390-import/lib/libclang_rt/ubsan_standalone_cxx/Makefile projects/clang390-import/lib/libcompiler_rt/Makefile Directory Properties: projects/clang390-import/contrib/compiler-rt/ (props changed) Modified: projects/clang390-import/contrib/compiler-rt/LICENSE.TXT ============================================================================== --- projects/clang390-import/contrib/compiler-rt/LICENSE.TXT Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/LICENSE.TXT Sat Sep 3 21:41:29 2016 (r305364) @@ -14,7 +14,7 @@ Full text of the relevant licenses is in University of Illinois/NCSA Open Source License -Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2016 by the contributors listed in CREDITS.TXT All rights reserved. Modified: projects/clang390-import/contrib/compiler-rt/include/sanitizer/allocator_interface.h ============================================================================== --- projects/clang390-import/contrib/compiler-rt/include/sanitizer/allocator_interface.h Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/include/sanitizer/allocator_interface.h Sat Sep 3 21:41:29 2016 (r305364) @@ -59,6 +59,23 @@ extern "C" { deallocation of "ptr". */ void __sanitizer_malloc_hook(const volatile void *ptr, size_t size); void __sanitizer_free_hook(const volatile void *ptr); + + /* Installs a pair of hooks for malloc/free. + Several (currently, 5) hook pairs may be installed, they are executed + in the order they were installed and after calling + __sanitizer_malloc_hook/__sanitizer_free_hook. + Unlike __sanitizer_malloc_hook/__sanitizer_free_hook these hooks can be + chained and do not rely on weak symbols working on the platform, but + require __sanitizer_install_malloc_and_free_hooks to be called at startup + and thus will not be called on malloc/free very early in the process. + Returns the number of hooks currently installed or 0 on failure. + Not thread-safe, should be called in the main thread before starting + other threads. + */ + int __sanitizer_install_malloc_and_free_hooks( + void (*malloc_hook)(const volatile void *, size_t), + void (*free_hook)(const volatile void *)); + #ifdef __cplusplus } // extern "C" #endif Modified: projects/clang390-import/contrib/compiler-rt/include/sanitizer/common_interface_defs.h ============================================================================== --- projects/clang390-import/contrib/compiler-rt/include/sanitizer/common_interface_defs.h Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/include/sanitizer/common_interface_defs.h Sat Sep 3 21:41:29 2016 (r305364) @@ -41,6 +41,9 @@ extern "C" { // Tell the tools to write their reports to "path." instead of stderr. void __sanitizer_set_report_path(const char *path); + // Tell the tools to write their reports to the provided file descriptor + // (casted to void *). + void __sanitizer_set_report_fd(void *fd); // Notify the tools that the sandbox is going to be turned on. The reserved // parameter will be used in the future to hold a structure with functions @@ -128,8 +131,45 @@ extern "C" { 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_strncasecmp(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); + void __sanitizer_weak_hook_strcasecmp(void *called_pc, const char *s1, + const char *s2, int result); + void __sanitizer_weak_hook_strstr(void *called_pc, const char *s1, + const char *s2, char *result); + void __sanitizer_weak_hook_strcasestr(void *called_pc, const char *s1, + const char *s2, char *result); + void __sanitizer_weak_hook_memmem(void *called_pc, + const void *s1, size_t len1, + const void *s2, size_t len2, void *result); + + // Prints stack traces for all live heap allocations ordered by total + // allocation size until `top_percent` of total live heap is shown. + // `top_percent` should be between 1 and 100. + // Experimental feature currently available only with asan on Linux/x86_64. + void __sanitizer_print_memory_profile(size_t top_percent); + + // Fiber annotation interface. + // Before switching to a different stack, one must call + // __sanitizer_start_switch_fiber with a pointer to the bottom of the + // destination stack and its size. When code starts running on the new stack, + // it must call __sanitizer_finish_switch_fiber to finalize the switch. + // The start_switch function takes a void** to store the current fake stack if + // there is one (it is needed when detect_stack_use_after_return is enabled). + // When restoring a stack, this pointer must be given to the finish_switch + // function. In most cases, this void* can be stored on the stack just before + // switching. When leaving a fiber definitely, null must be passed as first + // argument to the start_switch function so that the fake stack is destroyed. + // If you do not want support for stack use-after-return detection, you can + // always pass null to these two functions. + // Note that the fake stack mechanism is disabled during fiber switch, so if a + // signal callback runs during the switch, it will not benefit from the stack + // use-after-return detection. + void __sanitizer_start_switch_fiber(void **fake_stack_save, + const void *bottom, size_t size); + void __sanitizer_finish_switch_fiber(void *fake_stack_save); #ifdef __cplusplus } // extern "C" #endif Copied: projects/clang390-import/contrib/compiler-rt/include/sanitizer/esan_interface.h (from r305361, vendor/compiler-rt/dist/include/sanitizer/esan_interface.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/clang390-import/contrib/compiler-rt/include/sanitizer/esan_interface.h Sat Sep 3 21:41:29 2016 (r305364, copy of r305361, vendor/compiler-rt/dist/include/sanitizer/esan_interface.h) @@ -0,0 +1,50 @@ +//===-- sanitizer/esan_interface.h ------------------------------*- C++ -*-===// +// +// 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 EfficiencySanitizer, a family of performance tuners. +// +// Public interface header. +//===----------------------------------------------------------------------===// +#ifndef SANITIZER_ESAN_INTERFACE_H +#define SANITIZER_ESAN_INTERFACE_H + +#include + +// We declare our interface routines as weak to allow the user to avoid +// ifdefs and instead use this pattern to allow building the same sources +// with and without our runtime library: +// if (__esan_report) +// __esan_report(); +#ifdef _MSC_VER +/* selectany is as close to weak as we'll get. */ +#define COMPILER_RT_WEAK __declspec(selectany) +#elif __GNUC__ +#define COMPILER_RT_WEAK __attribute__((weak)) +#else +#define COMPILER_RT_WEAK +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// This function can be called mid-run (or at the end of a run for +// a server process that doesn't shut down normally) to request that +// data for that point in the run be reported from the tool. +void COMPILER_RT_WEAK __esan_report(); + +// This function returns the number of samples that the esan tool has collected +// to this point. This is useful for testing. +unsigned int COMPILER_RT_WEAK __esan_get_sample_count(); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // SANITIZER_ESAN_INTERFACE_H Modified: projects/clang390-import/contrib/compiler-rt/include/sanitizer/linux_syscall_hooks.h ============================================================================== --- projects/clang390-import/contrib/compiler-rt/include/sanitizer/linux_syscall_hooks.h Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/include/sanitizer/linux_syscall_hooks.h Sat Sep 3 21:41:29 2016 (r305364) @@ -1835,6 +1835,17 @@ __sanitizer_syscall_pre_impl_vfork() #define __sanitizer_syscall_post_vfork(res) \ __sanitizer_syscall_post_impl_vfork(res) +#define __sanitizer_syscall_pre_sigaction(signum, act, oldact) \ + __sanitizer_syscall_pre_impl_sigaction((long)signum, (long)act, (long)oldact) +#define __sanitizer_syscall_post_sigaction(res, signum, act, oldact) \ + __sanitizer_syscall_post_impl_sigaction(res, (long)signum, (long)act, \ + (long)oldact) +#define __sanitizer_syscall_pre_rt_sigaction(signum, act, oldact, sz) \ + __sanitizer_syscall_pre_impl_rt_sigaction((long)signum, (long)act, \ + (long)oldact, (long)sz) +#define __sanitizer_syscall_post_rt_sigaction(res, signum, act, oldact, sz) \ + __sanitizer_syscall_post_impl_rt_sigaction(res, (long)signum, (long)act, \ + (long)oldact, (long)sz) // And now a few syscalls we don't handle yet. #define __sanitizer_syscall_pre_afs_syscall(...) @@ -1889,7 +1900,6 @@ #define __sanitizer_syscall_pre_query_module(...) #define __sanitizer_syscall_pre_readahead(...) #define __sanitizer_syscall_pre_readdir(...) -#define __sanitizer_syscall_pre_rt_sigaction(...) #define __sanitizer_syscall_pre_rt_sigreturn(...) #define __sanitizer_syscall_pre_rt_sigsuspend(...) #define __sanitizer_syscall_pre_security(...) @@ -1903,7 +1913,6 @@ #define __sanitizer_syscall_pre_setreuid32(...) #define __sanitizer_syscall_pre_set_thread_area(...) #define __sanitizer_syscall_pre_setuid32(...) -#define __sanitizer_syscall_pre_sigaction(...) #define __sanitizer_syscall_pre_sigaltstack(...) #define __sanitizer_syscall_pre_sigreturn(...) #define __sanitizer_syscall_pre_sigsuspend(...) @@ -1971,7 +1980,6 @@ #define __sanitizer_syscall_post_query_module(res, ...) #define __sanitizer_syscall_post_readahead(res, ...) #define __sanitizer_syscall_post_readdir(res, ...) -#define __sanitizer_syscall_post_rt_sigaction(res, ...) #define __sanitizer_syscall_post_rt_sigreturn(res, ...) #define __sanitizer_syscall_post_rt_sigsuspend(res, ...) #define __sanitizer_syscall_post_security(res, ...) @@ -1985,7 +1993,6 @@ #define __sanitizer_syscall_post_setreuid32(res, ...) #define __sanitizer_syscall_post_set_thread_area(res, ...) #define __sanitizer_syscall_post_setuid32(res, ...) -#define __sanitizer_syscall_post_sigaction(res, ...) #define __sanitizer_syscall_post_sigaltstack(res, ...) #define __sanitizer_syscall_post_sigreturn(res, ...) #define __sanitizer_syscall_post_sigsuspend(res, ...) @@ -3062,7 +3069,13 @@ void __sanitizer_syscall_pre_impl_fork() void __sanitizer_syscall_post_impl_fork(long res); void __sanitizer_syscall_pre_impl_vfork(); void __sanitizer_syscall_post_impl_vfork(long res); - +void __sanitizer_syscall_pre_impl_sigaction(long signum, long act, long oldact); +void __sanitizer_syscall_post_impl_sigaction(long res, long signum, long act, + long oldact); +void __sanitizer_syscall_pre_impl_rt_sigaction(long signum, long act, + long oldact, long sz); +void __sanitizer_syscall_post_impl_rt_sigaction(long res, long signum, long act, + long oldact, long sz); #ifdef __cplusplus } // extern "C" #endif Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_activation.cc ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_activation.cc Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_activation.cc Sat Sep 3 21:41:29 2016 (r305364) @@ -47,6 +47,7 @@ static struct AsanDeactivatedFlags { FlagParser parser; RegisterActivationFlags(&parser, &f, &cf); + cf.SetDefaults(); // Copy the current activation flags. allocator_options.CopyTo(&f, &cf); cf.malloc_context_size = malloc_context_size; @@ -61,7 +62,7 @@ static struct AsanDeactivatedFlags { parser.ParseString(env); } - SetVerbosity(cf.verbosity); + InitializeCommonFlags(&cf); if (Verbosity()) ReportUnrecognizedFlags(); Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_allocator.cc ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_allocator.cc Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_allocator.cc Sat Sep 3 21:41:29 2016 (r305364) @@ -223,7 +223,7 @@ void AllocatorOptions::CopyTo(Flags *f, struct Allocator { static const uptr kMaxAllowedMallocSize = - FIRST_32_SECOND_64(3UL << 30, 1UL << 40); + FIRST_32_SECOND_64(3UL << 30, 1ULL << 40); static const uptr kMaxThreadLocalQuarantine = FIRST_32_SECOND_64(1 << 18, 1 << 20); @@ -457,29 +457,28 @@ struct Allocator { return res; } - void AtomicallySetQuarantineFlag(AsanChunk *m, void *ptr, + // Set quarantine flag if chunk is allocated, issue ASan error report on + // available and quarantined chunks. Return true on success, false otherwise. + bool AtomicallySetQuarantineFlagIfAllocated(AsanChunk *m, void *ptr, BufferedStackTrace *stack) { u8 old_chunk_state = CHUNK_ALLOCATED; // Flip the chunk_state atomically to avoid race on double-free. - if (!atomic_compare_exchange_strong((atomic_uint8_t*)m, &old_chunk_state, - CHUNK_QUARANTINE, memory_order_acquire)) + if (!atomic_compare_exchange_strong((atomic_uint8_t *)m, &old_chunk_state, + CHUNK_QUARANTINE, + memory_order_acquire)) { ReportInvalidFree(ptr, old_chunk_state, stack); + // It's not safe to push a chunk in quarantine on invalid free. + return false; + } CHECK_EQ(CHUNK_ALLOCATED, old_chunk_state); + return true; } // Expects the chunk to already be marked as quarantined by using - // AtomicallySetQuarantineFlag. + // AtomicallySetQuarantineFlagIfAllocated. void QuarantineChunk(AsanChunk *m, void *ptr, BufferedStackTrace *stack, AllocType alloc_type) { CHECK_EQ(m->chunk_state, CHUNK_QUARANTINE); - - if (m->alloc_type != alloc_type) { - if (atomic_load(&alloc_dealloc_mismatch, memory_order_acquire)) { - ReportAllocTypeMismatch((uptr)ptr, stack, (AllocType)m->alloc_type, - (AllocType)alloc_type); - } - } - CHECK_GE(m->alloc_tid, 0); if (SANITIZER_WORDSIZE == 64) // On 32-bits this resides in user area. CHECK_EQ(m->free_tid, kInvalidTid); @@ -516,13 +515,24 @@ struct Allocator { uptr chunk_beg = p - kChunkHeaderSize; AsanChunk *m = reinterpret_cast(chunk_beg); + + ASAN_FREE_HOOK(ptr); + // Must mark the chunk as quarantined before any changes to its metadata. + // Do not quarantine given chunk if we failed to set CHUNK_QUARANTINE flag. + if (!AtomicallySetQuarantineFlagIfAllocated(m, ptr, stack)) return; + + if (m->alloc_type != alloc_type) { + if (atomic_load(&alloc_dealloc_mismatch, memory_order_acquire)) { + ReportAllocTypeMismatch((uptr)ptr, stack, (AllocType)m->alloc_type, + (AllocType)alloc_type); + } + } + if (delete_size && flags()->new_delete_type_mismatch && delete_size != m->UsedSize()) { - ReportNewDeleteSizeMismatch(p, delete_size, stack); + ReportNewDeleteSizeMismatch(p, m->UsedSize(), delete_size, stack); } - ASAN_FREE_HOOK(ptr); - // Must mark the chunk as quarantined before any changes to its metadata. - AtomicallySetQuarantineFlag(m, ptr, stack); + QuarantineChunk(m, ptr, stack, alloc_type); } @@ -655,6 +665,9 @@ static AsanAllocator &get_allocator() { bool AsanChunkView::IsValid() { return chunk_ && chunk_->chunk_state != CHUNK_AVAILABLE; } +bool AsanChunkView::IsAllocated() { + return chunk_ && chunk_->chunk_state == CHUNK_ALLOCATED; +} uptr AsanChunkView::Beg() { return chunk_->Beg(); } uptr AsanChunkView::End() { return Beg() + UsedSize(); } uptr AsanChunkView::UsedSize() { return chunk_->UsedSize(); } @@ -668,12 +681,15 @@ static StackTrace GetStackTraceFromId(u3 return res; } +u32 AsanChunkView::GetAllocStackId() { return chunk_->alloc_context_id; } +u32 AsanChunkView::GetFreeStackId() { return chunk_->free_context_id; } + StackTrace AsanChunkView::GetAllocStack() { - return GetStackTraceFromId(chunk_->alloc_context_id); + return GetStackTraceFromId(GetAllocStackId()); } StackTrace AsanChunkView::GetFreeStack() { - return GetStackTraceFromId(chunk_->free_context_id); + return GetStackTraceFromId(GetFreeStackId()); } void InitializeAllocator(const AllocatorOptions &options) { @@ -754,7 +770,7 @@ int asan_posix_memalign(void **memptr, u return 0; } -uptr asan_malloc_usable_size(void *ptr, uptr pc, uptr bp) { +uptr asan_malloc_usable_size(const void *ptr, uptr pc, uptr bp) { if (!ptr) return 0; uptr usable_size = instance.AllocationSize(reinterpret_cast(ptr)); if (flags()->check_malloc_usable_size && (usable_size == 0)) { Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_allocator.h ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_allocator.h Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_allocator.h Sat Sep 3 21:41:29 2016 (r305364) @@ -49,14 +49,17 @@ void GetAllocatorOptions(AllocatorOption class AsanChunkView { public: explicit AsanChunkView(AsanChunk *chunk) : chunk_(chunk) {} - bool IsValid(); // Checks if AsanChunkView points to a valid allocated - // or quarantined chunk. - uptr Beg(); // First byte of user memory. - uptr End(); // Last byte of user memory. - uptr UsedSize(); // Size requested by the user. + bool IsValid(); // Checks if AsanChunkView points to a valid allocated + // or quarantined chunk. + bool IsAllocated(); // Checks if the memory is currently allocated. + uptr Beg(); // First byte of user memory. + uptr End(); // Last byte of user memory. + uptr UsedSize(); // Size requested by the user. uptr AllocTid(); uptr FreeTid(); bool Eq(const AsanChunkView &c) const { return chunk_ == c.chunk_; } + u32 GetAllocStackId(); + u32 GetFreeStackId(); StackTrace GetAllocStack(); StackTrace GetFreeStack(); bool AddrIsInside(uptr addr, uptr access_size, sptr *offset) { @@ -171,7 +174,7 @@ void *asan_pvalloc(uptr size, BufferedSt int asan_posix_memalign(void **memptr, uptr alignment, uptr size, BufferedStackTrace *stack); -uptr asan_malloc_usable_size(void *ptr, uptr pc, uptr bp); +uptr asan_malloc_usable_size(const void *ptr, uptr pc, uptr bp); uptr asan_mz_size(const void *ptr); void asan_mz_force_lock(); Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_fake_stack.cc ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_fake_stack.cc Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_fake_stack.cc Sat Sep 3 21:41:29 2016 (r305364) @@ -31,7 +31,7 @@ ALWAYS_INLINE void SetShadow(uptr ptr, u CHECK_EQ(SHADOW_SCALE, 3); // This code expects SHADOW_SCALE=3. u64 *shadow = reinterpret_cast(MemToShadow(ptr)); if (class_id <= 6) { - for (uptr i = 0; i < (1U << class_id); i++) { + for (uptr i = 0; i < (((uptr)1) << class_id); i++) { shadow[i] = magic; // Make sure this does not become memset. SanitizerBreakOptimization(nullptr); @@ -121,7 +121,7 @@ uptr FakeStack::AddrIsInFakeStack(uptr p uptr class_id = (ptr - beg) >> stack_size_log; uptr base = beg + (class_id << stack_size_log); CHECK_LE(base, ptr); - CHECK_LT(ptr, base + (1UL << stack_size_log)); + CHECK_LT(ptr, base + (((uptr)1) << stack_size_log)); uptr pos = (ptr - base) >> (kMinStackFrameSizeLog + class_id); uptr res = base + pos * BytesInSizeClass(class_id); *frame_end = res + BytesInSizeClass(class_id); Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_fake_stack.h ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_fake_stack.h Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_fake_stack.h Sat Sep 3 21:41:29 2016 (r305364) @@ -69,12 +69,12 @@ class FakeStack { // stack_size_log is at least 15 (stack_size >= 32K). static uptr SizeRequiredForFlags(uptr stack_size_log) { - return 1UL << (stack_size_log + 1 - kMinStackFrameSizeLog); + return ((uptr)1) << (stack_size_log + 1 - kMinStackFrameSizeLog); } // Each size class occupies stack_size bytes. static uptr SizeRequiredForFrames(uptr stack_size_log) { - return (1ULL << stack_size_log) * kNumberOfSizeClasses; + return (((uptr)1) << stack_size_log) * kNumberOfSizeClasses; } // Number of bytes requires for the whole object. @@ -91,12 +91,12 @@ class FakeStack { // and so on. static uptr FlagsOffset(uptr stack_size_log, uptr class_id) { uptr t = kNumberOfSizeClasses - 1 - class_id; - const uptr all_ones = (1 << (kNumberOfSizeClasses - 1)) - 1; + const uptr all_ones = (((uptr)1) << (kNumberOfSizeClasses - 1)) - 1; return ((all_ones >> t) << t) << (stack_size_log - 15); } static uptr NumberOfFrames(uptr stack_size_log, uptr class_id) { - return 1UL << (stack_size_log - kMinStackFrameSizeLog - class_id); + return ((uptr)1) << (stack_size_log - kMinStackFrameSizeLog - class_id); } // Divide n by the numbe of frames in size class. @@ -114,7 +114,8 @@ class FakeStack { u8 *GetFrame(uptr stack_size_log, uptr class_id, uptr pos) { return reinterpret_cast(this) + kFlagsOffset + SizeRequiredForFlags(stack_size_log) + - (1 << stack_size_log) * class_id + BytesInSizeClass(class_id) * pos; + (((uptr)1) << stack_size_log) * class_id + + BytesInSizeClass(class_id) * pos; } // Allocate the fake frame. @@ -137,7 +138,7 @@ class FakeStack { // Number of bytes in a fake frame of this size class. static uptr BytesInSizeClass(uptr class_id) { - return 1UL << (class_id + kMinStackFrameSizeLog); + return ((uptr)1) << (class_id + kMinStackFrameSizeLog); } // The fake frame is guaranteed to have a right redzone. @@ -159,7 +160,7 @@ class FakeStack { static const uptr kFlagsOffset = 4096; // This is were the flags begin. // Must match the number of uses of DEFINE_STACK_MALLOC_FREE_WITH_CLASS_ID COMPILER_CHECK(kNumberOfSizeClasses == 11); - static const uptr kMaxStackMallocSize = 1 << kMaxStackFrameSizeLog; + static const uptr kMaxStackMallocSize = ((uptr)1) << kMaxStackFrameSizeLog; uptr hint_position_[kNumberOfSizeClasses]; uptr stack_size_log_; Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_flags.cc ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_flags.cc Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_flags.cc Sat Sep 3 21:41:29 2016 (r305364) @@ -116,7 +116,7 @@ void InitializeFlags() { ubsan_parser.ParseString(GetEnv("UBSAN_OPTIONS")); #endif - SetVerbosity(common_flags()->verbosity); + InitializeCommonFlags(); // TODO(eugenis): dump all flags at verbosity>=2? if (Verbosity()) ReportUnrecognizedFlags(); @@ -159,6 +159,14 @@ void InitializeFlags() { (ASAN_LOW_MEMORY) ? 1UL << 6 : 1UL << 8; f->quarantine_size_mb = kDefaultQuarantineSizeMb; } + if (!f->replace_str && common_flags()->intercept_strlen) { + Report("WARNING: strlen interceptor is enabled even though replace_str=0. " + "Use intercept_strlen=0 to disable it."); + } + if (!f->replace_str && common_flags()->intercept_strchr) { + Report("WARNING: strchr* interceptors are enabled even though " + "replace_str=0. Use intercept_strchr=0 to disable them."); + } } } // namespace __asan Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_flags.inc ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_flags.inc Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_flags.inc Sat Sep 3 21:41:29 2016 (r305364) @@ -43,7 +43,7 @@ ASAN_FLAG( "If set, uses custom wrappers and replacements for libc string functions " "to find more errors.") ASAN_FLAG(bool, replace_intrin, true, - "If set, uses custom wrappers for memset/memcpy/memmove intinsics.") + "If set, uses custom wrappers for memset/memcpy/memmove intrinsics.") 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. @@ -77,6 +77,8 @@ ASAN_FLAG(bool, print_stats, false, "Print various statistics after printing an error message or if " "atexit=1.") ASAN_FLAG(bool, print_legend, true, "Print the legend for the shadow bytes.") +ASAN_FLAG(bool, print_scariness, false, + "Print the scariness score. Experimental.") ASAN_FLAG(bool, atexit, false, "If set, prints ASan exit stats even after program terminates " "successfully.") @@ -104,7 +106,7 @@ ASAN_FLAG(bool, alloc_dealloc_mismatch, "Report errors on malloc/delete, new/free, new/delete[], etc.") ASAN_FLAG(bool, new_delete_type_mismatch, true, - "Report errors on mismatch betwen size of new and delete.") + "Report errors on mismatch between size of new and delete.") ASAN_FLAG( bool, strict_init_order, false, "If true, assume that dynamic initializers can never access globals from " @@ -135,3 +137,5 @@ ASAN_FLAG(const char *, suppressions, "" ASAN_FLAG(bool, halt_on_error, true, "Crash the program after printing the first error report " "(WARNING: USE AT YOUR OWN RISK!)") +ASAN_FLAG(bool, use_odr_indicator, false, + "Use special ODR indicator symbol for ODR violation detection") Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_globals.cc ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_globals.cc Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_globals.cc Sat Sep 3 21:41:29 2016 (r305364) @@ -135,6 +135,70 @@ bool GetInfoForAddressIfGlobal(uptr addr return false; } +enum GlobalSymbolState { + UNREGISTERED = 0, + REGISTERED = 1 +}; + +// Check ODR violation for given global G via special ODR indicator. We use +// this method in case compiler instruments global variables through their +// local aliases. +static void CheckODRViolationViaIndicator(const Global *g) { + u8 *odr_indicator = reinterpret_cast(g->odr_indicator); + if (*odr_indicator == UNREGISTERED) { + *odr_indicator = REGISTERED; + return; + } + // If *odr_indicator is DEFINED, some module have already registered + // externally visible symbol with the same name. This is an ODR violation. + for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) { + if (g->odr_indicator == l->g->odr_indicator && + (flags()->detect_odr_violation >= 2 || g->size != l->g->size) && + !IsODRViolationSuppressed(g->name)) + ReportODRViolation(g, FindRegistrationSite(g), + l->g, FindRegistrationSite(l->g)); + } +} + +// Check ODR violation for given global G by checking if it's already poisoned. +// We use this method in case compiler doesn't use private aliases for global +// variables. +static void CheckODRViolationViaPoisoning(const Global *g) { + if (__asan_region_is_poisoned(g->beg, g->size_with_redzone)) { + // This check may not be enough: if the first global is much larger + // the entire redzone of the second global may be within the first global. + for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) { + if (g->beg == l->g->beg && + (flags()->detect_odr_violation >= 2 || g->size != l->g->size) && + !IsODRViolationSuppressed(g->name)) + ReportODRViolation(g, FindRegistrationSite(g), + l->g, FindRegistrationSite(l->g)); + } + } +} + +// Clang provides two different ways for global variables protection: +// it can poison the global itself or its private alias. In former +// case we may poison same symbol multiple times, that can help us to +// cheaply detect ODR violation: if we try to poison an already poisoned +// global, we have ODR violation error. +// In latter case, we poison each symbol exactly once, so we use special +// indicator symbol to perform similar check. +// In either case, compiler provides a special odr_indicator field to Global +// structure, that can contain two kinds of values: +// 1) Non-zero value. In this case, odr_indicator is an address of +// corresponding indicator variable for given global. +// 2) Zero. This means that we don't use private aliases for global variables +// and can freely check ODR violation with the first method. +// +// This routine chooses between two different methods of ODR violation +// detection. +static inline bool UseODRIndicator(const Global *g) { + // Use ODR indicator method iff use_odr_indicator flag is set and + // indicator symbol address is not 0. + return flags()->use_odr_indicator && g->odr_indicator > 0; +} + // Register a global variable. // This function may be called more than once for every global // so we store the globals in a map. @@ -144,22 +208,24 @@ static void RegisterGlobal(const Global ReportGlobal(*g, "Added"); CHECK(flags()->report_globals); CHECK(AddrIsInMem(g->beg)); - CHECK(AddrIsAlignedByGranularity(g->beg)); + if (!AddrIsAlignedByGranularity(g->beg)) { + Report("The following global variable is not properly aligned.\n"); + Report("This may happen if another global with the same name\n"); + Report("resides in another non-instrumented module.\n"); + Report("Or the global comes from a C file built w/o -fno-common.\n"); + Report("In either case this is likely an ODR violation bug,\n"); + Report("but AddressSanitizer can not provide more details.\n"); + ReportODRViolation(g, FindRegistrationSite(g), g, FindRegistrationSite(g)); + CHECK(AddrIsAlignedByGranularity(g->beg)); + } CHECK(AddrIsAlignedByGranularity(g->size_with_redzone)); if (flags()->detect_odr_violation) { // Try detecting ODR (One Definition Rule) violation, i.e. the situation // where two globals with the same name are defined in different modules. - if (__asan_region_is_poisoned(g->beg, g->size_with_redzone)) { - // This check may not be enough: if the first global is much larger - // the entire redzone of the second global may be within the first global. - for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) { - if (g->beg == l->g->beg && - (flags()->detect_odr_violation >= 2 || g->size != l->g->size) && - !IsODRViolationSuppressed(g->name)) - ReportODRViolation(g, FindRegistrationSite(g), - l->g, FindRegistrationSite(l->g)); - } - } + if (UseODRIndicator(g)) + CheckODRViolationViaIndicator(g); + else + CheckODRViolationViaPoisoning(g); } if (CanPoisonMemory()) PoisonRedZones(*g); @@ -190,6 +256,12 @@ static void UnregisterGlobal(const Globa // We unpoison the shadow memory for the global but we do not remove it from // the list because that would require O(n^2) time with the current list // implementation. It might not be worth doing anyway. + + // Release ODR indicator. + if (UseODRIndicator(g)) { + u8 *odr_indicator = reinterpret_cast(g->odr_indicator); + *odr_indicator = UNREGISTERED; + } } void StopInitOrderChecking() { @@ -212,6 +284,25 @@ void StopInitOrderChecking() { // ---------------------- Interface ---------------- {{{1 using namespace __asan; // NOLINT + +// Apply __asan_register_globals to all globals found in the same loaded +// executable or shared library as `flag'. The flag tracks whether globals have +// already been registered or not for this image. +void __asan_register_image_globals(uptr *flag) { + if (*flag) + return; + AsanApplyToGlobals(__asan_register_globals, flag); + *flag = 1; +} + +// This mirrors __asan_register_image_globals. +void __asan_unregister_image_globals(uptr *flag) { + if (!*flag) + return; + AsanApplyToGlobals(__asan_unregister_globals, flag); + *flag = 0; +} + // Register an array of globals. void __asan_register_globals(__asan_global *globals, uptr n) { if (!flags()->report_globals) return; Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_init_version.h ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_init_version.h Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_init_version.h Sat Sep 3 21:41:29 2016 (r305364) @@ -19,16 +19,20 @@ extern "C" { // Every time the ASan ABI changes we also change the version number in the // __asan_init function name. Objects built with incompatible ASan ABI // versions will not link with run-time. + // // Changes between ABI versions: // v1=>v2: added 'module_name' to __asan_global // v2=>v3: stack frame description (created by the compiler) - // contains the function PC as the 3-rd field (see - // DescribeAddressIfStack). - // v3=>v4: added '__asan_global_source_location' to __asan_global. + // contains the function PC as the 3rd field (see + // DescribeAddressIfStack) + // 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. + // __asan_stack_free_ functions // v5=>v6: changed the name of the version check symbol - #define __asan_version_mismatch_check __asan_version_mismatch_check_v6 + // v6=>v7: added 'odr_indicator' to __asan_global + // v7=>v8: added '__asan_(un)register_image_globals' functions for dead + // stripping support on Mach-O platforms + #define __asan_version_mismatch_check __asan_version_mismatch_check_v8 } #endif // ASAN_INIT_VERSION_H Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interceptors.cc ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interceptors.cc Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interceptors.cc Sat Sep 3 21:41:29 2016 (r305364) @@ -21,6 +21,7 @@ #include "asan_stack.h" #include "asan_stats.h" #include "asan_suppressions.h" +#include "lsan/lsan_common.h" #include "sanitizer_common/sanitizer_libc.h" #if SANITIZER_POSIX @@ -110,7 +111,7 @@ static inline bool RangesOverlap(const c } while (0) static inline uptr MaybeRealStrnlen(const char *s, uptr maxlen) { -#if ASAN_INTERCEPT_STRNLEN +#if SANITIZER_INTERCEPT_STRNLEN if (REAL(strnlen)) { return REAL(strnlen)(s, maxlen); } @@ -143,6 +144,8 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free, (void) ctx; \ #define COMMON_INTERCEPT_FUNCTION(name) ASAN_INTERCEPT_FUNC(name) +#define COMMON_INTERCEPT_FUNCTION_VER(name, ver) \ + ASAN_INTERCEPT_FUNC_VER(name, ver) #define COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, size) \ ASAN_WRITE_RANGE(ctx, ptr, size) #define COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, size) \ @@ -195,6 +198,10 @@ DECLARE_REAL_AND_INTERCEPTOR(void, free, } else { \ *begin = *end = 0; \ } +// Asan needs custom handling of these: +#undef SANITIZER_INTERCEPT_MEMSET +#undef SANITIZER_INTERCEPT_MEMMOVE +#undef SANITIZER_INTERCEPT_MEMCPY #include "sanitizer_common/sanitizer_common_interceptors.inc" // Syscall interceptors don't have contexts, we don't support suppressions @@ -218,6 +225,7 @@ struct ThreadStartParam { atomic_uintptr_t is_registered; }; +#if ASAN_INTERCEPT_PTHREAD_CREATE static thread_return_t THREAD_CALLING_CONV asan_thread_start(void *arg) { ThreadStartParam *param = reinterpret_cast(arg); AsanThread *t = nullptr; @@ -228,7 +236,6 @@ static thread_return_t THREAD_CALLING_CO return t->ThreadStart(GetTid(), ¶m->is_registered); } -#if ASAN_INTERCEPT_PTHREAD_CREATE INTERCEPTOR(int, pthread_create, void *thread, void *attr, void *(*start_routine)(void*), void *arg) { EnsureMainThreadIDIsCorrect(); @@ -242,7 +249,17 @@ INTERCEPTOR(int, pthread_create, void *t ThreadStartParam param; atomic_store(¶m.t, 0, memory_order_relaxed); atomic_store(¶m.is_registered, 0, memory_order_relaxed); - int result = REAL(pthread_create)(thread, attr, asan_thread_start, ¶m); + int result; + { + // Ignore all allocations made by pthread_create: thread stack/TLS may be + // stored by pthread for future reuse even after thread destruction, and + // the linked list it's stored in doesn't even hold valid pointers to the + // objects, the latter are calculated by obscure pointer arithmetic. +#if CAN_SANITIZE_LEAKS + __lsan::ScopedInterceptorDisabler disabler; +#endif + result = REAL(pthread_create)(thread, attr, asan_thread_start, ¶m); + } if (result == 0) { u32 current_tid = GetCurrentTidOrInvalid(); AsanThread *t = @@ -271,7 +288,8 @@ DEFINE_REAL_PTHREAD_FUNCTIONS #if SANITIZER_ANDROID INTERCEPTOR(void*, bsd_signal, int signum, void *handler) { - if (!IsDeadlySignal(signum) || common_flags()->allow_user_segv_handler) { + if (!IsHandledDeadlySignal(signum) || + common_flags()->allow_user_segv_handler) { return REAL(bsd_signal)(signum, handler); } return 0; @@ -279,7 +297,8 @@ INTERCEPTOR(void*, bsd_signal, int signu #endif INTERCEPTOR(void*, signal, int signum, void *handler) { - if (!IsDeadlySignal(signum) || common_flags()->allow_user_segv_handler) { + if (!IsHandledDeadlySignal(signum) || + common_flags()->allow_user_segv_handler) { return REAL(signal)(signum, handler); } return nullptr; @@ -287,7 +306,8 @@ INTERCEPTOR(void*, signal, int signum, v INTERCEPTOR(int, sigaction, int signum, const struct sigaction *act, struct sigaction *oldact) { - if (!IsDeadlySignal(signum) || common_flags()->allow_user_segv_handler) { + if (!IsHandledDeadlySignal(signum) || + common_flags()->allow_user_segv_handler) { return REAL(sigaction)(signum, act, oldact); } return 0; @@ -453,25 +473,6 @@ INTERCEPTOR(void*, memset, void *block, ASAN_MEMSET_IMPL(ctx, block, c, size); } -INTERCEPTOR(char*, strchr, const char *str, int c) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strchr); - if (UNLIKELY(!asan_inited)) return internal_strchr(str, c); - // strchr is called inside create_purgeable_zone() when MallocGuardEdges=1 is - // used. - if (asan_init_is_running) { - return REAL(strchr)(str, c); - } - ENSURE_ASAN_INITED(); - char *result = REAL(strchr)(str, c); - if (flags()->replace_str) { - uptr len = REAL(strlen)(str); - uptr bytes_read = (result ? result - str : len) + 1; - ASAN_READ_STRING_OF_LEN(ctx, str, len, bytes_read); - } - return result; -} - #if ASAN_INTERCEPT_INDEX # if ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX INTERCEPTOR(char*, index, const char *string, int c) @@ -549,7 +550,6 @@ INTERCEPTOR(char*, strcpy, char *to, con return REAL(strcpy)(to, from); // NOLINT } -#if ASAN_INTERCEPT_STRDUP INTERCEPTOR(char*, strdup, const char *s) { void *ctx; ASAN_INTERCEPTOR_ENTER(ctx, strdup); @@ -564,29 +564,28 @@ INTERCEPTOR(char*, strdup, const char *s REAL(memcpy)(new_mem, s, length + 1); return reinterpret_cast(new_mem); } -#endif -INTERCEPTOR(SIZE_T, strlen, const char *s) { +#if ASAN_INTERCEPT___STRDUP +INTERCEPTOR(char*, __strdup, const char *s) { void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strlen); - if (UNLIKELY(!asan_inited)) return internal_strlen(s); - // strlen is called from malloc_default_purgeable_zone() - // in __asan::ReplaceSystemAlloc() on Mac. - if (asan_init_is_running) { - return REAL(strlen)(s); - } + ASAN_INTERCEPTOR_ENTER(ctx, strdup); + if (UNLIKELY(!asan_inited)) return internal_strdup(s); ENSURE_ASAN_INITED(); - SIZE_T length = REAL(strlen)(s); + uptr length = REAL(strlen)(s); if (flags()->replace_str) { ASAN_READ_RANGE(ctx, s, length + 1); } - return length; + GET_STACK_TRACE_MALLOC; + void *new_mem = asan_malloc(length + 1, &stack); + REAL(memcpy)(new_mem, s, length + 1); + return reinterpret_cast(new_mem); } +#endif // ASAN_INTERCEPT___STRDUP INTERCEPTOR(SIZE_T, wcslen, const wchar_t *s) { void *ctx; ASAN_INTERCEPTOR_ENTER(ctx, wcslen); - SIZE_T length = REAL(wcslen)(s); + SIZE_T length = internal_wcslen(s); if (!asan_init_is_running) { ENSURE_ASAN_INITED(); ASAN_READ_RANGE(ctx, s, (length + 1) * sizeof(wchar_t)); @@ -607,19 +606,6 @@ INTERCEPTOR(char*, strncpy, char *to, co return REAL(strncpy)(to, from, size); } -#if ASAN_INTERCEPT_STRNLEN -INTERCEPTOR(uptr, strnlen, const char *s, uptr maxlen) { - void *ctx; - ASAN_INTERCEPTOR_ENTER(ctx, strnlen); - ENSURE_ASAN_INITED(); - uptr length = REAL(strnlen)(s, maxlen); - if (flags()->replace_str) { - ASAN_READ_RANGE(ctx, s, Min(length + 1, maxlen)); - } - return length; -} -#endif // ASAN_INTERCEPT_STRNLEN - INTERCEPTOR(long, strtol, const char *nptr, // NOLINT char **endptr, int base) { void *ctx; @@ -702,12 +688,12 @@ INTERCEPTOR(long long, atoll, const char } #endif // ASAN_INTERCEPT_ATOLL_AND_STRTOLL +#if ASAN_INTERCEPT___CXA_ATEXIT static void AtCxaAtexit(void *unused) { (void)unused; StopInitOrderChecking(); } -#if ASAN_INTERCEPT___CXA_ATEXIT INTERCEPTOR(int, __cxa_atexit, void (*func)(void *), void *arg, void *dso_handle) { #if SANITIZER_MAC @@ -739,25 +725,23 @@ void InitializeAsanInterceptors() { InitializeCommonInterceptors(); // Intercept mem* functions. - ASAN_INTERCEPT_FUNC(memmove); + ASAN_INTERCEPT_FUNC(memcpy); ASAN_INTERCEPT_FUNC(memset); if (PLATFORM_HAS_DIFFERENT_MEMCPY_AND_MEMMOVE) { - ASAN_INTERCEPT_FUNC(memcpy); + // In asan, REAL(memmove) is not used, but it is used in msan. + ASAN_INTERCEPT_FUNC(memmove); } + CHECK(REAL(memcpy)); // Intercept str* functions. ASAN_INTERCEPT_FUNC(strcat); // NOLINT - ASAN_INTERCEPT_FUNC(strchr); ASAN_INTERCEPT_FUNC(strcpy); // NOLINT - ASAN_INTERCEPT_FUNC(strlen); ASAN_INTERCEPT_FUNC(wcslen); ASAN_INTERCEPT_FUNC(strncat); ASAN_INTERCEPT_FUNC(strncpy); -#if ASAN_INTERCEPT_STRDUP ASAN_INTERCEPT_FUNC(strdup); -#endif -#if ASAN_INTERCEPT_STRNLEN - ASAN_INTERCEPT_FUNC(strnlen); +#if ASAN_INTERCEPT___STRDUP + ASAN_INTERCEPT_FUNC(__strdup); #endif #if ASAN_INTERCEPT_INDEX && ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX ASAN_INTERCEPT_FUNC(index); Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interceptors.h ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interceptors.h Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interceptors.h Sat Sep 3 21:41:29 2016 (r305364) @@ -23,14 +23,12 @@ #if !SANITIZER_WINDOWS # define ASAN_INTERCEPT_ATOLL_AND_STRTOLL 1 # define ASAN_INTERCEPT__LONGJMP 1 -# define ASAN_INTERCEPT_STRDUP 1 # define ASAN_INTERCEPT_INDEX 1 # define ASAN_INTERCEPT_PTHREAD_CREATE 1 # define ASAN_INTERCEPT_FORK 1 #else # define ASAN_INTERCEPT_ATOLL_AND_STRTOLL 0 # define ASAN_INTERCEPT__LONGJMP 0 -# define ASAN_INTERCEPT_STRDUP 0 # define ASAN_INTERCEPT_INDEX 0 # define ASAN_INTERCEPT_PTHREAD_CREATE 0 # define ASAN_INTERCEPT_FORK 0 @@ -42,12 +40,6 @@ # define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 0 #endif -#if !SANITIZER_MAC -# define ASAN_INTERCEPT_STRNLEN 1 -#else -# define ASAN_INTERCEPT_STRNLEN 0 -#endif - #if SANITIZER_LINUX && !SANITIZER_ANDROID # define ASAN_INTERCEPT_SWAPCONTEXT 1 #else @@ -80,6 +72,12 @@ # define ASAN_INTERCEPT___CXA_ATEXIT 0 #endif +#if SANITIZER_LINUX && !SANITIZER_ANDROID +# define ASAN_INTERCEPT___STRDUP 1 +#else +# define ASAN_INTERCEPT___STRDUP 0 +#endif + DECLARE_REAL(int, memcmp, const void *a1, const void *a2, uptr size) DECLARE_REAL(void*, memcpy, void *to, const void *from, uptr size) DECLARE_REAL(void*, memset, void *block, int c, uptr size) Modified: projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interface_internal.h ============================================================================== --- projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interface_internal.h Sat Sep 3 20:43:59 2016 (r305363) +++ projects/clang390-import/contrib/compiler-rt/lib/asan/asan_interface_internal.h Sat Sep 3 21:41:29 2016 (r305364) @@ -54,8 +54,17 @@ extern "C" { uptr has_dynamic_init; // Non-zero if the global has dynamic initializer. __asan_global_source_location *location; // Source location of a global, // or NULL if it is unknown. + uptr odr_indicator; // The address of the ODR indicator symbol. }; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***