├── .arcconfig ├── .gitignore ├── CMakeLists.txt ├── CODE_OWNERS.TXT ├── CREDITS.TXT ├── LICENSE.TXT ├── README.txt ├── cmake ├── Modules │ ├── AddCompilerRT.cmake │ ├── BuiltinTests.cmake │ ├── CompilerRTCompile.cmake │ ├── CompilerRTDarwinUtils.cmake │ ├── CompilerRTLink.cmake │ ├── CompilerRTUtils.cmake │ ├── HandleCompilerRT.cmake │ └── SanitizerUtils.cmake ├── base-config-ix.cmake ├── builtin-config-ix.cmake ├── caches │ └── Apple.cmake └── config-ix.cmake ├── docs └── TestingGuide.rst ├── include ├── CMakeLists.txt ├── sanitizer │ ├── allocator_interface.h │ ├── asan_interface.h │ ├── common_interface_defs.h │ ├── coverage_interface.h │ ├── dfsan_interface.h │ ├── esan_interface.h │ ├── hwasan_interface.h │ ├── linux_syscall_hooks.h │ ├── lsan_interface.h │ ├── msan_interface.h │ ├── netbsd_syscall_hooks.h │ ├── scudo_interface.h │ ├── tsan_interface.h │ └── tsan_interface_atomic.h └── xray │ ├── xray_interface.h │ ├── xray_log_interface.h │ └── xray_records.h ├── lib ├── BlocksRuntime │ ├── Block.h │ ├── Block_private.h │ ├── data.c │ └── runtime.c ├── CMakeLists.txt ├── asan │ ├── .clang-format │ ├── CMakeLists.txt │ ├── README.txt │ ├── asan.syms.extra │ ├── asan_activation.cc │ ├── asan_activation.h │ ├── asan_activation_flags.inc │ ├── asan_allocator.cc │ ├── asan_allocator.h │ ├── asan_blacklist.txt │ ├── asan_debugging.cc │ ├── asan_descriptions.cc │ ├── asan_descriptions.h │ ├── asan_errors.cc │ ├── asan_errors.h │ ├── asan_fake_stack.cc │ ├── asan_fake_stack.h │ ├── asan_flags.cc │ ├── asan_flags.h │ ├── asan_flags.inc │ ├── asan_fuchsia.cc │ ├── asan_globals.cc │ ├── asan_globals_win.cc │ ├── asan_init_version.h │ ├── asan_interceptors.cc │ ├── asan_interceptors.h │ ├── asan_interceptors_memintrinsics.cc │ ├── asan_interceptors_memintrinsics.h │ ├── asan_interface.inc │ ├── asan_interface_internal.h │ ├── asan_internal.h │ ├── asan_linux.cc │ ├── asan_lock.h │ ├── asan_mac.cc │ ├── asan_malloc_linux.cc │ ├── asan_malloc_local.h │ ├── asan_malloc_mac.cc │ ├── asan_malloc_win.cc │ ├── asan_mapping.h │ ├── asan_mapping_myriad.h │ ├── asan_memory_profile.cc │ ├── asan_new_delete.cc │ ├── asan_poisoning.cc │ ├── asan_poisoning.h │ ├── asan_posix.cc │ ├── asan_preinit.cc │ ├── asan_premap_shadow.cc │ ├── asan_premap_shadow.h │ ├── asan_report.cc │ ├── asan_report.h │ ├── asan_rtems.cc │ ├── asan_rtl.cc │ ├── asan_scariness_score.h │ ├── asan_shadow_setup.cc │ ├── asan_stack.cc │ ├── asan_stack.h │ ├── asan_stats.cc │ ├── asan_stats.h │ ├── asan_suppressions.cc │ ├── asan_suppressions.h │ ├── asan_thread.cc │ ├── asan_thread.h │ ├── asan_win.cc │ ├── asan_win_dll_thunk.cc │ ├── asan_win_dynamic_runtime_thunk.cc │ ├── asan_win_weak_interception.cc │ ├── scripts │ │ ├── CMakeLists.txt │ │ ├── asan_device_setup │ │ └── asan_symbolize.py │ ├── tests │ │ ├── CMakeLists.txt │ │ ├── asan_asm_test.cc │ │ ├── asan_benchmarks_test.cc │ │ ├── asan_exceptions_test.cc │ │ ├── asan_fake_stack_test.cc │ │ ├── asan_globals_test.cc │ │ ├── asan_interface_test.cc │ │ ├── asan_internal_interface_test.cc │ │ ├── asan_mac_test.cc │ │ ├── asan_mac_test.h │ │ ├── asan_mac_test_helpers.mm │ │ ├── asan_mem_test.cc │ │ ├── asan_noinst_test.cc │ │ ├── asan_oob_test.cc │ │ ├── asan_racy_double_free_test.cc │ │ ├── asan_str_test.cc │ │ ├── asan_test.cc │ │ ├── asan_test.ignore │ │ ├── asan_test_config.h │ │ ├── asan_test_main.cc │ │ └── asan_test_utils.h │ └── weak_symbols.txt ├── builtins │ ├── CMakeLists.txt │ ├── Darwin-excludes │ │ ├── CMakeLists.txt │ │ ├── README.TXT │ │ ├── ios-armv7.txt │ │ ├── ios-armv7s.txt │ │ ├── ios.txt │ │ ├── ios6-armv7.txt │ │ ├── ios6-armv7s.txt │ │ ├── ios7-arm64.txt │ │ ├── iossim-i386.txt │ │ ├── iossim-x86_64.txt │ │ ├── iossim.txt │ │ ├── osx-i386.txt │ │ └── osx.txt │ ├── README.txt │ ├── aarch64 │ │ └── chkstk.S │ ├── absvdi2.c │ ├── absvsi2.c │ ├── absvti2.c │ ├── adddf3.c │ ├── addsf3.c │ ├── addtf3.c │ ├── addvdi3.c │ ├── addvsi3.c │ ├── addvti3.c │ ├── apple_versioning.c │ ├── arm │ │ ├── adddf3vfp.S │ │ ├── addsf3.S │ │ ├── addsf3vfp.S │ │ ├── aeabi_cdcmp.S │ │ ├── aeabi_cdcmpeq_check_nan.c │ │ ├── aeabi_cfcmp.S │ │ ├── aeabi_cfcmpeq_check_nan.c │ │ ├── aeabi_dcmp.S │ │ ├── aeabi_div0.c │ │ ├── aeabi_drsub.c │ │ ├── aeabi_fcmp.S │ │ ├── aeabi_frsub.c │ │ ├── aeabi_idivmod.S │ │ ├── aeabi_ldivmod.S │ │ ├── aeabi_memcmp.S │ │ ├── aeabi_memcpy.S │ │ ├── aeabi_memmove.S │ │ ├── aeabi_memset.S │ │ ├── aeabi_uidivmod.S │ │ ├── aeabi_uldivmod.S │ │ ├── bswapdi2.S │ │ ├── bswapsi2.S │ │ ├── chkstk.S │ │ ├── clzdi2.S │ │ ├── clzsi2.S │ │ ├── comparesf2.S │ │ ├── divdf3vfp.S │ │ ├── divmodsi4.S │ │ ├── divsf3vfp.S │ │ ├── divsi3.S │ │ ├── eqdf2vfp.S │ │ ├── eqsf2vfp.S │ │ ├── extendsfdf2vfp.S │ │ ├── fixdfsivfp.S │ │ ├── fixsfsivfp.S │ │ ├── fixunsdfsivfp.S │ │ ├── fixunssfsivfp.S │ │ ├── floatsidfvfp.S │ │ ├── floatsisfvfp.S │ │ ├── floatunssidfvfp.S │ │ ├── floatunssisfvfp.S │ │ ├── gedf2vfp.S │ │ ├── gesf2vfp.S │ │ ├── gtdf2vfp.S │ │ ├── gtsf2vfp.S │ │ ├── ledf2vfp.S │ │ ├── lesf2vfp.S │ │ ├── ltdf2vfp.S │ │ ├── ltsf2vfp.S │ │ ├── modsi3.S │ │ ├── muldf3vfp.S │ │ ├── mulsf3vfp.S │ │ ├── nedf2vfp.S │ │ ├── negdf2vfp.S │ │ ├── negsf2vfp.S │ │ ├── nesf2vfp.S │ │ ├── restore_vfp_d8_d15_regs.S │ │ ├── save_vfp_d8_d15_regs.S │ │ ├── softfloat-alias.list │ │ ├── subdf3vfp.S │ │ ├── subsf3vfp.S │ │ ├── switch16.S │ │ ├── switch32.S │ │ ├── switch8.S │ │ ├── switchu8.S │ │ ├── sync-ops.h │ │ ├── sync_fetch_and_add_4.S │ │ ├── sync_fetch_and_add_8.S │ │ ├── sync_fetch_and_and_4.S │ │ ├── sync_fetch_and_and_8.S │ │ ├── sync_fetch_and_max_4.S │ │ ├── sync_fetch_and_max_8.S │ │ ├── sync_fetch_and_min_4.S │ │ ├── sync_fetch_and_min_8.S │ │ ├── sync_fetch_and_nand_4.S │ │ ├── sync_fetch_and_nand_8.S │ │ ├── sync_fetch_and_or_4.S │ │ ├── sync_fetch_and_or_8.S │ │ ├── sync_fetch_and_sub_4.S │ │ ├── sync_fetch_and_sub_8.S │ │ ├── sync_fetch_and_umax_4.S │ │ ├── sync_fetch_and_umax_8.S │ │ ├── sync_fetch_and_umin_4.S │ │ ├── sync_fetch_and_umin_8.S │ │ ├── sync_fetch_and_xor_4.S │ │ ├── sync_fetch_and_xor_8.S │ │ ├── sync_synchronize.S │ │ ├── truncdfsf2vfp.S │ │ ├── udivmodsi4.S │ │ ├── udivsi3.S │ │ ├── umodsi3.S │ │ ├── unorddf2vfp.S │ │ └── unordsf2vfp.S │ ├── ashldi3.c │ ├── ashlti3.c │ ├── ashrdi3.c │ ├── ashrti3.c │ ├── assembly.h │ ├── atomic.c │ ├── atomic_flag_clear.c │ ├── atomic_flag_clear_explicit.c │ ├── atomic_flag_test_and_set.c │ ├── atomic_flag_test_and_set_explicit.c │ ├── atomic_signal_fence.c │ ├── atomic_thread_fence.c │ ├── bswapdi2.c │ ├── bswapsi2.c │ ├── clear_cache.c │ ├── clzdi2.c │ ├── clzsi2.c │ ├── clzti2.c │ ├── cmpdi2.c │ ├── cmpti2.c │ ├── comparedf2.c │ ├── comparesf2.c │ ├── comparetf2.c │ ├── cpu_model.c │ ├── ctzdi2.c │ ├── ctzsi2.c │ ├── ctzti2.c │ ├── divdc3.c │ ├── divdf3.c │ ├── divdi3.c │ ├── divmoddi4.c │ ├── divmodsi4.c │ ├── divsc3.c │ ├── divsf3.c │ ├── divsi3.c │ ├── divtc3.c │ ├── divtf3.c │ ├── divti3.c │ ├── divxc3.c │ ├── emutls.c │ ├── enable_execute_stack.c │ ├── eprintf.c │ ├── extenddftf2.c │ ├── extendhfsf2.c │ ├── extendsfdf2.c │ ├── extendsftf2.c │ ├── ffsdi2.c │ ├── ffssi2.c │ ├── ffsti2.c │ ├── fixdfdi.c │ ├── fixdfsi.c │ ├── fixdfti.c │ ├── fixsfdi.c │ ├── fixsfsi.c │ ├── fixsfti.c │ ├── fixtfdi.c │ ├── fixtfsi.c │ ├── fixtfti.c │ ├── fixunsdfdi.c │ ├── fixunsdfsi.c │ ├── fixunsdfti.c │ ├── fixunssfdi.c │ ├── fixunssfsi.c │ ├── fixunssfti.c │ ├── fixunstfdi.c │ ├── fixunstfsi.c │ ├── fixunstfti.c │ ├── fixunsxfdi.c │ ├── fixunsxfsi.c │ ├── fixunsxfti.c │ ├── fixxfdi.c │ ├── fixxfti.c │ ├── floatdidf.c │ ├── floatdisf.c │ ├── floatditf.c │ ├── floatdixf.c │ ├── floatsidf.c │ ├── floatsisf.c │ ├── floatsitf.c │ ├── floattidf.c │ ├── floattisf.c │ ├── floattitf.c │ ├── floattixf.c │ ├── floatundidf.c │ ├── floatundisf.c │ ├── floatunditf.c │ ├── floatundixf.c │ ├── floatunsidf.c │ ├── floatunsisf.c │ ├── floatunsitf.c │ ├── floatuntidf.c │ ├── floatuntisf.c │ ├── floatuntitf.c │ ├── floatuntixf.c │ ├── fp_add_impl.inc │ ├── fp_extend.h │ ├── fp_extend_impl.inc │ ├── fp_fixint_impl.inc │ ├── fp_fixuint_impl.inc │ ├── fp_lib.h │ ├── fp_mul_impl.inc │ ├── fp_trunc.h │ ├── fp_trunc_impl.inc │ ├── gcc_personality_v0.c │ ├── hexagon │ │ ├── common_entry_exit_abi1.S │ │ ├── common_entry_exit_abi2.S │ │ ├── common_entry_exit_legacy.S │ │ ├── dfaddsub.S │ │ ├── dfdiv.S │ │ ├── dffma.S │ │ ├── dfminmax.S │ │ ├── dfmul.S │ │ ├── dfsqrt.S │ │ ├── divdi3.S │ │ ├── divsi3.S │ │ ├── fabs_opt.S │ │ ├── fastmath2_dlib_asm.S │ │ ├── fastmath2_ldlib_asm.S │ │ ├── fastmath_dlib_asm.S │ │ ├── fma_opt.S │ │ ├── fmax_opt.S │ │ ├── fmin_opt.S │ │ ├── memcpy_forward_vp4cp4n2.S │ │ ├── memcpy_likely_aligned.S │ │ ├── moddi3.S │ │ ├── modsi3.S │ │ ├── sfdiv_opt.S │ │ ├── sfsqrt_opt.S │ │ ├── udivdi3.S │ │ ├── udivmoddi4.S │ │ ├── udivmodsi4.S │ │ ├── udivsi3.S │ │ ├── umoddi3.S │ │ └── umodsi3.S │ ├── i386 │ │ ├── ashldi3.S │ │ ├── ashrdi3.S │ │ ├── chkstk.S │ │ ├── chkstk2.S │ │ ├── divdi3.S │ │ ├── floatdidf.S │ │ ├── floatdisf.S │ │ ├── floatdixf.S │ │ ├── floatundidf.S │ │ ├── floatundisf.S │ │ ├── floatundixf.S │ │ ├── lshrdi3.S │ │ ├── moddi3.S │ │ ├── muldi3.S │ │ ├── udivdi3.S │ │ └── umoddi3.S │ ├── int_endianness.h │ ├── int_lib.h │ ├── int_math.h │ ├── int_types.h │ ├── int_util.c │ ├── int_util.h │ ├── lshrdi3.c │ ├── lshrti3.c │ ├── macho_embedded │ │ ├── CMakeLists.txt │ │ ├── arm.txt │ │ ├── common.txt │ │ ├── i386.txt │ │ ├── thumb2-64.txt │ │ └── thumb2.txt │ ├── mingw_fixfloat.c │ ├── moddi3.c │ ├── modsi3.c │ ├── modti3.c │ ├── muldc3.c │ ├── muldf3.c │ ├── muldi3.c │ ├── mulodi4.c │ ├── mulosi4.c │ ├── muloti4.c │ ├── mulsc3.c │ ├── mulsf3.c │ ├── multc3.c │ ├── multf3.c │ ├── multi3.c │ ├── mulvdi3.c │ ├── mulvsi3.c │ ├── mulvti3.c │ ├── mulxc3.c │ ├── negdf2.c │ ├── negdi2.c │ ├── negsf2.c │ ├── negti2.c │ ├── negvdi2.c │ ├── negvsi2.c │ ├── negvti2.c │ ├── os_version_check.c │ ├── paritydi2.c │ ├── paritysi2.c │ ├── parityti2.c │ ├── popcountdi2.c │ ├── popcountsi2.c │ ├── popcountti2.c │ ├── powidf2.c │ ├── powisf2.c │ ├── powitf2.c │ ├── powixf2.c │ ├── ppc │ │ ├── DD.h │ │ ├── divtc3.c │ │ ├── fixtfdi.c │ │ ├── fixunstfdi.c │ │ ├── floatditf.c │ │ ├── floatunditf.c │ │ ├── gcc_qadd.c │ │ ├── gcc_qdiv.c │ │ ├── gcc_qmul.c │ │ ├── gcc_qsub.c │ │ ├── multc3.c │ │ ├── restFP.S │ │ └── saveFP.S │ ├── riscv │ │ └── mulsi3.S │ ├── subdf3.c │ ├── subsf3.c │ ├── subtf3.c │ ├── subvdi3.c │ ├── subvsi3.c │ ├── subvti3.c │ ├── trampoline_setup.c │ ├── truncdfhf2.c │ ├── truncdfsf2.c │ ├── truncsfhf2.c │ ├── trunctfdf2.c │ ├── trunctfsf2.c │ ├── ucmpdi2.c │ ├── ucmpti2.c │ ├── udivdi3.c │ ├── udivmoddi4.c │ ├── udivmodsi4.c │ ├── udivmodti4.c │ ├── udivsi3.c │ ├── udivti3.c │ ├── umoddi3.c │ ├── umodsi3.c │ ├── umodti3.c │ ├── unwind-ehabi-helpers.h │ └── x86_64 │ │ ├── chkstk.S │ │ ├── chkstk2.S │ │ ├── floatdidf.c │ │ ├── floatdisf.c │ │ ├── floatdixf.c │ │ ├── floatundidf.S │ │ ├── floatundisf.S │ │ └── floatundixf.S ├── cfi │ ├── CMakeLists.txt │ ├── cfi.cc │ └── cfi_blacklist.txt ├── dfsan │ ├── .clang-format │ ├── CMakeLists.txt │ ├── dfsan.cc │ ├── dfsan.h │ ├── dfsan.syms.extra │ ├── dfsan_custom.cc │ ├── dfsan_flags.inc │ ├── dfsan_interceptors.cc │ ├── dfsan_platform.h │ ├── done_abilist.txt │ ├── libc_ubuntu1404_abilist.txt │ └── scripts │ │ ├── build-libc-list.py │ │ └── check_custom_wrappers.sh ├── esan │ ├── CMakeLists.txt │ ├── cache_frag.cpp │ ├── cache_frag.h │ ├── esan.cpp │ ├── esan.h │ ├── esan.syms.extra │ ├── esan_circular_buffer.h │ ├── esan_flags.cpp │ ├── esan_flags.h │ ├── esan_flags.inc │ ├── esan_hashtable.h │ ├── esan_interceptors.cpp │ ├── esan_interface.cpp │ ├── esan_interface_internal.h │ ├── esan_linux.cpp │ ├── esan_shadow.h │ ├── esan_sideline.h │ ├── esan_sideline_bsd.cpp │ ├── esan_sideline_linux.cpp │ ├── working_set.cpp │ ├── working_set.h │ └── working_set_posix.cpp ├── fuzzer │ ├── CMakeLists.txt │ ├── FuzzerCommand.h │ ├── FuzzerCorpus.h │ ├── FuzzerCrossOver.cpp │ ├── FuzzerDataFlowTrace.cpp │ ├── FuzzerDataFlowTrace.h │ ├── FuzzerDefs.h │ ├── FuzzerDictionary.h │ ├── FuzzerDriver.cpp │ ├── FuzzerExtFunctions.def │ ├── FuzzerExtFunctions.h │ ├── FuzzerExtFunctionsDlsym.cpp │ ├── FuzzerExtFunctionsWeak.cpp │ ├── FuzzerExtFunctionsWeakAlias.cpp │ ├── FuzzerExtraCounters.cpp │ ├── FuzzerFlags.def │ ├── FuzzerIO.cpp │ ├── FuzzerIO.h │ ├── FuzzerIOPosix.cpp │ ├── FuzzerIOWindows.cpp │ ├── FuzzerInterface.h │ ├── FuzzerInternal.h │ ├── FuzzerLoop.cpp │ ├── FuzzerMain.cpp │ ├── FuzzerMerge.cpp │ ├── FuzzerMerge.h │ ├── FuzzerMutate.cpp │ ├── FuzzerMutate.h │ ├── FuzzerOptions.h │ ├── FuzzerRandom.h │ ├── FuzzerSHA1.cpp │ ├── FuzzerSHA1.h │ ├── FuzzerShmem.h │ ├── FuzzerShmemFuchsia.cpp │ ├── FuzzerShmemPosix.cpp │ ├── FuzzerShmemWindows.cpp │ ├── FuzzerTracePC.cpp │ ├── FuzzerTracePC.h │ ├── FuzzerUtil.cpp │ ├── FuzzerUtil.h │ ├── FuzzerUtilDarwin.cpp │ ├── FuzzerUtilFuchsia.cpp │ ├── FuzzerUtilLinux.cpp │ ├── FuzzerUtilPosix.cpp │ ├── FuzzerUtilWindows.cpp │ ├── FuzzerValueBitMap.h │ ├── README.txt │ ├── afl │ │ └── afl_driver.cpp │ ├── build.sh │ ├── dataflow │ │ └── DataFlow.cpp │ ├── scripts │ │ ├── collect_data_flow.py │ │ ├── merge_data_flow.py │ │ └── unbalanced_allocs.py │ ├── standalone │ │ └── StandaloneFuzzTargetMain.c │ └── tests │ │ ├── CMakeLists.txt │ │ └── FuzzerUnittest.cpp ├── hwasan │ ├── .clang-format │ ├── CMakeLists.txt │ ├── hwasan.cc │ ├── hwasan.h │ ├── hwasan.syms.extra │ ├── hwasan_allocator.cc │ ├── hwasan_allocator.h │ ├── hwasan_blacklist.txt │ ├── hwasan_dynamic_shadow.cc │ ├── hwasan_dynamic_shadow.h │ ├── hwasan_flags.h │ ├── hwasan_flags.inc │ ├── hwasan_interceptors.cc │ ├── hwasan_interface_internal.h │ ├── hwasan_linux.cc │ ├── hwasan_mapping.h │ ├── hwasan_new_delete.cc │ ├── hwasan_poisoning.cc │ ├── hwasan_poisoning.h │ ├── hwasan_report.cc │ ├── hwasan_report.h │ ├── hwasan_thread.cc │ ├── hwasan_thread.h │ ├── hwasan_thread_list.cc │ └── hwasan_thread_list.h ├── interception │ ├── .clang-format │ ├── CMakeLists.txt │ ├── interception.h │ ├── interception_linux.cc │ ├── interception_linux.h │ ├── interception_mac.cc │ ├── interception_mac.h │ ├── interception_type_test.cc │ ├── interception_win.cc │ ├── interception_win.h │ └── tests │ │ ├── CMakeLists.txt │ │ ├── interception_linux_test.cc │ │ ├── interception_test_main.cc │ │ └── interception_win_test.cc ├── lsan │ ├── .clang-format │ ├── CMakeLists.txt │ ├── lsan.cc │ ├── lsan.h │ ├── lsan_allocator.cc │ ├── lsan_allocator.h │ ├── lsan_common.cc │ ├── lsan_common.h │ ├── lsan_common_linux.cc │ ├── lsan_common_mac.cc │ ├── lsan_flags.inc │ ├── lsan_interceptors.cc │ ├── lsan_linux.cc │ ├── lsan_mac.cc │ ├── lsan_malloc_mac.cc │ ├── lsan_preinit.cc │ ├── lsan_thread.cc │ ├── lsan_thread.h │ └── weak_symbols.txt ├── msan │ ├── .clang-format │ ├── CMakeLists.txt │ ├── msan.cc │ ├── msan.h │ ├── msan.syms.extra │ ├── msan_allocator.cc │ ├── msan_allocator.h │ ├── msan_blacklist.txt │ ├── msan_chained_origin_depot.cc │ ├── msan_chained_origin_depot.h │ ├── msan_flags.h │ ├── msan_flags.inc │ ├── msan_interceptors.cc │ ├── msan_interface_internal.h │ ├── msan_linux.cc │ ├── msan_new_delete.cc │ ├── msan_origin.h │ ├── msan_poisoning.cc │ ├── msan_poisoning.h │ ├── msan_report.cc │ ├── msan_report.h │ ├── msan_thread.cc │ ├── msan_thread.h │ └── tests │ │ ├── CMakeLists.txt │ │ ├── msan_loadable.cc │ │ ├── msan_test.cc │ │ ├── msan_test_config.h │ │ └── msan_test_main.cc ├── profile │ ├── CMakeLists.txt │ ├── GCDAProfiling.c │ ├── InstrProfData.inc │ ├── InstrProfiling.c │ ├── InstrProfiling.h │ ├── InstrProfilingBuffer.c │ ├── InstrProfilingFile.c │ ├── InstrProfilingInternal.h │ ├── InstrProfilingMerge.c │ ├── InstrProfilingMergeFile.c │ ├── InstrProfilingNameVar.c │ ├── InstrProfilingPlatformDarwin.c │ ├── InstrProfilingPlatformFuchsia.c │ ├── InstrProfilingPlatformLinux.c │ ├── InstrProfilingPlatformOther.c │ ├── InstrProfilingPort.h │ ├── InstrProfilingRuntime.cc │ ├── InstrProfilingUtil.c │ ├── InstrProfilingUtil.h │ ├── InstrProfilingValue.c │ ├── InstrProfilingWriter.c │ ├── WindowsMMap.c │ └── WindowsMMap.h ├── safestack │ ├── .clang-format │ ├── CMakeLists.txt │ └── safestack.cc ├── sanitizer_common │ ├── .clang-format │ ├── .clang-tidy │ ├── CMakeLists.txt │ ├── sancov_begin.S │ ├── sancov_end.S │ ├── sancov_flags.cc │ ├── sancov_flags.h │ ├── sancov_flags.inc │ ├── sanitizer_addrhashmap.h │ ├── sanitizer_allocator.cc │ ├── sanitizer_allocator.h │ ├── sanitizer_allocator_bytemap.h │ ├── sanitizer_allocator_checks.cc │ ├── sanitizer_allocator_checks.h │ ├── sanitizer_allocator_combined.h │ ├── sanitizer_allocator_interface.h │ ├── sanitizer_allocator_internal.h │ ├── sanitizer_allocator_local_cache.h │ ├── sanitizer_allocator_primary32.h │ ├── sanitizer_allocator_primary64.h │ ├── sanitizer_allocator_report.cc │ ├── sanitizer_allocator_report.h │ ├── sanitizer_allocator_secondary.h │ ├── sanitizer_allocator_size_class_map.h │ ├── sanitizer_allocator_stats.h │ ├── sanitizer_asm.h │ ├── sanitizer_atomic.h │ ├── sanitizer_atomic_clang.h │ ├── sanitizer_atomic_clang_mips.h │ ├── sanitizer_atomic_clang_other.h │ ├── sanitizer_atomic_clang_x86.h │ ├── sanitizer_atomic_msvc.h │ ├── sanitizer_bitvector.h │ ├── sanitizer_bvgraph.h │ ├── sanitizer_common.cc │ ├── sanitizer_common.h │ ├── sanitizer_common_interceptors.inc │ ├── sanitizer_common_interceptors_format.inc │ ├── sanitizer_common_interceptors_ioctl.inc │ ├── sanitizer_common_interface.inc │ ├── sanitizer_common_interface_posix.inc │ ├── sanitizer_common_libcdep.cc │ ├── sanitizer_common_nolibc.cc │ ├── sanitizer_common_syscalls.inc │ ├── sanitizer_coverage_fuchsia.cc │ ├── sanitizer_coverage_interface.inc │ ├── sanitizer_coverage_libcdep_new.cc │ ├── sanitizer_coverage_win_dll_thunk.cc │ ├── sanitizer_coverage_win_dynamic_runtime_thunk.cc │ ├── sanitizer_coverage_win_sections.cc │ ├── sanitizer_coverage_win_weak_interception.cc │ ├── sanitizer_dbghelp.h │ ├── sanitizer_deadlock_detector.h │ ├── sanitizer_deadlock_detector1.cc │ ├── sanitizer_deadlock_detector2.cc │ ├── sanitizer_deadlock_detector_interface.h │ ├── sanitizer_errno.cc │ ├── sanitizer_errno.h │ ├── sanitizer_errno_codes.h │ ├── sanitizer_file.cc │ ├── sanitizer_file.h │ ├── sanitizer_flag_parser.cc │ ├── sanitizer_flag_parser.h │ ├── sanitizer_flags.cc │ ├── sanitizer_flags.h │ ├── sanitizer_flags.inc │ ├── sanitizer_freebsd.h │ ├── sanitizer_fuchsia.cc │ ├── sanitizer_fuchsia.h │ ├── sanitizer_getauxval.h │ ├── sanitizer_interceptors_ioctl_netbsd.inc │ ├── sanitizer_interface_internal.h │ ├── sanitizer_internal_defs.h │ ├── sanitizer_lfstack.h │ ├── sanitizer_libc.cc │ ├── sanitizer_libc.h │ ├── sanitizer_libignore.cc │ ├── sanitizer_libignore.h │ ├── sanitizer_linux.cc │ ├── sanitizer_linux.h │ ├── sanitizer_linux_libcdep.cc │ ├── sanitizer_linux_mips64.S │ ├── sanitizer_linux_s390.cc │ ├── sanitizer_linux_x86_64.S │ ├── sanitizer_list.h │ ├── sanitizer_local_address_space_view.h │ ├── sanitizer_mac.cc │ ├── sanitizer_mac.h │ ├── sanitizer_mac_libcdep.cc │ ├── sanitizer_malloc_mac.inc │ ├── sanitizer_mutex.h │ ├── sanitizer_netbsd.cc │ ├── sanitizer_openbsd.cc │ ├── sanitizer_persistent_allocator.cc │ ├── sanitizer_persistent_allocator.h │ ├── sanitizer_placement_new.h │ ├── sanitizer_platform.h │ ├── sanitizer_platform_interceptors.h │ ├── sanitizer_platform_limits_linux.cc │ ├── sanitizer_platform_limits_netbsd.cc │ ├── sanitizer_platform_limits_netbsd.h │ ├── sanitizer_platform_limits_openbsd.cc │ ├── sanitizer_platform_limits_openbsd.h │ ├── sanitizer_platform_limits_posix.cc │ ├── sanitizer_platform_limits_posix.h │ ├── sanitizer_platform_limits_solaris.cc │ ├── sanitizer_platform_limits_solaris.h │ ├── sanitizer_posix.cc │ ├── sanitizer_posix.h │ ├── sanitizer_posix_libcdep.cc │ ├── sanitizer_printf.cc │ ├── sanitizer_procmaps.h │ ├── sanitizer_procmaps_bsd.cc │ ├── sanitizer_procmaps_common.cc │ ├── sanitizer_procmaps_linux.cc │ ├── sanitizer_procmaps_mac.cc │ ├── sanitizer_procmaps_solaris.cc │ ├── sanitizer_quarantine.h │ ├── sanitizer_report_decorator.h │ ├── sanitizer_ring_buffer.h │ ├── sanitizer_rtems.cc │ ├── sanitizer_rtems.h │ ├── sanitizer_signal_interceptors.inc │ ├── sanitizer_solaris.cc │ ├── sanitizer_stackdepot.cc │ ├── sanitizer_stackdepot.h │ ├── sanitizer_stackdepotbase.h │ ├── sanitizer_stacktrace.cc │ ├── sanitizer_stacktrace.h │ ├── sanitizer_stacktrace_libcdep.cc │ ├── sanitizer_stacktrace_printer.cc │ ├── sanitizer_stacktrace_printer.h │ ├── sanitizer_stacktrace_sparc.cc │ ├── sanitizer_stoptheworld.h │ ├── sanitizer_stoptheworld_linux_libcdep.cc │ ├── sanitizer_stoptheworld_mac.cc │ ├── sanitizer_suppressions.cc │ ├── sanitizer_suppressions.h │ ├── sanitizer_symbolizer.cc │ ├── sanitizer_symbolizer.h │ ├── sanitizer_symbolizer_fuchsia.h │ ├── sanitizer_symbolizer_internal.h │ ├── sanitizer_symbolizer_libbacktrace.cc │ ├── sanitizer_symbolizer_libbacktrace.h │ ├── sanitizer_symbolizer_libcdep.cc │ ├── sanitizer_symbolizer_mac.cc │ ├── sanitizer_symbolizer_mac.h │ ├── sanitizer_symbolizer_markup.cc │ ├── sanitizer_symbolizer_posix_libcdep.cc │ ├── sanitizer_symbolizer_report.cc │ ├── sanitizer_symbolizer_rtems.h │ ├── sanitizer_symbolizer_win.cc │ ├── sanitizer_syscall_generic.inc │ ├── sanitizer_syscall_linux_aarch64.inc │ ├── sanitizer_syscall_linux_arm.inc │ ├── sanitizer_syscall_linux_x86_64.inc │ ├── sanitizer_syscalls_netbsd.inc │ ├── sanitizer_termination.cc │ ├── sanitizer_thread_registry.cc │ ├── sanitizer_thread_registry.h │ ├── sanitizer_tls_get_addr.cc │ ├── sanitizer_tls_get_addr.h │ ├── sanitizer_unwind_linux_libcdep.cc │ ├── sanitizer_unwind_win.cc │ ├── sanitizer_vector.h │ ├── sanitizer_win.cc │ ├── sanitizer_win.h │ ├── sanitizer_win_defs.h │ ├── sanitizer_win_dll_thunk.cc │ ├── sanitizer_win_dll_thunk.h │ ├── sanitizer_win_dynamic_runtime_thunk.cc │ ├── sanitizer_win_weak_interception.cc │ ├── sanitizer_win_weak_interception.h │ ├── scripts │ │ ├── check_lint.sh │ │ ├── cpplint.py │ │ ├── gen_dynamic_list.py │ │ ├── litlint.py │ │ ├── litlint_test.py │ │ └── sancov.py │ ├── symbolizer │ │ ├── sanitizer_symbolize.cc │ │ ├── sanitizer_wrappers.cc │ │ └── scripts │ │ │ ├── ar_to_bc.sh │ │ │ ├── build_symbolizer.sh │ │ │ └── global_symbols.txt │ ├── tests │ │ ├── CMakeLists.txt │ │ ├── malloc_stress_transfer_test.cc │ │ ├── sanitizer_allocator_test.cc │ │ ├── sanitizer_allocator_testlib.cc │ │ ├── sanitizer_atomic_test.cc │ │ ├── sanitizer_bitvector_test.cc │ │ ├── sanitizer_bvgraph_test.cc │ │ ├── sanitizer_common_test.cc │ │ ├── sanitizer_deadlock_detector_test.cc │ │ ├── sanitizer_flags_test.cc │ │ ├── sanitizer_format_interceptor_test.cc │ │ ├── sanitizer_ioctl_test.cc │ │ ├── sanitizer_libc_test.cc │ │ ├── sanitizer_linux_test.cc │ │ ├── sanitizer_list_test.cc │ │ ├── sanitizer_mutex_test.cc │ │ ├── sanitizer_nolibc_test.cc │ │ ├── sanitizer_nolibc_test_main.cc │ │ ├── sanitizer_posix_test.cc │ │ ├── sanitizer_printf_test.cc │ │ ├── sanitizer_procmaps_test.cc │ │ ├── sanitizer_pthread_wrappers.h │ │ ├── sanitizer_quarantine_test.cc │ │ ├── sanitizer_ring_buffer_test.cc │ │ ├── sanitizer_stackdepot_test.cc │ │ ├── sanitizer_stacktrace_printer_test.cc │ │ ├── sanitizer_stacktrace_test.cc │ │ ├── sanitizer_stoptheworld_test.cc │ │ ├── sanitizer_stoptheworld_testlib.cc │ │ ├── sanitizer_suppressions_test.cc │ │ ├── sanitizer_symbolizer_test.cc │ │ ├── sanitizer_test_config.h │ │ ├── sanitizer_test_main.cc │ │ ├── sanitizer_test_utils.h │ │ ├── sanitizer_thread_registry_test.cc │ │ ├── sanitizer_vector_test.cc │ │ └── standalone_malloc_test.cc │ └── weak_symbols.txt ├── scudo │ ├── CMakeLists.txt │ ├── scudo_allocator.cpp │ ├── scudo_allocator.h │ ├── scudo_allocator_combined.h │ ├── scudo_allocator_secondary.h │ ├── scudo_crc32.cpp │ ├── scudo_crc32.h │ ├── scudo_errors.cpp │ ├── scudo_errors.h │ ├── scudo_flags.cpp │ ├── scudo_flags.h │ ├── scudo_flags.inc │ ├── scudo_interface_internal.h │ ├── scudo_malloc.cpp │ ├── scudo_new_delete.cpp │ ├── scudo_platform.h │ ├── scudo_termination.cpp │ ├── scudo_tsd.h │ ├── scudo_tsd_exclusive.cpp │ ├── scudo_tsd_exclusive.inc │ ├── scudo_tsd_shared.cpp │ ├── scudo_tsd_shared.inc │ ├── scudo_utils.cpp │ └── scudo_utils.h ├── stats │ ├── CMakeLists.txt │ ├── stats.cc │ ├── stats.h │ └── stats_client.cc ├── tsan │ ├── .clang-format │ ├── CMakeLists.txt │ ├── analyze_libtsan.sh │ ├── benchmarks │ │ ├── mini_bench_local.cc │ │ ├── mini_bench_shared.cc │ │ ├── start_many_threads.cc │ │ └── vts_many_threads_bench.cc │ ├── check_analyze.sh │ ├── check_cmake.sh │ ├── dd │ │ ├── CMakeLists.txt │ │ ├── dd_interceptors.cc │ │ ├── dd_rtl.cc │ │ └── dd_rtl.h │ ├── go │ │ ├── build.bat │ │ ├── buildgo.sh │ │ ├── test.c │ │ └── tsan_go.cc │ ├── rtl │ │ ├── tsan.syms.extra │ │ ├── tsan_clock.cc │ │ ├── tsan_clock.h │ │ ├── tsan_debugging.cc │ │ ├── tsan_defs.h │ │ ├── tsan_dense_alloc.h │ │ ├── tsan_external.cc │ │ ├── tsan_fd.cc │ │ ├── tsan_fd.h │ │ ├── tsan_flags.cc │ │ ├── tsan_flags.h │ │ ├── tsan_flags.inc │ │ ├── tsan_ignoreset.cc │ │ ├── tsan_ignoreset.h │ │ ├── tsan_interceptors.cc │ │ ├── tsan_interceptors.h │ │ ├── tsan_interceptors_mac.cc │ │ ├── tsan_interface.cc │ │ ├── tsan_interface.h │ │ ├── tsan_interface_ann.cc │ │ ├── tsan_interface_ann.h │ │ ├── tsan_interface_atomic.cc │ │ ├── tsan_interface_inl.h │ │ ├── tsan_interface_java.cc │ │ ├── tsan_interface_java.h │ │ ├── tsan_libdispatch_mac.cc │ │ ├── tsan_malloc_mac.cc │ │ ├── tsan_md5.cc │ │ ├── tsan_mman.cc │ │ ├── tsan_mman.h │ │ ├── tsan_mutex.cc │ │ ├── tsan_mutex.h │ │ ├── tsan_mutexset.cc │ │ ├── tsan_mutexset.h │ │ ├── tsan_new_delete.cc │ │ ├── tsan_platform.h │ │ ├── tsan_platform_linux.cc │ │ ├── tsan_platform_mac.cc │ │ ├── tsan_platform_posix.cc │ │ ├── tsan_platform_windows.cc │ │ ├── tsan_ppc_regs.h │ │ ├── tsan_preinit.cc │ │ ├── tsan_report.cc │ │ ├── tsan_report.h │ │ ├── tsan_rtl.cc │ │ ├── tsan_rtl.h │ │ ├── tsan_rtl_aarch64.S │ │ ├── tsan_rtl_amd64.S │ │ ├── tsan_rtl_mips64.S │ │ ├── tsan_rtl_mutex.cc │ │ ├── tsan_rtl_ppc64.S │ │ ├── tsan_rtl_proc.cc │ │ ├── tsan_rtl_report.cc │ │ ├── tsan_rtl_thread.cc │ │ ├── tsan_stack_trace.cc │ │ ├── tsan_stack_trace.h │ │ ├── tsan_stat.cc │ │ ├── tsan_stat.h │ │ ├── tsan_suppressions.cc │ │ ├── tsan_suppressions.h │ │ ├── tsan_symbolize.cc │ │ ├── tsan_symbolize.h │ │ ├── tsan_sync.cc │ │ ├── tsan_sync.h │ │ ├── tsan_trace.h │ │ └── tsan_update_shadow_word_inl.h │ └── tests │ │ ├── CMakeLists.txt │ │ ├── rtl │ │ ├── CMakeLists.txt │ │ ├── tsan_bench.cc │ │ ├── tsan_mop.cc │ │ ├── tsan_mutex.cc │ │ ├── tsan_posix.cc │ │ ├── tsan_posix_util.h │ │ ├── tsan_string.cc │ │ ├── tsan_test.cc │ │ ├── tsan_test_util.h │ │ ├── tsan_test_util_posix.cc │ │ └── tsan_thread.cc │ │ └── unit │ │ ├── CMakeLists.txt │ │ ├── tsan_clock_test.cc │ │ ├── tsan_dense_alloc_test.cc │ │ ├── tsan_flags_test.cc │ │ ├── tsan_mman_test.cc │ │ ├── tsan_mutex_test.cc │ │ ├── tsan_mutexset_test.cc │ │ ├── tsan_shadow_test.cc │ │ ├── tsan_stack_test.cc │ │ ├── tsan_sync_test.cc │ │ └── tsan_unit_test_main.cc ├── ubsan │ ├── CMakeLists.txt │ ├── ubsan.syms.extra │ ├── ubsan_checks.inc │ ├── ubsan_diag.cc │ ├── ubsan_diag.h │ ├── ubsan_diag_standalone.cc │ ├── ubsan_flags.cc │ ├── ubsan_flags.h │ ├── ubsan_flags.inc │ ├── ubsan_handlers.cc │ ├── ubsan_handlers.h │ ├── ubsan_handlers_cxx.cc │ ├── ubsan_handlers_cxx.h │ ├── ubsan_init.cc │ ├── ubsan_init.h │ ├── ubsan_init_standalone.cc │ ├── ubsan_init_standalone_preinit.cc │ ├── ubsan_interface.inc │ ├── ubsan_monitor.cc │ ├── ubsan_monitor.h │ ├── ubsan_platform.h │ ├── ubsan_signals_standalone.cc │ ├── ubsan_signals_standalone.h │ ├── ubsan_type_hash.cc │ ├── ubsan_type_hash.h │ ├── ubsan_type_hash_itanium.cc │ ├── ubsan_type_hash_win.cc │ ├── ubsan_value.cc │ ├── ubsan_value.h │ ├── ubsan_win_dll_thunk.cc │ ├── ubsan_win_dynamic_runtime_thunk.cc │ ├── ubsan_win_weak_interception.cc │ └── weak_symbols.txt ├── ubsan_minimal │ ├── CMakeLists.txt │ ├── ubsan.syms.extra │ └── ubsan_minimal_handlers.cc └── xray │ ├── CMakeLists.txt │ ├── tests │ ├── CMakeLists.txt │ └── unit │ │ ├── CMakeLists.txt │ │ ├── allocator_test.cc │ │ ├── buffer_queue_test.cc │ │ ├── fdr_controller_test.cc │ │ ├── fdr_log_writer_test.cc │ │ ├── function_call_trie_test.cc │ │ ├── profile_collector_test.cc │ │ ├── segmented_array_test.cc │ │ ├── test_helpers.cc │ │ ├── test_helpers.h │ │ └── xray_unit_test_main.cc │ ├── weak_symbols.txt │ ├── xray_AArch64.cc │ ├── xray_allocator.h │ ├── xray_always_instrument.txt │ ├── xray_arm.cc │ ├── xray_basic_flags.cc │ ├── xray_basic_flags.h │ ├── xray_basic_flags.inc │ ├── xray_basic_logging.cc │ ├── xray_basic_logging.h │ ├── xray_buffer_queue.cc │ ├── xray_buffer_queue.h │ ├── xray_defs.h │ ├── xray_fdr_controller.h │ ├── xray_fdr_flags.cc │ ├── xray_fdr_flags.h │ ├── xray_fdr_flags.inc │ ├── xray_fdr_log_records.h │ ├── xray_fdr_log_writer.h │ ├── xray_fdr_logging.cc │ ├── xray_fdr_logging.h │ ├── xray_flags.cc │ ├── xray_flags.h │ ├── xray_flags.inc │ ├── xray_function_call_trie.h │ ├── xray_init.cc │ ├── xray_interface.cc │ ├── xray_interface_internal.h │ ├── xray_log_interface.cc │ ├── xray_mips.cc │ ├── xray_mips64.cc │ ├── xray_never_instrument.txt │ ├── xray_powerpc64.cc │ ├── xray_powerpc64.inc │ ├── xray_profile_collector.cc │ ├── xray_profile_collector.h │ ├── xray_profiling.cc │ ├── xray_profiling_flags.cc │ ├── xray_profiling_flags.h │ ├── xray_profiling_flags.inc │ ├── xray_recursion_guard.h │ ├── xray_segmented_array.h │ ├── xray_trampoline_AArch64.S │ ├── xray_trampoline_arm.S │ ├── xray_trampoline_mips.S │ ├── xray_trampoline_mips64.S │ ├── xray_trampoline_powerpc64.cc │ ├── xray_trampoline_powerpc64_asm.S │ ├── xray_trampoline_x86_64.S │ ├── xray_tsc.h │ ├── xray_utils.cc │ ├── xray_utils.h │ ├── xray_x86_64.cc │ └── xray_x86_64.inc ├── test ├── BlocksRuntime │ ├── block-static.c │ ├── blockimport.c │ ├── byrefaccess.c │ ├── byrefcopy.c │ ├── byrefcopycopy.c │ ├── byrefcopyinner.c │ ├── byrefcopyint.c │ ├── byrefcopystack.c │ ├── byrefsanity.c │ ├── byrefstruct.c │ ├── c99.c │ ├── cast.c │ ├── constassign.c │ ├── copy-block-literal-rdar6439600.c │ ├── copyconstructor.C │ ├── copynull.c │ ├── dispatch_async.c │ ├── dispatch_call_Block_with_release.c │ ├── fail.c │ ├── flagsisa.c │ ├── globalexpression.c │ ├── goto.c │ ├── hasdescriptor.c │ ├── josh.C │ ├── k-and-r.c │ ├── large-struct.c │ ├── localisglobal.c │ ├── macro.c │ ├── makefile │ ├── modglobal.c │ ├── nestedimport.c │ ├── nullblockisa.c │ ├── objectRRGC.c │ ├── objectassign.c │ ├── orbars.c │ ├── rdar6396238.c │ ├── rdar6405500.c │ ├── rdar6414583.c │ ├── recursive-block.c │ ├── recursive-test.c │ ├── recursiveassign.c │ ├── reference.C │ ├── rettypepromotion.c │ ├── returnfunctionptr.c │ ├── shorthandexpression.c │ ├── sizeof.c │ ├── small-struct.c │ ├── structmember.c │ ├── testfilerunner.h │ ├── testfilerunner.m │ ├── varargs-bad-assign.c │ ├── varargs.c │ ├── variadic.c │ └── voidarg.c ├── CMakeLists.txt ├── asan │ ├── CMakeLists.txt │ ├── TestCases │ │ ├── Android │ │ │ └── lit.local.cfg │ │ ├── Darwin │ │ │ ├── abort_on_error.cc │ │ │ ├── address-range-limit.mm │ │ │ ├── asan_gen_prefixes.cc │ │ │ ├── atos-symbolizer-dyld-root-path.cc │ │ │ ├── atos-symbolizer.cc │ │ │ ├── crashlog-stacktraces.c │ │ │ ├── cstring_literals_regtest.mm │ │ │ ├── cstring_section.c │ │ │ ├── dead-strip.c │ │ │ ├── dladdr-demangling.cc │ │ │ ├── dump_registers.cc │ │ │ ├── dyld_insert_libraries_reexec.cc │ │ │ ├── dyld_insert_libraries_remove.cc │ │ │ ├── empty-section.cc │ │ │ ├── fclose.c │ │ │ ├── getpwnam.c │ │ │ ├── haswell-symbolication.cc │ │ │ ├── interface_symbols_darwin.cc │ │ │ ├── linked-only.cc │ │ │ ├── lit.local.cfg │ │ │ ├── malloc_destroy_zone.cc │ │ │ ├── malloc_set_zone_name-mprotect.cc │ │ │ ├── malloc_size_crash.mm │ │ │ ├── malloc_zone-protected.cc │ │ │ ├── mixing-global-constructors.cc │ │ │ ├── nil-return-struct.mm │ │ │ ├── objc-odr.mm │ │ │ ├── odr-lto.cc │ │ │ ├── reexec-insert-libraries-env.cc │ │ │ ├── sandbox-symbolizer.cc │ │ │ ├── scribble.cc │ │ │ ├── segv_read_write.c │ │ │ ├── suppressions-darwin.cc │ │ │ ├── suppressions-function.cc │ │ │ ├── suppressions-sandbox.cc │ │ │ ├── unset-insert-libraries-on-exec.cc │ │ │ └── uuid.cc │ │ ├── Helpers │ │ │ ├── blacklist-extra.cc │ │ │ ├── echo-env.cc │ │ │ ├── init-order-atexit-extra.cc │ │ │ ├── initialization-blacklist-extra.cc │ │ │ ├── initialization-blacklist-extra2.cc │ │ │ ├── initialization-blacklist.txt │ │ │ ├── initialization-bug-extra.cc │ │ │ ├── initialization-bug-extra2.cc │ │ │ ├── initialization-constexpr-extra.cc │ │ │ ├── initialization-nobug-extra.cc │ │ │ ├── lit.local.cfg │ │ │ └── underflow.cc │ │ ├── Linux │ │ │ ├── abort_on_error.cc │ │ │ ├── activation-options.cc │ │ │ ├── aligned_delete_test.cc │ │ │ ├── allocator_oom_test.cc │ │ │ ├── asan-asm-stacktrace-test.cc │ │ │ ├── asan_default_suppressions.cc │ │ │ ├── asan_dlopen_test.cc │ │ │ ├── asan_prelink_test.cc │ │ │ ├── asan_preload_test-1.cc │ │ │ ├── asan_preload_test-2.cc │ │ │ ├── asan_preload_test-3.cc │ │ │ ├── asan_rt_confict_test-1.cc │ │ │ ├── asan_rt_confict_test-2.cc │ │ │ ├── auto_memory_profile_test.cc │ │ │ ├── calloc-preload.c │ │ │ ├── clang_gcc_abi.cc │ │ │ ├── clone_test.cc │ │ │ ├── coverage-missing.cc │ │ │ ├── cuda_test.cc │ │ │ ├── function-sections-are-bad.cc │ │ │ ├── global-overflow-bfd.cc │ │ │ ├── global-overflow-lld.cc │ │ │ ├── globals-gc-sections-lld.cc │ │ │ ├── init-order-dlopen.cc │ │ │ ├── init_fini_sections.cc │ │ │ ├── initialization-bug-any-order.cc │ │ │ ├── interception_malloc_test.cc │ │ │ ├── interception_readdir_r_test.cc │ │ │ ├── interception_test.cc │ │ │ ├── interface_symbols_linux.cc │ │ │ ├── kernel-area.cc │ │ │ ├── leak.cc │ │ │ ├── leak_check_segv.cc │ │ │ ├── lit.local.cfg │ │ │ ├── local_alias.cc │ │ │ ├── long-object-path.cc │ │ │ ├── longjmp_chk.c │ │ │ ├── malloc-in-qsort.cc │ │ │ ├── malloc_delete_mismatch.cc │ │ │ ├── memmem_test.cc │ │ │ ├── mincore.cc │ │ │ ├── new_delete_mismatch.cc │ │ │ ├── nohugepage_test.cc │ │ │ ├── odr-violation.cc │ │ │ ├── odr_c_test.c │ │ │ ├── overflow-in-qsort.cc │ │ │ ├── preinit_test.cc │ │ │ ├── preinstalled_signal.cc │ │ │ ├── print_memory_profile_test.cc │ │ │ ├── printf-fortify-1.c │ │ │ ├── printf-fortify-2.c │ │ │ ├── printf-fortify-3.c │ │ │ ├── printf-fortify-4.c │ │ │ ├── printf-fortify-5.c │ │ │ ├── pthread_create_from_constructor.cc │ │ │ ├── pthread_create_version.cc │ │ │ ├── ptrace.cc │ │ │ ├── quarantine_size_mb.cc │ │ │ ├── read_binary_name_regtest.c │ │ │ ├── recoverable-lsan.cc │ │ │ ├── recvfrom.cc │ │ │ ├── release_to_os_test.cc │ │ │ ├── rlimit_mmap_test.cc │ │ │ ├── sanbox_read_proc_self_maps_test.cc │ │ │ ├── segv_read_write.c │ │ │ ├── shmctl.cc │ │ │ ├── signal_during_stop_the_world.cc │ │ │ ├── sized_delete_test.cc │ │ │ ├── stack-overflow-recovery-mode.cc │ │ │ ├── stack-overflow-sigbus.cc │ │ │ ├── stack-trace-dlclose.cc │ │ │ ├── static_tls.cc │ │ │ ├── stress_dtls.c │ │ │ ├── swapcontext_annotation.cc │ │ │ ├── swapcontext_test.cc │ │ │ ├── syscalls.cc │ │ │ ├── textdomain.c │ │ │ ├── thread_local_quarantine_pthread_join.cc │ │ │ ├── thread_local_quarantine_size_kb.cc │ │ │ ├── uar_signals.cc │ │ │ └── unpoison_tls.cc │ │ ├── Posix │ │ │ ├── asan-sigbus.cpp │ │ │ ├── asan-symbolize-bad-path.cc │ │ │ ├── asan-symbolize-sanity-test.cc │ │ │ ├── asprintf.cc │ │ │ ├── assign_large_valloc_to_global.cc │ │ │ ├── closed-fds.cc │ │ │ ├── concurrent_overflow.cc │ │ │ ├── coverage-fork.cc │ │ │ ├── coverage-module-unloaded.cc │ │ │ ├── coverage-reset.cc │ │ │ ├── coverage.cc │ │ │ ├── current_allocated_bytes.cc │ │ │ ├── deep_call_stack.cc │ │ │ ├── deep_thread_stack.cc │ │ │ ├── dlclose-test.cc │ │ │ ├── fgets_fputs.cc │ │ │ ├── fread_fwrite.cc │ │ │ ├── free_hook_realloc.cc │ │ │ ├── freopen.cc │ │ │ ├── gc-test.cc │ │ │ ├── glob.cc │ │ │ ├── glob_test_root │ │ │ │ ├── aa │ │ │ │ ├── ab │ │ │ │ └── ba │ │ │ ├── global-registration.c │ │ │ ├── halt_on_error-signals.c │ │ │ ├── halt_on_error-torture.cc │ │ │ ├── halt_on_error_suppress_equal_pcs.cc │ │ │ ├── handle_abort_on_error.cc │ │ │ ├── init-order-pthread-create.cc │ │ │ ├── interception-in-shared-lib-test.cc │ │ │ ├── invalid-pointer-pairs-threads.cc │ │ │ ├── ioctl.cc │ │ │ ├── large_allocator_unpoisons_on_free.cc │ │ │ ├── lit.local.cfg │ │ │ ├── log_path_fork_test.cc.disabled │ │ │ ├── lto-constmerge-odr.cc │ │ │ ├── mmap_limit_mb.cc │ │ │ ├── new_array_cookie_test.cc │ │ │ ├── new_array_cookie_uaf_test.cc │ │ │ ├── new_array_cookie_with_new_from_class.cc │ │ │ ├── no_asan_gen_globals.c │ │ │ ├── print_cmdline.cc │ │ │ ├── readv.cc │ │ │ ├── shared-lib-test.cc │ │ │ ├── stack-overflow.cc │ │ │ ├── stack-use-after-return.cc │ │ │ ├── start-deactivated.cc │ │ │ ├── strchr.c │ │ │ ├── strerror_r_test.cc │ │ │ ├── strndup_oob_test.cc │ │ │ ├── strndup_oob_test2.cc │ │ │ ├── tsd_dtor_leak.cc │ │ │ ├── wait.cc │ │ │ ├── wait3.cc │ │ │ ├── wait4.cc │ │ │ └── waitid.cc │ │ ├── Windows │ │ │ ├── aligned_mallocs.cc │ │ │ ├── allocators_sanity.cc │ │ │ ├── beginthreadex.cc │ │ │ ├── bind_io_completion_callback.cc │ │ │ ├── bitfield.cc │ │ │ ├── bitfield_uaf.cc │ │ │ ├── calloc_left_oob.cc │ │ │ ├── calloc_right_oob.cc │ │ │ ├── calloc_uaf.cc │ │ │ ├── coverage-basic.cc │ │ │ ├── coverage-dll-stdio.cc │ │ │ ├── crash_read_write.cc │ │ │ ├── crt_initializers.cc │ │ │ ├── delay_dbghelp.cc │ │ │ ├── demangled_names.cc │ │ │ ├── dll_aligned_mallocs.cc │ │ │ ├── dll_allocators_sanity.cc │ │ │ ├── dll_and_lib.cc │ │ │ ├── dll_cerr.cc │ │ │ ├── dll_control_c.cc │ │ │ ├── dll_global_dead_strip.c │ │ │ ├── dll_heap_allocation.cc │ │ │ ├── dll_host.cc │ │ │ ├── dll_intercept_memchr.cc │ │ │ ├── dll_intercept_memcpy.cc │ │ │ ├── dll_intercept_memcpy_indirect.cc │ │ │ ├── dll_intercept_memset.cc │ │ │ ├── dll_intercept_strlen.cc │ │ │ ├── dll_large_function.cc │ │ │ ├── dll_malloc_left_oob.cc │ │ │ ├── dll_malloc_uaf.cc │ │ │ ├── dll_noreturn.cc │ │ │ ├── dll_null_deref.cc │ │ │ ├── dll_operator_array_new_left_oob.cc │ │ │ ├── dll_operator_array_new_with_dtor_left_oob.cc │ │ │ ├── dll_poison_unpoison.cc │ │ │ ├── dll_report_globals_symbolization_at_startup.cc │ │ │ ├── dll_seh.cc │ │ │ ├── dll_stack_use_after_return.cc │ │ │ ├── dll_thread_stack_array_left_oob.cc │ │ │ ├── double_free.cc │ │ │ ├── double_operator_delete.cc │ │ │ ├── free_hook_realloc.cc │ │ │ ├── fuse-lld-globals.cc │ │ │ ├── fuse-lld.cc │ │ │ ├── global_const_string.cc │ │ │ ├── global_const_string_oob.cc │ │ │ ├── global_dead_strip.c │ │ │ ├── hello_world.cc │ │ │ ├── intercept_memcpy.cc │ │ │ ├── intercept_strdup.cc │ │ │ ├── intercept_strlen.cc │ │ │ ├── interface_symbols_windows.cc │ │ │ ├── iostream_sbo.cc │ │ │ ├── lit.local.cfg │ │ │ ├── longjmp.cc │ │ │ ├── malloc_left_oob.cc │ │ │ ├── malloc_right_oob.cc │ │ │ ├── malloc_uaf.cc │ │ │ ├── null_deref.cc │ │ │ ├── null_deref_multiple_dlls.cc │ │ │ ├── oom.cc │ │ │ ├── operator_array_new_left_oob.cc │ │ │ ├── operator_array_new_right_oob.cc │ │ │ ├── operator_array_new_uaf.cc │ │ │ ├── operator_array_new_with_dtor_left_oob.cc │ │ │ ├── operator_delete_wrong_argument.cc │ │ │ ├── operator_new_left_oob.cc │ │ │ ├── operator_new_right_oob.cc │ │ │ ├── operator_new_uaf.cc │ │ │ ├── queue_user_work_item.cc │ │ │ ├── queue_user_work_item_report.cc │ │ │ ├── realloc_left_oob.cc │ │ │ ├── realloc_right_oob.cc │ │ │ ├── realloc_uaf.cc │ │ │ ├── report_after_syminitialize.cc │ │ │ ├── report_globals_reload_dll.cc │ │ │ ├── report_globals_vs_freelibrary.cc │ │ │ ├── seh.cc │ │ │ ├── shadow_conflict_32.cc │ │ │ ├── shadow_mapping_failure.cc │ │ │ ├── stack_array_left_oob.cc │ │ │ ├── stack_array_right_oob.cc │ │ │ ├── stack_array_sanity.cc │ │ │ ├── stack_use_after_return.cc │ │ │ ├── symbols_path.cc │ │ │ ├── thread_simple.cc │ │ │ ├── thread_stack_array_left_oob.cc │ │ │ ├── thread_stack_array_right_oob.cc │ │ │ ├── thread_stack_reuse.cc │ │ │ ├── thread_stress.cc │ │ │ ├── thread_suspended.cc │ │ │ ├── tls_init.cc │ │ │ ├── unsymbolized.cc │ │ │ ├── use_after_realloc.cc │ │ │ ├── use_after_return_linkage.cc │ │ │ ├── user-exception.cc │ │ │ ├── windows_h.cc │ │ │ ├── wrong_downcast_on_heap.cc │ │ │ └── wrong_downcast_on_stack.cc │ │ ├── alloca_big_alignment.cc │ │ ├── alloca_constant_size.cc │ │ ├── alloca_detect_custom_size_.cc │ │ ├── alloca_instruments_all_paddings.cc │ │ ├── alloca_loop_unpoisoning.cc │ │ ├── alloca_overflow_partial.cc │ │ ├── alloca_overflow_right.cc │ │ ├── alloca_safe_access.cc │ │ ├── alloca_underflow_left.cc │ │ ├── alloca_vla_interact.cc │ │ ├── asan_and_llvm_coverage_test.cc │ │ ├── asan_options-help.cc │ │ ├── atexit_stats.cc │ │ ├── atoi_strict.c │ │ ├── atol_strict.c │ │ ├── atoll_strict.c │ │ ├── blacklist.cc │ │ ├── calloc-overflow.cc │ │ ├── contiguous_container.cc │ │ ├── contiguous_container_crash.cc │ │ ├── coverage-and-lsan.cc │ │ ├── coverage-disabled.cc │ │ ├── coverage-trace-pc.cc │ │ ├── debug_double_free.cc │ │ ├── debug_locate.cc │ │ ├── debug_mapping.cc │ │ ├── debug_ppc64_mapping.cc │ │ ├── debug_report.cc │ │ ├── debug_stacks.cc │ │ ├── deep_stack_uaf.cc │ │ ├── deep_tail_call.cc │ │ ├── default_blacklist.cc │ │ ├── default_options.cc │ │ ├── describe_address.cc │ │ ├── double-free.cc │ │ ├── error_report_callback.cc │ │ ├── exitcode.cc │ │ ├── force_inline_opt0.cc │ │ ├── frexp_interceptor.cc │ │ ├── global-address.cpp │ │ ├── global-demangle.cc │ │ ├── global-location.cc │ │ ├── global-overflow.cc │ │ ├── global-underflow.cc │ │ ├── halt_on_error-1.c │ │ ├── handle_noreturn_bug.cc │ │ ├── heap-overflow-large.cc │ │ ├── heap-overflow.cc │ │ ├── heavy_uar_test.cc │ │ ├── huge_negative_hea_oob.cc │ │ ├── ill.cc │ │ ├── init-order-atexit.cc │ │ ├── initialization-blacklist.cc │ │ ├── initialization-bug.cc │ │ ├── initialization-constexpr.cc │ │ ├── initialization-nobug.cc │ │ ├── inline.cc │ │ ├── intercept-rethrow-exception.cc │ │ ├── interception_failure_test.cc │ │ ├── interface_test.cc │ │ ├── intra-object-overflow.cc │ │ ├── invalid-free.cc │ │ ├── invalid-pointer-pairs-compare-errors.cc │ │ ├── invalid-pointer-pairs-compare-null.cc │ │ ├── invalid-pointer-pairs-compare-success.cc │ │ ├── invalid-pointer-pairs-subtract-errors.cc │ │ ├── invalid-pointer-pairs-subtract-success.cc │ │ ├── invalid-pointer-pairs.cc │ │ ├── large_func_test.cc │ │ ├── log-path_test.cc │ │ ├── longjmp.cc │ │ ├── lsan_annotations.cc │ │ ├── malloc-no-intercept.c │ │ ├── malloc-size-too-big.cc │ │ ├── malloc_context_size.cc │ │ ├── malloc_fill.cc │ │ ├── max_redzone.cc │ │ ├── memcmp_strict_test.cc │ │ ├── memcmp_test.cc │ │ ├── memset_test.cc │ │ ├── non-executable-pc.cpp │ │ ├── null_deref.cc │ │ ├── on_error_callback.cc │ │ ├── partial_right.cc │ │ ├── pass-object-byval.cc │ │ ├── pass-struct-byval-uar.cc │ │ ├── pass-struct-byval.cc │ │ ├── poison_partial.cc │ │ ├── pr33372.cc │ │ ├── print_summary.cc │ │ ├── printf-1.c │ │ ├── printf-2.c │ │ ├── printf-3.c │ │ ├── printf-4.c │ │ ├── printf-5.c │ │ ├── printf-m.c │ │ ├── realloc.cc │ │ ├── sanity_check_pure_c.c │ │ ├── scariness_score_test.cc │ │ ├── set_shadow_test.c │ │ ├── sleep_after_init.c │ │ ├── sleep_before_dying.c │ │ ├── small_memcpy_test.cc │ │ ├── speculative_load.cc │ │ ├── speculative_load2.cc │ │ ├── stack-buffer-overflow-with-position.cc │ │ ├── stack-buffer-overflow.cc │ │ ├── stack-frame-demangle.cc │ │ ├── stack-oob-frames.cc │ │ ├── strcasestr-1.c │ │ ├── strcasestr-2.c │ │ ├── strcasestr_strict.c │ │ ├── strcat-overlap.cc │ │ ├── strcat_strict.c │ │ ├── strchr_strict.c │ │ ├── strcmp_strict.c │ │ ├── strcpy-overlap.cc │ │ ├── strcspn-1.c │ │ ├── strcspn-2.c │ │ ├── strcspn_strict.c │ │ ├── strdup_oob_test.cc │ │ ├── strip_path_prefix.c │ │ ├── strncasecmp_strict.c │ │ ├── strncat-overlap.cc │ │ ├── strncat_strict.c │ │ ├── strncmp_strict.c │ │ ├── strncpy-overflow.cc │ │ ├── strncpy-overlap.cc │ │ ├── strpbrk-1.c │ │ ├── strpbrk-2.c │ │ ├── strpbrk_strict.c │ │ ├── strspn-1.c │ │ ├── strspn-2.c │ │ ├── strspn_strict.c │ │ ├── strstr-1.c │ │ ├── strstr-2.c │ │ ├── strstr_strict.c │ │ ├── strtok.c │ │ ├── strtol_strict.c │ │ ├── strtoll_strict.c │ │ ├── suppressions-exec-relative-location.cc │ │ ├── suppressions-function.cc │ │ ├── suppressions-interceptor.cc │ │ ├── suppressions-library.cc │ │ ├── throw_call_test.cc │ │ ├── throw_catch.cc │ │ ├── throw_invoke_test.cc │ │ ├── time_interceptor.cc │ │ ├── uar_and_exceptions.cc │ │ ├── unaligned_loads_and_stores.cc │ │ ├── use-after-delete.cc │ │ ├── use-after-free-right.cc │ │ ├── use-after-free.cc │ │ ├── use-after-poison.cc │ │ ├── use-after-scope-capture.cc │ │ ├── use-after-scope-conversion.cc │ │ ├── use-after-scope-dtor-order.cc │ │ ├── use-after-scope-goto.cc │ │ ├── use-after-scope-if.cc │ │ ├── use-after-scope-inlined.cc │ │ ├── use-after-scope-loop-bug.cc │ │ ├── use-after-scope-loop-removed.cc │ │ ├── use-after-scope-loop.cc │ │ ├── use-after-scope-nobug.cc │ │ ├── use-after-scope-temp.cc │ │ ├── use-after-scope-temp2.cc │ │ ├── use-after-scope-types.cc │ │ ├── use-after-scope.cc │ │ ├── verbose-log-path_test.cc │ │ ├── vla_chrome_testcase.cc │ │ ├── vla_condition_overflow.cc │ │ ├── vla_loop_overfow.cc │ │ └── zero_page_pc.cc │ ├── Unit │ │ └── lit.site.cfg.in │ ├── lit.cfg │ └── lit.site.cfg.in ├── builtins │ ├── CMakeLists.txt │ ├── TestCases │ │ └── Darwin │ │ │ ├── lit.local.cfg │ │ │ ├── os_version_check_test.c │ │ │ └── os_version_check_test_no_core_foundation.c │ ├── Unit │ │ ├── absvdi2_test.c │ │ ├── absvsi2_test.c │ │ ├── absvti2_test.c │ │ ├── adddf3vfp_test.c │ │ ├── addsf3vfp_test.c │ │ ├── addtf3_test.c │ │ ├── addvdi3_test.c │ │ ├── addvsi3_test.c │ │ ├── addvti3_test.c │ │ ├── arm │ │ │ ├── aeabi_cdcmpeq_test.c │ │ │ ├── aeabi_cdcmple_test.c │ │ │ ├── aeabi_cfcmpeq_test.c │ │ │ ├── aeabi_cfcmple_test.c │ │ │ ├── aeabi_drsub_test.c │ │ │ ├── aeabi_frsub_test.c │ │ │ ├── aeabi_idivmod_test.c │ │ │ ├── aeabi_uidivmod_test.c │ │ │ ├── aeabi_uldivmod_test.c │ │ │ ├── call_apsr.S │ │ │ └── call_apsr.h │ │ ├── ashldi3_test.c │ │ ├── ashlti3_test.c │ │ ├── ashrdi3_test.c │ │ ├── ashrti3_test.c │ │ ├── bswapdi2_test.c │ │ ├── bswapsi2_test.c │ │ ├── clear_cache_test.c │ │ ├── clzdi2_test.c │ │ ├── clzsi2_test.c │ │ ├── clzti2_test.c │ │ ├── cmpdi2_test.c │ │ ├── cmpti2_test.c │ │ ├── comparedf2_test.c │ │ ├── comparesf2_test.c │ │ ├── compiler_rt_logb_test.c │ │ ├── compiler_rt_logbf_test.c │ │ ├── compiler_rt_logbl_test.c │ │ ├── cpu_model_test.c │ │ ├── ctzdi2_test.c │ │ ├── ctzsi2_test.c │ │ ├── ctzti2_test.c │ │ ├── divdc3_test.c │ │ ├── divdf3vfp_test.c │ │ ├── divdi3_test.c │ │ ├── divmodsi4_test.c │ │ ├── divsc3_test.c │ │ ├── divsf3vfp_test.c │ │ ├── divsi3_test.c │ │ ├── divtc3_test.c │ │ ├── divtf3_test.c │ │ ├── divti3_test.c │ │ ├── divxc3_test.c │ │ ├── enable_execute_stack_test.c │ │ ├── endianness.h │ │ ├── eqdf2vfp_test.c │ │ ├── eqsf2vfp_test.c │ │ ├── eqtf2_test.c │ │ ├── extebdsfdf2vfp_test.c │ │ ├── extenddftf2_test.c │ │ ├── extendhfsf2_test.c │ │ ├── extendsftf2_test.c │ │ ├── ffsdi2_test.c │ │ ├── ffssi2_test.c │ │ ├── ffsti2_test.c │ │ ├── fixdfdi_test.c │ │ ├── fixdfsivfp_test.c │ │ ├── fixdfti_test.c │ │ ├── fixsfdi_test.c │ │ ├── fixsfsivfp_test.c │ │ ├── fixsfti_test.c │ │ ├── fixtfdi_test.c │ │ ├── fixtfsi_test.c │ │ ├── fixtfti_test.c │ │ ├── fixunsdfdi_test.c │ │ ├── fixunsdfsi_test.c │ │ ├── fixunsdfsivfp_test.c │ │ ├── fixunsdfti_test.c │ │ ├── fixunssfdi_test.c │ │ ├── fixunssfsi_test.c │ │ ├── fixunssfsivfp_test.c │ │ ├── fixunssfti_test.c │ │ ├── fixunstfdi_test.c │ │ ├── fixunstfsi_test.c │ │ ├── fixunstfti_test.c │ │ ├── fixunsxfdi_test.c │ │ ├── fixunsxfsi_test.c │ │ ├── fixunsxfti_test.c │ │ ├── fixxfdi_test.c │ │ ├── fixxfti_test.c │ │ ├── floatdidf_test.c │ │ ├── floatdisf_test.c │ │ ├── floatditf_test.c │ │ ├── floatdixf_test.c │ │ ├── floatsidfvfp_test.c │ │ ├── floatsisfvfp_test.c │ │ ├── floatsitf_test.c │ │ ├── floattidf_test.c │ │ ├── floattisf_test.c │ │ ├── floattitf_test.c │ │ ├── floattixf_test.c │ │ ├── floatundidf_test.c │ │ ├── floatundisf_test.c │ │ ├── floatunditf_test.c │ │ ├── floatundixf_test.c │ │ ├── floatunsitf_test.c │ │ ├── floatunssidfvfp_test.c │ │ ├── floatunssisfvfp_test.c │ │ ├── floatuntidf_test.c │ │ ├── floatuntisf_test.c │ │ ├── floatuntitf_test.c │ │ ├── floatuntixf_test.c │ │ ├── fp_test.h │ │ ├── gcc_personality_test.c │ │ ├── gcc_personality_test_helper.cxx │ │ ├── gedf2vfp_test.c │ │ ├── gesf2vfp_test.c │ │ ├── getf2_test.c │ │ ├── gtdf2vfp_test.c │ │ ├── gtsf2vfp_test.c │ │ ├── gttf2_test.c │ │ ├── ledf2vfp_test.c │ │ ├── lesf2vfp_test.c │ │ ├── letf2_test.c │ │ ├── lit.cfg │ │ ├── lit.site.cfg.in │ │ ├── lshrdi3_test.c │ │ ├── lshrti3_test.c │ │ ├── ltdf2vfp_test.c │ │ ├── ltsf2vfp_test.c │ │ ├── lttf2_test.c │ │ ├── moddi3_test.c │ │ ├── modsi3_test.c │ │ ├── modti3_test.c │ │ ├── muldc3_test.c │ │ ├── muldf3vfp_test.c │ │ ├── muldi3_test.c │ │ ├── mulodi4_test.c │ │ ├── mulosi4_test.c │ │ ├── muloti4_test.c │ │ ├── mulsc3_test.c │ │ ├── mulsf3vfp_test.c │ │ ├── multc3_test.c │ │ ├── multf3_test.c │ │ ├── multi3_test.c │ │ ├── mulvdi3_test.c │ │ ├── mulvsi3_test.c │ │ ├── mulvti3_test.c │ │ ├── mulxc3_test.c │ │ ├── nedf2vfp_test.c │ │ ├── negdf2vfp_test.c │ │ ├── negdi2_test.c │ │ ├── negsf2vfp_test.c │ │ ├── negti2_test.c │ │ ├── negvdi2_test.c │ │ ├── negvsi2_test.c │ │ ├── negvti2_test.c │ │ ├── nesf2vfp_test.c │ │ ├── netf2_test.c │ │ ├── paritydi2_test.c │ │ ├── paritysi2_test.c │ │ ├── parityti2_test.c │ │ ├── popcountdi2_test.c │ │ ├── popcountsi2_test.c │ │ ├── popcountti2_test.c │ │ ├── powidf2_test.c │ │ ├── powisf2_test.c │ │ ├── powitf2_test.c │ │ ├── powixf2_test.c │ │ ├── ppc │ │ │ ├── DD.h │ │ │ ├── fixtfdi_test.c │ │ │ ├── floatditf_test.c │ │ │ ├── floatditf_test.h │ │ │ ├── floatunditf_test.c │ │ │ ├── floatunditf_test.h │ │ │ ├── qadd_test.c │ │ │ ├── qdiv_test.c │ │ │ ├── qmul_test.c │ │ │ ├── qsub_test.c │ │ │ └── test │ │ ├── riscv │ │ │ └── mulsi3_test.c │ │ ├── subdf3vfp_test.c │ │ ├── subsf3vfp_test.c │ │ ├── subtf3_test.c │ │ ├── subvdi3_test.c │ │ ├── subvsi3_test.c │ │ ├── subvti3_test.c │ │ ├── test │ │ ├── trampoline_setup_test.c │ │ ├── truncdfhf2_test.c │ │ ├── truncdfsf2_test.c │ │ ├── truncdfsf2vfp_test.c │ │ ├── truncsfhf2_test.c │ │ ├── trunctfdf2_test.c │ │ ├── trunctfsf2_test.c │ │ ├── ucmpdi2_test.c │ │ ├── ucmpti2_test.c │ │ ├── udivdi3_test.c │ │ ├── udivmoddi4_test.c │ │ ├── udivmodsi4_test.c │ │ ├── udivmodti4_test.c │ │ ├── udivsi3_test.c │ │ ├── udivti3_test.c │ │ ├── umoddi3_test.c │ │ ├── umodsi3_test.c │ │ ├── umodti3_test.c │ │ ├── unorddf2vfp_test.c │ │ ├── unordsf2vfp_test.c │ │ └── unordtf2_test.c │ ├── lit.cfg │ ├── lit.site.cfg.in │ └── timing │ │ ├── ashldi3.c │ │ ├── ashrdi3.c │ │ ├── divdi3.c │ │ ├── floatdidf.c │ │ ├── floatdisf.c │ │ ├── floatdixf.c │ │ ├── floatundidf.c │ │ ├── floatundisf.c │ │ ├── floatundixf.c │ │ ├── lshrdi3.c │ │ ├── moddi3.c │ │ ├── modsi3.c │ │ ├── muldi3.c │ │ ├── negdi2.c │ │ ├── time │ │ ├── timing.h │ │ ├── udivdi3.c │ │ └── umoddi3.c ├── cfi │ ├── CMakeLists.txt │ ├── README.txt │ ├── anon-namespace.cpp │ ├── bad-cast.cpp │ ├── bad-split.cpp │ ├── base-derived-destructor.cpp │ ├── create-derivers.test │ ├── cross-dso-diagnostic.cpp │ ├── cross-dso │ │ ├── icall │ │ │ ├── diag.cpp │ │ │ ├── dlopen.cpp │ │ │ ├── icall-from-dso.cpp │ │ │ ├── icall.cpp │ │ │ └── lit.local.cfg │ │ ├── lit.local.cfg │ │ ├── shadow_is_read_only.cpp │ │ ├── simple-fail.cpp │ │ ├── simple-pass.cpp │ │ ├── stats.cpp │ │ ├── target_out_of_bounds.cpp │ │ └── util │ │ │ └── cfi_stubs.h │ ├── icall │ │ ├── bad-signature.c │ │ ├── external-call.c │ │ ├── lit.local.cfg │ │ ├── weak.c │ │ └── wrong-signature-mixed-lto.c │ ├── lit.cfg │ ├── lit.site.cfg.in │ ├── mfcall.cpp │ ├── multiple-inheritance.cpp │ ├── nvcall.cpp │ ├── overwrite.cpp │ ├── sibling.cpp │ ├── simple-fail.cpp │ ├── simple-pass.cpp │ ├── stats.cpp │ ├── target_uninstrumented.cpp │ ├── two-vcalls.cpp │ ├── utils.h │ ├── vdtor.cpp │ └── vtable-may-alias.cpp ├── dfsan │ ├── CMakeLists.txt │ ├── Inputs │ │ └── flags_abilist.txt │ ├── basic.c │ ├── custom.cc │ ├── dump_labels.c │ ├── flags.c │ ├── fncall.c │ ├── label_count.c │ ├── lit.cfg │ ├── lit.site.cfg.in │ ├── propagate.c │ ├── trace-cmp.c │ ├── vararg.c │ └── write_callback.c ├── esan │ ├── CMakeLists.txt │ ├── TestCases │ │ ├── large-stack-linux.c │ │ ├── libc-intercept.c │ │ ├── mmap-shadow-conflict.c │ │ ├── struct-simple.cpp │ │ ├── verbose-simple.c │ │ ├── workingset-early-fault.c │ │ ├── workingset-memset.cpp │ │ ├── workingset-midreport.cpp │ │ ├── workingset-samples.cpp │ │ ├── workingset-signal-posix.cpp │ │ └── workingset-simple.cpp │ ├── Unit │ │ ├── circular_buffer.cpp │ │ └── hashtable.cpp │ ├── lit.cfg │ └── lit.site.cfg.in ├── fuzzer │ ├── AFLDriverTest.cpp │ ├── AbsNegAndConstant64Test.cpp │ ├── AbsNegAndConstantTest.cpp │ ├── AccumulateAllocationsTest.cpp │ ├── AcquireCrashStateTest.cpp │ ├── BadStrcmpTest.cpp │ ├── Bingo.h │ ├── BogusInitializeTest.cpp │ ├── BufferOverflowOnInput.cpp │ ├── CMakeLists.txt │ ├── CallerCalleeTest.cpp │ ├── CleanseTest.cpp │ ├── CounterTest.cpp │ ├── CustomCrossOverAndMutateTest.cpp │ ├── CustomCrossOverTest.cpp │ ├── CustomMutatorTest.cpp │ ├── CxxStringEqTest.cpp │ ├── DSO1.cpp │ ├── DSO2.cpp │ ├── DSOTestExtra.cpp │ ├── DSOTestMain.cpp │ ├── DeepRecursionTest.cpp │ ├── DivTest.cpp │ ├── EmptyTest.cpp │ ├── EquivalenceATest.cpp │ ├── EquivalenceBTest.cpp │ ├── ExplodeDFSanLabelsTest.cpp │ ├── FlagsTest.cpp │ ├── FourIndependentBranchesTest.cpp │ ├── FullCoverageSetTest.cpp │ ├── GcSectionsTest.cpp │ ├── ImplicitIntegerSignChangeTest.cpp │ ├── ImplicitSignedIntegerTruncationOrSignChangeTest.cpp │ ├── ImplicitSignedIntegerTruncationTest.cpp │ ├── ImplicitUnsignedIntegerTruncationTest.cpp │ ├── InitializeTest.cpp │ ├── LargeTest.cpp │ ├── LeakTest.cpp │ ├── LeakTimeoutTest.cpp │ ├── LoadTest.cpp │ ├── Memcmp64BytesTest.cpp │ ├── MemcmpTest.cpp │ ├── MultipleConstraintsOnSmallInputTest.cpp │ ├── NotinstrumentedTest.cpp │ ├── NthRunCrashTest.cpp │ ├── NullDerefOnEmptyTest.cpp │ ├── NullDerefTest.cpp │ ├── OneHugeAllocTest.cpp │ ├── OnlySomeBytesTest.cpp │ ├── OutOfMemorySingleLargeMallocTest.cpp │ ├── OutOfMemoryTest.cpp │ ├── OverwriteInputTest.cpp │ ├── PrintFuncTest.cpp │ ├── PrintUnstableStatsTest.cpp │ ├── ReadBinaryTest.cpp │ ├── RepeatedBytesTest.cpp │ ├── RepeatedMemcmp.cpp │ ├── ShrinkControlFlowSimpleTest.cpp │ ├── ShrinkControlFlowTest.cpp │ ├── ShrinkValueProfileTest.cpp │ ├── SignedIntOverflowTest.cpp │ ├── SimpleCmpTest.cpp │ ├── SimpleDictionaryTest.cpp │ ├── SimpleHashTest.cpp │ ├── SimpleTest.cpp │ ├── SimpleTestStdio.cpp │ ├── SimpleThreadedTest.cpp │ ├── SingleByteInputTest.cpp │ ├── SingleMemcmpTest.cpp │ ├── SingleStrcmpTest.cpp │ ├── SingleStrncmpTest.cpp │ ├── SleepOneSecondTest.cpp │ ├── SpamyTest.cpp │ ├── StrcmpTest.cpp │ ├── StrncmpOOBTest.cpp │ ├── StrncmpTest.cpp │ ├── StrstrTest.cpp │ ├── SwapCmpTest.cpp │ ├── Switch2Test.cpp │ ├── SwitchTest.cpp │ ├── SymbolizeDeadlock.cpp │ ├── TableLookupTest.cpp │ ├── ThreadedLeakTest.cpp │ ├── ThreadedTest.cpp │ ├── ThreeBytes.cpp │ ├── ThreeFunctionsTest.cpp │ ├── TimeoutEmptyTest.cpp │ ├── TimeoutTest.cpp │ ├── TraceMallocTest.cpp │ ├── TraceMallocThreadedTest.cpp │ ├── TwoDifferentBugsTest.cpp │ ├── UninitializedStrlen.cpp │ ├── UseAfterDtor.cpp │ ├── acquire-crash-state.test │ ├── afl-driver-extra-stats.test │ ├── afl-driver-stderr.test │ ├── afl-driver.test │ ├── bad-strcmp.test │ ├── bogus-initialize.test │ ├── buffer-overflow-on-input.test │ ├── caller-callee.test │ ├── cleanse.test │ ├── counters.test │ ├── coverage.test │ ├── cxxstring.test │ ├── dataflow.test │ ├── dead-stripping.test │ ├── deep-recursion.test │ ├── dict1.txt │ ├── disable-leaks.test │ ├── dso.test │ ├── dump_coverage.test │ ├── equivalence-signals.test │ ├── equivalence.test │ ├── exit-report.test │ ├── exit_on_src_pos.test │ ├── extra-counters.test │ ├── full-coverage-set.test │ ├── fuzzer-customcrossover.test │ ├── fuzzer-customcrossoverandmutate.test │ ├── fuzzer-custommutator.test │ ├── fuzzer-dict.test │ ├── fuzzer-dirs.test │ ├── fuzzer-fdmask.test │ ├── fuzzer-finalstats.test │ ├── fuzzer-flags.test │ ├── fuzzer-implicit-integer-sign-change.test │ ├── fuzzer-implicit-signed-integer-truncation-or-sign-change.test │ ├── fuzzer-implicit-signed-integer-truncation.test │ ├── fuzzer-implicit-unsigned-integer-truncation.test │ ├── fuzzer-leak.test │ ├── fuzzer-oom-with-profile.test │ ├── fuzzer-oom.test │ ├── fuzzer-printcovpcs.test │ ├── fuzzer-runs.test │ ├── fuzzer-seed.test │ ├── fuzzer-segv.test │ ├── fuzzer-singleinputs.test │ ├── fuzzer-threaded.test │ ├── fuzzer-timeout.test │ ├── fuzzer-ubsan.test │ ├── gc-sections.test │ ├── handle-unstable.test │ ├── hi.txt │ ├── initialize.test │ ├── lit.cfg │ ├── lit.site.cfg.in │ ├── max-number-of-runs.test │ ├── memcmp.test │ ├── memcmp64.test │ ├── merge-control-file.test │ ├── merge-posix.test │ ├── merge-sigusr.test │ ├── merge-summary.test │ ├── merge.test │ ├── minimize_crash.test │ ├── minimize_two_crashes.test │ ├── msan.test │ ├── not-instrumented.test │ ├── null-deref-on-empty.test │ ├── null-deref.test │ ├── only-some-bytes.test │ ├── overwrite-input.test │ ├── print-func.test │ ├── print_unstable_stats.test │ ├── read-binary.test │ ├── recommended-dictionary.test │ ├── reduce_inputs.test │ ├── repeated-bytes.test │ ├── shrink.test │ ├── sigusr.test │ ├── simple-cmp.test │ ├── simple.test │ ├── standalone.test │ ├── strcmp.test │ ├── strncmp-oob.test │ ├── strncmp.test │ ├── strstr.test │ ├── swap-cmp.test │ ├── symbolize-deadlock.test │ ├── target-function.test │ ├── three-bytes.test │ ├── trace-malloc-2.test │ ├── trace-malloc-threaded.test │ ├── trace-malloc-unbalanced.test │ ├── trace-malloc.test │ ├── trace-pc.test │ ├── ulimit.test │ ├── unit │ │ └── lit.site.cfg.in │ ├── value-profile-cmp.test │ ├── value-profile-cmp2.test │ ├── value-profile-cmp3.test │ ├── value-profile-cmp4.test │ ├── value-profile-div.test │ ├── value-profile-load.test │ ├── value-profile-mem.test │ ├── value-profile-set.test │ ├── value-profile-strcmp.test │ ├── value-profile-strncmp.test │ ├── value-profile-switch.test │ └── windows-opt-ref.test ├── hwasan │ ├── CMakeLists.txt │ ├── TestCases │ │ ├── Linux │ │ │ ├── aligned_alloc-alignment.cc │ │ │ ├── lit.local.cfg │ │ │ └── pvalloc-overflow.cc │ │ ├── Posix │ │ │ ├── lit.local.cfg │ │ │ └── posix_memalign-alignment.cc │ │ ├── abort-message-android.cc │ │ ├── allocator_returns_null.cc │ │ ├── check-interface.cc │ │ ├── deep-recursion.c │ │ ├── double-free.c │ │ ├── halt-on-error.cc │ │ ├── heap-buffer-overflow.c │ │ ├── hwasan-print-shadow.cc │ │ ├── longjmp.c │ │ ├── malloc-test.c │ │ ├── malloc_fill.cc │ │ ├── many-threads-uaf.c │ │ ├── new-test.cc │ │ ├── print-memory-usage-android.c │ │ ├── print-memory-usage.c │ │ ├── pthread_exit.c │ │ ├── random-align-right.c │ │ ├── realloc-after-free.c │ │ ├── realloc-test.cc │ │ ├── rich-stack.c │ │ ├── sanitizer_malloc.cc │ │ ├── sizes.cpp │ │ ├── stack-history-length.c │ │ ├── stack-oob.c │ │ ├── stack-uar.c │ │ ├── tail-magic.c │ │ ├── thread-uaf.c │ │ ├── uaf_with_rb_distance.c │ │ └── use-after-free.c │ ├── lit.cfg │ └── lit.site.cfg.in ├── interception │ ├── CMakeLists.txt │ └── Unit │ │ └── lit.site.cfg.in ├── lit.common.cfg ├── lit.common.configured.in ├── lsan │ ├── CMakeLists.txt │ ├── TestCases │ │ ├── Darwin │ │ │ ├── dispatch.mm │ │ │ └── lit.local.cfg │ │ ├── Linux │ │ │ ├── cleanup_in_tsd_destructor.c │ │ │ ├── disabler_in_tsd_destructor.c │ │ │ ├── fork.cc │ │ │ ├── fork_and_leak.cc │ │ │ ├── fork_threaded.cc │ │ │ ├── guard-page.c │ │ │ ├── lit.local.cfg │ │ │ ├── log-path_test.cc │ │ │ ├── use_tls_dynamic.cc │ │ │ ├── use_tls_pthread_specific_dynamic.cc │ │ │ ├── use_tls_pthread_specific_static.cc │ │ │ └── use_tls_static.cc │ │ ├── Posix │ │ │ └── lit.local.cfg │ │ ├── default_options.cc │ │ ├── disabler.c │ │ ├── disabler.cc │ │ ├── do_leak_check_override.cc │ │ ├── high_allocator_contention.cc │ │ ├── ignore_object.c │ │ ├── ignore_object_errors.cc │ │ ├── large_allocation_leak.cc │ │ ├── leak_check_at_exit.cc │ │ ├── leak_check_before_thread_started.cc │ │ ├── link_turned_off.cc │ │ ├── many_tls_keys.cc │ │ ├── new_array_with_dtor_0.cc │ │ ├── pointer_to_self.cc │ │ ├── print_suppressions.cc │ │ ├── recoverable_leak_check.cc │ │ ├── register_root_region.cc │ │ ├── sanity_check_pure_c.c │ │ ├── stale_stack_leak.cc │ │ ├── strace_test.cc │ │ ├── suppressions_default.cc │ │ ├── suppressions_file.cc │ │ ├── swapcontext.cc │ │ ├── use_after_return.cc │ │ ├── use_globals_initialized.cc │ │ ├── use_globals_uninitialized.cc │ │ ├── use_poisoned_asan.cc │ │ ├── use_registers.cc │ │ ├── use_stacks.cc │ │ ├── use_stacks_threaded.cc │ │ └── use_unaligned.cc │ ├── lit.common.cfg │ └── lit.site.cfg.in ├── msan │ ├── CMakeLists.txt │ ├── Linux │ │ ├── cmsghdr.cc │ │ ├── eventfd.cc │ │ ├── fopencookie.cc │ │ ├── forkpty.cc │ │ ├── getresid.cc │ │ ├── glob.cc │ │ ├── glob_altdirfunc.cc │ │ ├── glob_nomatch.cc │ │ ├── glob_test_root │ │ │ ├── aa │ │ │ ├── ab │ │ │ └── ba │ │ ├── ioctl_sound.cc │ │ ├── lit.local.cfg │ │ ├── mallinfo.cc │ │ ├── mincore.cc │ │ ├── name_to_handle_at.cc │ │ ├── obstack.cc │ │ ├── poll.cc │ │ ├── process_vm_readv.cc │ │ ├── reexec_unlimited_stack.cc │ │ ├── sendmsg.cc │ │ ├── strerror_r.cc │ │ ├── sunrpc.cc │ │ ├── sunrpc_bytes.cc │ │ ├── sunrpc_string.cc │ │ ├── syscalls.cc │ │ ├── syscalls_sigaction.cc │ │ ├── tcgetattr.cc │ │ ├── xattr.cc │ │ └── xattr_test_root │ │ │ └── a │ ├── Unit │ │ └── lit.site.cfg.in │ ├── __strxfrm_l.cc │ ├── alloca.cc │ ├── allocator_mapping.cc │ ├── backtrace.cc │ ├── c-strdup.c │ ├── chained_origin.cc │ ├── chained_origin_empty_stack.cc │ ├── chained_origin_limits.cc │ ├── chained_origin_memcpy.cc │ ├── chained_origin_with_signals.cc │ ├── check-handler.cc │ ├── check_mem_is_initialized.cc │ ├── coverage-levels.cc │ ├── ctermid.cc │ ├── cxa_atexit.cc │ ├── death-callback.cc │ ├── default_blacklist.cc │ ├── dlerror.cc │ ├── dlopen_executable.cc │ ├── dso-origin.cc │ ├── dtls_test.c │ ├── dtor-base-access.cc │ ├── dtor-bit-fields.cc │ ├── dtor-derived-class.cc │ ├── dtor-member.cc │ ├── dtor-multiple-inheritance-nontrivial-class-members.cc │ ├── dtor-multiple-inheritance.cc │ ├── dtor-trivial-class-members.cc │ ├── dtor-trivial.cpp │ ├── dtor-vtable-multiple-inheritance.cc │ ├── dtor-vtable.cc │ ├── errno.cc │ ├── fgets_fputs.cc │ ├── fork.cc │ ├── fread_fwrite.cc │ ├── fstat.cc │ ├── ftime.cc │ ├── getaddrinfo-positive.cc │ ├── getaddrinfo.cc │ ├── getc_unlocked.c │ ├── getline.cc │ ├── getloadavg.cc │ ├── getutent.cc │ ├── heap-origin.cc │ ├── icmp_slt_allones.cc │ ├── iconv.cc │ ├── if_indextoname.cc │ ├── ifaddrs.cc │ ├── initgroups.cc │ ├── inline.cc │ ├── insertvalue_origin.cc │ ├── ioctl.cc │ ├── ioctl_custom.cc │ ├── lit.cfg │ ├── lit.site.cfg.in │ ├── memcmp_test.cc │ ├── mktime.cc │ ├── mmap.cc │ ├── mmap_below_shadow.cc │ ├── msan_check_mem_is_initialized.cc │ ├── msan_copy_shadow.cc │ ├── msan_dump_shadow.cc │ ├── msan_print_shadow.cc │ ├── msan_print_shadow2.cc │ ├── msan_print_shadow3.cc │ ├── mul_by_const.cc │ ├── no_sanitize_memory.cc │ ├── no_sanitize_memory_prop.cc │ ├── origin-store-long.cc │ ├── param_tls_limit.cc │ ├── poison_in_free.cc │ ├── pr32842.c │ ├── print_stats.cc │ ├── pthread_getattr_np_deadlock.cc │ ├── pthread_getname_np.cc │ ├── pthread_setcancelstate.cc │ ├── rand_r.cc │ ├── readdir64.cc │ ├── realloc-large-origin.cc │ ├── realloc-origin.cc │ ├── recover-dso.cc │ ├── recover.cc │ ├── report-demangling.cc │ ├── scandir.cc │ ├── scandir_null.cc │ ├── scandir_test_root │ │ ├── aaa │ │ ├── aab │ │ └── bbb │ ├── scoped-interceptors.cc │ ├── select.cc │ ├── select_float_origin.cc │ ├── select_origin.cc │ ├── sem_getvalue.cc │ ├── setlocale.cc │ ├── sigaction.cc │ ├── signal_stress_test.cc │ ├── sigwait.cc │ ├── sigwaitinfo.cc │ ├── stack-origin.cc │ ├── stack-origin2.cc │ ├── strerror_r-non-gnu.c │ ├── strlen_of_shadow.cc │ ├── strndup.cc │ ├── strxfrm.cc │ ├── sync_lock_set_and_test.cc │ ├── test.h │ ├── textdomain.cc │ ├── times.cc │ ├── tls_reuse.cc │ ├── tsearch.cc │ ├── tzset.cc │ ├── unaligned_read_origin.cc │ ├── unpoison_string.cc │ ├── use-after-dtor.cc │ ├── use-after-free.cc │ ├── vararg.cc │ ├── vector_cvt.cc │ ├── vector_div.cc │ ├── vector_select.cc │ ├── wcsncpy.cc │ └── wcsxfrm.cc ├── profile │ ├── CMakeLists.txt │ ├── Inputs │ │ ├── comdat_rename.h │ │ ├── comdat_rename_1.cc │ │ ├── comdat_rename_2.cc │ │ ├── extern_template.cpp │ │ ├── extern_template.h │ │ ├── extern_template1.cpp │ │ ├── extern_template2.cpp │ │ ├── gcc-flag-compatibility.c │ │ ├── instrprof-alloc.c │ │ ├── instrprof-comdat-1.cpp │ │ ├── instrprof-comdat-2.cpp │ │ ├── instrprof-comdat.h │ │ ├── instrprof-dlopen-dlclose-main.c │ │ ├── instrprof-dlopen-dlclose-main.c.gcov │ │ ├── instrprof-dlopen-dlclose-main_three-libs.c.gcov │ │ ├── instrprof-dlopen-func.c │ │ ├── instrprof-dlopen-func.c.gcov │ │ ├── instrprof-dlopen-func2.c │ │ ├── instrprof-dlopen-func2.c.gcov │ │ ├── instrprof-dlopen-func3.c │ │ ├── instrprof-dlopen-func3.c.gcov │ │ ├── instrprof-dlopen-main.c │ │ ├── instrprof-dynamic-a.cpp │ │ ├── instrprof-dynamic-b.cpp │ │ ├── instrprof-dynamic-header.h │ │ ├── instrprof-dynamic-main.cpp │ │ ├── instrprof-file_ex.c │ │ ├── instrprof-gcov-__gcov_flush-multiple.c │ │ ├── instrprof-gcov-__gcov_flush-multiple.c.gcov │ │ ├── instrprof-gcov-__gcov_flush-terminate.c │ │ ├── instrprof-gcov-__gcov_flush-terminate.c.gcov │ │ ├── instrprof-gcov-exceptions.cpp │ │ ├── instrprof-gcov-exceptions.cpp.gcov │ │ ├── instrprof-gcov-execlp.c │ │ ├── instrprof-gcov-execlp.c.gcov │ │ ├── instrprof-gcov-execvp.c │ │ ├── instrprof-gcov-execvp.c.gcov │ │ ├── instrprof-gcov-fork.c │ │ ├── instrprof-gcov-fork.c.gcov │ │ ├── instrprof-gcov-multiple-bbs-single-line.c │ │ ├── instrprof-gcov-multiple-bbs-single-line.c.gcov │ │ ├── instrprof-gcov-one-line-function.c │ │ ├── instrprof-gcov-one-line-function.c.gcov │ │ ├── instrprof-gcov-switch1.c │ │ ├── instrprof-gcov-switch1.c.gcov │ │ ├── instrprof-gcov-switch2.c │ │ ├── instrprof-gcov-switch2.c.gcov │ │ ├── instrprof-icall-promo.h │ │ ├── instrprof-icall-promo_1.cc │ │ ├── instrprof-icall-promo_2.cc │ │ ├── instrprof-merge-match-lib.c │ │ ├── instrprof-merge-match.c │ │ ├── instrprof-shared-lib.c │ │ ├── instrprof-shared-lib.c.gcov │ │ ├── instrprof-shared-lib_called-twice.c.gcov │ │ ├── instrprof-shared-lib_in-loop.c.gcov │ │ ├── instrprof-shared-main-gcov-flush.c │ │ ├── instrprof-shared-main-gcov-flush_no-writeout.c.gcov │ │ ├── instrprof-shared-main-gcov-flush_shared-call-after.c.gcov │ │ ├── instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov │ │ ├── instrprof-shared-main-gcov-flush_shared-call-before.c.gcov │ │ ├── instrprof-shared-main.c │ │ ├── instrprof-shared-main.c.gcov │ │ ├── instrprof-value-prof-evict.c │ │ ├── instrprof-value-prof-real.c │ │ └── instrprof-visibility-helper.cpp │ ├── Linux │ │ ├── comdat_rename.test │ │ ├── counter_promo_for.c │ │ ├── counter_promo_nest.c │ │ ├── counter_promo_while.c │ │ ├── coverage_ctors.cpp │ │ ├── coverage_dtor.cpp │ │ ├── coverage_shared.test │ │ ├── coverage_test.cpp │ │ ├── extern_template.test │ │ ├── instrprof-alloc.test │ │ ├── instrprof-basic.c │ │ ├── instrprof-comdat.test │ │ ├── instrprof-cs.c │ │ ├── instrprof-dir.c │ │ ├── instrprof-dlopen.test │ │ ├── instrprof-dynamic-one-shared.test │ │ ├── instrprof-dynamic-two-shared.test │ │ ├── instrprof-file_ex.test │ │ ├── instrprof-merge-vp.c │ │ ├── instrprof-value-merge.c │ │ ├── instrprof-value-prof-warn.test │ │ └── lit.local.cfg │ ├── Posix │ │ ├── instrprof-gcov-execlp.test │ │ ├── instrprof-gcov-execvp.test │ │ └── instrprof-gcov-fork.test │ ├── gcc-flag-compatibility.test │ ├── infinite_loop.c │ ├── instrprof-basic.c │ ├── instrprof-bufferio.c │ ├── instrprof-darwin-dead-strip.c │ ├── instrprof-darwin-exports.c │ ├── instrprof-dlopen-dlclose-gcov.test │ ├── instrprof-dlopen.test │ ├── instrprof-dump.c │ ├── instrprof-dynamic-one-shared.test │ ├── instrprof-dynamic-two-shared.test │ ├── instrprof-error.c │ ├── instrprof-gcov-__gcov_flush-multiple.test │ ├── instrprof-gcov-__gcov_flush-terminate.test │ ├── instrprof-gcov-exceptions.test │ ├── instrprof-gcov-multiple-bbs-single-line.test │ ├── instrprof-gcov-one-line-function.test │ ├── instrprof-gcov-switch.test │ ├── instrprof-gcov-two-objects.test │ ├── instrprof-get-filename.c │ ├── instrprof-hostname.c │ ├── instrprof-icall-promo.test │ ├── instrprof-merge-match.test │ ├── instrprof-merge.c │ ├── instrprof-merging.cpp │ ├── instrprof-override-filename-then-reset-default.c │ ├── instrprof-override-filename-with-env.c │ ├── instrprof-override-filename.c │ ├── instrprof-path.c │ ├── instrprof-reset-counters.c │ ├── instrprof-set-dir-mode.c │ ├── instrprof-set-filename-shared.test │ ├── instrprof-set-filename-then-reset-default.c │ ├── instrprof-set-filename.c │ ├── instrprof-shared-gcov-flush.test │ ├── instrprof-shared.test │ ├── instrprof-value-prof-2.c │ ├── instrprof-value-prof-evict.test │ ├── instrprof-value-prof-reset.c │ ├── instrprof-value-prof-shared.test │ ├── instrprof-value-prof.c │ ├── instrprof-value-prof.test │ ├── instrprof-version-mismatch.c │ ├── instrprof-visibility-kinds.inc │ ├── instrprof-visibility.cpp │ ├── instrprof-without-libc.c │ ├── instrprof-write-file-atexit-explicitly.c │ ├── instrprof-write-file-only.c │ ├── instrprof-write-file.c │ ├── lit.cfg │ ├── lit.site.cfg.in │ └── runtime_infinite.c ├── safestack │ ├── CMakeLists.txt │ ├── buffer-copy-vla.c │ ├── buffer-copy.c │ ├── canary.c │ ├── init.c │ ├── lit.cfg │ ├── lit.site.cfg.in │ ├── lto.c │ ├── overflow.c │ ├── pthread-cleanup.c │ ├── pthread-stack-size.c │ ├── pthread.c │ └── utils.h ├── sanitizer_common │ ├── CMakeLists.txt │ ├── TestCases │ │ ├── Darwin │ │ │ ├── abort_on_error.cc │ │ │ ├── lit.local.cfg │ │ │ └── print-stack-trace.cc │ │ ├── Linux │ │ │ ├── abort_on_error.cc │ │ │ ├── aligned_alloc-alignment.cc │ │ │ ├── aligned_alloc.c │ │ │ ├── allow_user_segv.cc │ │ │ ├── assert.cc │ │ │ ├── clock_gettime.c │ │ │ ├── closedir.c │ │ │ ├── decorate_proc_maps.cc │ │ │ ├── deepbind.cc │ │ │ ├── getpwnam_r_invalid_user.cc │ │ │ ├── hard_rss_limit_mb_test.cc │ │ │ ├── iconv_test.c │ │ │ ├── ill.cc │ │ │ ├── lit.local.cfg │ │ │ ├── mallopt.cc │ │ │ ├── mlock_test.cc │ │ │ ├── mmap64_test.c │ │ │ ├── mmap_write_exec.cpp │ │ │ ├── mprobe.cc │ │ │ ├── name_to_handle_at.cc │ │ │ ├── new_delete_test.cc │ │ │ ├── open_memstream.cc │ │ │ ├── pthread_mutex.cc │ │ │ ├── ptrace.cc │ │ │ ├── pvalloc-overflow.cc │ │ │ ├── recv_msg_trunc.cc │ │ │ ├── sched_getparam.cc │ │ │ ├── sem_init_glibc.cc │ │ │ ├── signal_segv_handler.cc │ │ │ ├── soft_rss_limit_mb_test.cc │ │ │ ├── sysconf_interceptor_bypass_test.cc │ │ │ ├── timerfd.cc │ │ │ └── unexpected_format_specifier_test.cc │ │ ├── NetBSD │ │ │ ├── faccessat.cc │ │ │ ├── getgrouplist.cc │ │ │ ├── getgroupmembership.cc │ │ │ ├── getmntinfo.cc │ │ │ ├── gid_from_group.cc │ │ │ ├── group_from_gid.cc │ │ │ ├── lit.local.cfg │ │ │ ├── mi_vector_hash.cc │ │ │ ├── netent.cc │ │ │ ├── paccept.cc │ │ │ ├── protoent.cc │ │ │ ├── strmode.cc │ │ │ ├── ttyent.cc │ │ │ ├── uid_from_user.cc │ │ │ └── user_from_uid.cc │ │ ├── Posix │ │ │ ├── access.cc │ │ │ ├── dedup_token_length_test.cc │ │ │ ├── devname.cc │ │ │ ├── devname_r.cc │ │ │ ├── dump_instruction_bytes.cc │ │ │ ├── dump_registers.cc │ │ │ ├── fgetln.cc │ │ │ ├── fgets.cc │ │ │ ├── fpe.cc │ │ │ ├── fputs_puts.cc │ │ │ ├── getpass.cc │ │ │ ├── illegal_read_test.cc │ │ │ ├── illegal_write_test.cc │ │ │ ├── lit.local.cfg │ │ │ ├── lstat.cc │ │ │ ├── mmap_test.c │ │ │ ├── posix_memalign-alignment.cc │ │ │ ├── readlink.c │ │ │ ├── readlinkat.c │ │ │ ├── sanitizer_set_death_callback_test.cc │ │ │ ├── sanitizer_set_report_fd_test.cc │ │ │ ├── setvbuf.cc │ │ │ ├── strlcat.cc │ │ │ ├── strlcpy.cc │ │ │ ├── strxfrm.c │ │ │ ├── wcsxfrm.c │ │ │ └── weak_hook_test.cc │ │ ├── allocator_returns_null.cc │ │ ├── corelimit.cc │ │ ├── ctype.c │ │ ├── fopen_nullptr.c │ │ ├── get_module_and_offset_for_pc.cc │ │ ├── malloc_hook.cc │ │ ├── options-help.cc │ │ ├── options-include.cc │ │ ├── options-invalid.cc │ │ ├── print-stack-trace.cc │ │ ├── printf-ldbl.c │ │ ├── pthread_mutexattr_get.cc │ │ ├── sanitizer_coverage_inline8bit_counter.cc │ │ ├── sanitizer_coverage_no_prune.cc │ │ ├── sanitizer_coverage_stack_depth.cc │ │ ├── sanitizer_coverage_symbolize.cc │ │ ├── sanitizer_coverage_trace_pc_guard-dso.cc │ │ ├── sanitizer_coverage_trace_pc_guard-init.cc │ │ ├── sanitizer_coverage_trace_pc_guard.cc │ │ ├── scanf-ldbl.c │ │ ├── strcasestr.c │ │ ├── strcspn.c │ │ ├── strnlen.c │ │ ├── strpbrk.c │ │ ├── strspn.c │ │ ├── strstr.c │ │ ├── symbolize_pc.cc │ │ ├── symbolize_pc_inline.cc │ │ └── symbolize_stack.cc │ ├── Unit │ │ └── lit.site.cfg.in │ ├── android_commands │ │ ├── android_common.py │ │ ├── android_compile.py │ │ └── android_run.py │ ├── ios_commands │ │ ├── iossim_compile.py │ │ ├── iossim_env.py │ │ ├── iossim_prepare.py │ │ └── iossim_run.py │ ├── lit.common.cfg │ ├── lit.site.cfg.in │ └── print_address.h ├── scudo │ ├── CMakeLists.txt │ ├── aligned-new.cpp │ ├── alignment.c │ ├── dealloc-race.c │ ├── double-free.cpp │ ├── fsanitize.c │ ├── interface.cpp │ ├── lit.cfg │ ├── lit.site.cfg.in │ ├── malloc.cpp │ ├── memalign.c │ ├── mismatch.cpp │ ├── options.cpp │ ├── overflow.c │ ├── preinit.c │ ├── preload.cpp │ ├── quarantine.c │ ├── random_shuffle.cpp │ ├── realloc.cpp │ ├── rss.c │ ├── secondary.c │ ├── sized-delete.cpp │ ├── sizes.cpp │ ├── stats.c │ ├── symbols.test │ ├── threads.c │ ├── tsd_destruction.c │ └── valloc.c ├── shadowcallstack │ ├── CMakeLists.txt │ ├── init.c │ ├── libc_support.h │ ├── lit.cfg │ ├── lit.site.cfg.in │ ├── minimal_runtime.h │ ├── overflow-aarch64.c │ ├── overflow-x86_64.c │ └── overflow.c ├── tsan │ ├── CMakeLists.txt │ ├── Darwin │ │ ├── deadlock.mm │ │ ├── debug_external.cc │ │ ├── dispatch_main.mm │ │ ├── dispatch_once_deadlock.mm │ │ ├── dlopen.cc │ │ ├── external-dups.cc │ │ ├── external-ignore-noninstrumented.cc │ │ ├── external-lib.cc │ │ ├── external-noninstrumented-module.cc │ │ ├── external-swift-debugging.cc │ │ ├── external-swift.cc │ │ ├── external.cc │ │ ├── gcd-after.mm │ │ ├── gcd-apply-race.mm │ │ ├── gcd-apply.mm │ │ ├── gcd-async-norace.mm │ │ ├── gcd-async-race.mm │ │ ├── gcd-barrier-race.mm │ │ ├── gcd-barrier.mm │ │ ├── gcd-blocks.mm │ │ ├── gcd-data.mm │ │ ├── gcd-fd.mm │ │ ├── gcd-groups-destructor.mm │ │ ├── gcd-groups-leave.mm │ │ ├── gcd-groups-norace.mm │ │ ├── gcd-groups-stress.mm │ │ ├── gcd-io-barrier-race.mm │ │ ├── gcd-io-barrier.mm │ │ ├── gcd-io-cleanup.mm │ │ ├── gcd-io-race.mm │ │ ├── gcd-io.mm │ │ ├── gcd-once.mm │ │ ├── gcd-semaphore-norace.mm │ │ ├── gcd-serial-queue-norace.mm │ │ ├── gcd-source-cancel.mm │ │ ├── gcd-source-cancel2.mm │ │ ├── gcd-source-event.mm │ │ ├── gcd-source-event2.mm │ │ ├── gcd-source-registration.mm │ │ ├── gcd-source-registration2.mm │ │ ├── gcd-source-serial.mm │ │ ├── gcd-suspend.mm │ │ ├── gcd-sync-block-copy.mm │ │ ├── gcd-sync-norace.mm │ │ ├── gcd-sync-race.mm │ │ ├── gcd-target-queue-norace.mm │ │ ├── ignore-noninstrumented.mm │ │ ├── ignored-interceptors.mm │ │ ├── libcxx-call-once.mm │ │ ├── libcxx-future.mm │ │ ├── libcxx-shared-ptr-recursive.mm │ │ ├── libcxx-shared-ptr-stress.mm │ │ ├── libcxx-shared-ptr.mm │ │ ├── lit.local.cfg │ │ ├── main_tid.mm │ │ ├── malloc-stack-logging.cc │ │ ├── malloc_size.mm │ │ ├── norace-objcxx-run-time.mm │ │ ├── objc-double-property.mm │ │ ├── objc-race.mm │ │ ├── objc-simple.mm │ │ ├── objc-synchronize-tagged.mm │ │ ├── objc-synchronize.mm │ │ ├── osatomics-add.mm │ │ ├── osatomics-bitops.mm │ │ ├── osatomics-list.mm │ │ ├── osspinlock-norace.cc │ │ ├── realloc-zero.cc │ │ ├── signals-blocked.cc │ │ ├── symbolizer-atos.cc │ │ ├── symbolizer-dladdr.cc │ │ ├── workerthreads.mm │ │ ├── xpc-cancel.mm │ │ ├── xpc-race.mm │ │ └── xpc.mm │ ├── Linux │ │ ├── check_memcpy.cc │ │ ├── check_preinit.cc │ │ ├── double_race.cc │ │ ├── lit.local.cfg │ │ ├── mutex_robust.cc │ │ ├── mutex_robust2.cc │ │ ├── pie_no_aslr.cc │ │ ├── thread_timedjoin.c │ │ ├── thread_tryjoin.c │ │ ├── user_fopen.cc │ │ └── user_malloc.cc │ ├── Unit │ │ └── lit.site.cfg.in │ ├── aligned_vs_unaligned_race.cc │ ├── annotate_happens_before.cc │ ├── atexit.cc │ ├── atexit2.cc │ ├── atexit3.cc │ ├── atomic_free.cc │ ├── atomic_free2.cc │ ├── atomic_free3.cc │ ├── atomic_hle.cc │ ├── atomic_norace.cc │ ├── atomic_race.cc │ ├── atomic_stack.cc │ ├── atomic_store.cc │ ├── barrier.cc │ ├── bench.h │ ├── bench_acquire_only.cc │ ├── bench_acquire_release.cc │ ├── bench_local_mutex.cc │ ├── bench_mutex.cc │ ├── bench_release_only.cc │ ├── bench_rwmutex.cc │ ├── bench_shadow_flush.cc │ ├── bench_single_writer.cc │ ├── bench_ten_mutexes.cc │ ├── benign_race.cc │ ├── blacklist.cc │ ├── blacklist2.cc │ ├── cond.c │ ├── cond_cancel.c │ ├── cond_destruction.cc │ ├── cond_race.cc │ ├── cond_version.c │ ├── custom_mutex.h │ ├── custom_mutex0.cc │ ├── custom_mutex1.cc │ ├── custom_mutex2.cc │ ├── custom_mutex3.cc │ ├── custom_mutex4.cc │ ├── custom_mutex5.cc │ ├── cxa_guard_acquire.cc │ ├── deadlock_detector_stress_test.cc │ ├── debug_alloc_stack.cc │ ├── debug_locate.cc │ ├── debugging.cc │ ├── deep_stack1.cc │ ├── default_options.cc │ ├── deflake.bash │ ├── dl_iterate_phdr.cc │ ├── dlclose.cc │ ├── dtls.c │ ├── exceptions.cc │ ├── fd_close_norace.cc │ ├── fd_close_norace2.cc │ ├── fd_dup_norace.cc │ ├── fd_dup_norace2.cc │ ├── fd_dup_race.cc │ ├── fd_location.cc │ ├── fd_pipe_norace.cc │ ├── fd_pipe_race.cc │ ├── fd_socket_connect_norace.cc │ ├── fd_socket_norace.cc │ ├── fd_socketpair_norace.cc │ ├── fd_stdout_race.cc │ ├── fd_tid_recycled.cc │ ├── fork_atexit.cc │ ├── fork_deadlock.cc │ ├── fork_multithreaded.cc │ ├── fork_multithreaded3.cc │ ├── free_race.c │ ├── free_race.c.supp │ ├── free_race2.c │ ├── getline_nohang.cc │ ├── global_race.cc │ ├── global_race2.cc │ ├── global_race3.cc │ ├── halt_on_error.cc │ ├── heap_race.cc │ ├── ignore_free.cc │ ├── ignore_lib0.cc │ ├── ignore_lib0.cc.supp │ ├── ignore_lib1.cc │ ├── ignore_lib1.cc.supp │ ├── ignore_lib2.cc │ ├── ignore_lib2.cc.supp │ ├── ignore_lib3.cc │ ├── ignore_lib3.cc.supp │ ├── ignore_lib4.cc │ ├── ignore_lib5.cc │ ├── ignore_lib5.cc.supp │ ├── ignore_lib_lib.h │ ├── ignore_malloc.cc │ ├── ignore_race.cc │ ├── ignore_sync.cc │ ├── ignored-interceptors-mmap.cc │ ├── inlined_memcpy_race.cc │ ├── inlined_memcpy_race2.cc │ ├── interface_atomic_test.c │ ├── java.h │ ├── java_alloc.cc │ ├── java_finalizer.cc │ ├── java_find.cc │ ├── java_heap_init.cc │ ├── java_lock.cc │ ├── java_lock_move.cc │ ├── java_lock_rec.cc │ ├── java_lock_rec_race.cc │ ├── java_move_overlap.cc │ ├── java_move_overlap_race.cc │ ├── java_race.cc │ ├── java_race_move.cc │ ├── java_race_pc.cc │ ├── java_rwlock.cc │ ├── java_symbolization.cc │ ├── java_symbolization_legacy.cc │ ├── java_volatile.cc │ ├── large_malloc_meta.cc │ ├── libcxx │ │ ├── lit.local.cfg │ │ └── std_shared_ptr.cc │ ├── lit.cfg │ ├── lit.site.cfg.in │ ├── load_shared_lib.cc │ ├── longjmp.cc │ ├── longjmp2.cc │ ├── longjmp3.cc │ ├── longjmp4.cc │ ├── lots_of_threads.c │ ├── malloc_overflow.cc │ ├── malloc_stack.cc │ ├── map32bit.cc │ ├── memcmp_race.cc │ ├── memcpy_race.cc │ ├── mmap_large.cc │ ├── mmap_stress.cc │ ├── mop1.c │ ├── mop_with_offset.cc │ ├── mop_with_offset2.cc │ ├── must_deadlock.cc │ ├── mutex_annotations.cc │ ├── mutex_bad_read_lock.cc │ ├── mutex_bad_read_unlock.cc │ ├── mutex_bad_unlock.cc │ ├── mutex_cycle2.c │ ├── mutex_cycle_long.c │ ├── mutex_destroy_locked.cc │ ├── mutex_destroy_locked2.cc │ ├── mutex_double_lock.cc │ ├── mutex_lock_destroyed.cc │ ├── mutexset1.cc │ ├── mutexset2.cc │ ├── mutexset3.cc │ ├── mutexset4.cc │ ├── mutexset5.cc │ ├── mutexset6.cc │ ├── mutexset7.cc │ ├── mutexset8.cc │ ├── pie_test.cc │ ├── printf-1.c │ ├── pthread_atfork_deadlock.c │ ├── pthread_key.cc │ ├── race_on_barrier.c │ ├── race_on_barrier2.c │ ├── race_on_fputs.cc │ ├── race_on_heap.cc │ ├── race_on_mutex.c │ ├── race_on_mutex2.c │ ├── race_on_puts.cc │ ├── race_on_read.cc │ ├── race_on_speculative_load.cc │ ├── race_on_write.cc │ ├── race_stress.cc │ ├── race_top_suppression.cc │ ├── race_top_suppression1.cc │ ├── race_with_finished_thread.cc │ ├── real_deadlock_detector_stress_test.cc │ ├── restore_stack.cc │ ├── setuid.c │ ├── setuid2.c │ ├── signal_block.cc │ ├── signal_cond.cc │ ├── signal_errno.cc │ ├── signal_longjmp.cc │ ├── signal_malloc.cc │ ├── signal_pause.cc │ ├── signal_recursive.cc │ ├── signal_reset.cc │ ├── signal_sync.cc │ ├── signal_sync2.cc │ ├── signal_thread.cc │ ├── signal_write.cc │ ├── sigsuspend.cc │ ├── simple_race.c │ ├── simple_race.cc │ ├── simple_stack.c │ ├── simple_stack2.cc │ ├── sleep_sync.cc │ ├── sleep_sync2.cc │ ├── stack_race.cc │ ├── stack_race2.cc │ ├── stack_sync_reuse.cc │ ├── static_init1.cc │ ├── static_init2.cc │ ├── static_init3.cc │ ├── static_init4.cc │ ├── static_init5.cc │ ├── static_init6.cc │ ├── strerror_r.cc │ ├── sunrpc.cc │ ├── suppress_same_address.cc │ ├── suppress_same_stacks.cc │ ├── suppressions_global.cc │ ├── suppressions_global.cc.supp │ ├── suppressions_mutex.cc │ ├── suppressions_mutex.cc.supp │ ├── suppressions_race.cc │ ├── suppressions_race.cc.supp │ ├── suppressions_race2.cc │ ├── suppressions_race2.cc.supp │ ├── test.h │ ├── thread_detach.c │ ├── thread_detach2.c │ ├── thread_end_with_ignore.cc │ ├── thread_end_with_ignore2.cc │ ├── thread_end_with_ignore3.cc │ ├── thread_leak.c │ ├── thread_leak2.c │ ├── thread_leak3.c │ ├── thread_leak4.c │ ├── thread_leak5.c │ ├── thread_name.cc │ ├── thread_name2.cc │ ├── tiny_race.c │ ├── tls_race.cc │ ├── tls_race2.cc │ ├── tsan-vs-gvn.cc │ ├── unaligned_norace.cc │ ├── unaligned_race.cc │ ├── vfork.cc │ ├── virtual_inheritance_compile_bug.cc │ ├── vptr_benign_race.cc │ ├── vptr_harmful_race.cc │ ├── vptr_harmful_race2.cc │ ├── vptr_harmful_race3.cc │ ├── vptr_harmful_race4.cc │ └── write_in_reader_lock.cc ├── ubsan │ ├── CMakeLists.txt │ ├── TestCases │ │ ├── Float │ │ │ └── cast-overflow.cpp │ │ ├── ImplicitConversion │ │ │ ├── integer-arithmetic-value-change.c │ │ │ ├── integer-conversion.c │ │ │ ├── integer-sign-change-blacklist.c │ │ │ ├── integer-sign-change-summary.cpp │ │ │ ├── integer-sign-change.c │ │ │ ├── integer-truncation.c │ │ │ ├── signed-integer-truncation-blacklist.c │ │ │ ├── signed-integer-truncation-or-sign-change-blacklist.c │ │ │ ├── signed-integer-truncation-or-sign-change-summary.cpp │ │ │ ├── signed-integer-truncation-summary.cpp │ │ │ ├── signed-integer-truncation.c │ │ │ ├── unsigned-integer-truncation-blacklist.c │ │ │ ├── unsigned-integer-truncation-summary.cpp │ │ │ └── unsigned-integer-truncation.c │ │ ├── Integer │ │ │ ├── add-overflow.cpp │ │ │ ├── div-overflow.cpp │ │ │ ├── div-zero.cpp │ │ │ ├── incdec-overflow.cpp │ │ │ ├── mul-overflow.cpp │ │ │ ├── negate-overflow.cpp │ │ │ ├── no-recover.cpp │ │ │ ├── shift.cpp │ │ │ ├── sub-overflow.cpp │ │ │ ├── summary.cpp │ │ │ ├── suppressions.cpp │ │ │ ├── uadd-overflow.cpp │ │ │ ├── uincdec-overflow.cpp │ │ │ ├── umul-overflow.cpp │ │ │ └── usub-overflow.cpp │ │ ├── Misc │ │ │ ├── Inputs │ │ │ │ ├── no-interception-dso.c │ │ │ │ └── returns-unexpectedly.c │ │ │ ├── Linux │ │ │ │ ├── lit.local.cfg │ │ │ │ ├── print_stack_trace.cc │ │ │ │ └── ubsan_options.cc │ │ │ ├── bool.cpp │ │ │ ├── bool.m │ │ │ ├── bounds.cpp │ │ │ ├── builtins.cpp │ │ │ ├── coverage-levels.cc │ │ │ ├── deduplication.cpp │ │ │ ├── enum.cpp │ │ │ ├── log-path_test.cc │ │ │ ├── missing_return.cpp │ │ │ ├── monitor.cpp │ │ │ ├── no-interception.cpp │ │ │ ├── nonnull-arg.cpp │ │ │ ├── nonnull.cpp │ │ │ ├── nullability.c │ │ │ ├── unreachable.cpp │ │ │ └── vla.c │ │ ├── Pointer │ │ │ ├── index-overflow.cpp │ │ │ └── unsigned-index-expression.cpp │ │ └── TypeCheck │ │ │ ├── Function │ │ │ ├── function.cpp │ │ │ └── lit.local.cfg │ │ │ ├── Linux │ │ │ ├── PR33221.cpp │ │ │ └── lit.local.cfg │ │ │ ├── PR33221.cpp │ │ │ ├── misaligned.cpp │ │ │ ├── null.cpp │ │ │ ├── vptr-corrupted-vtable-itanium.cpp │ │ │ ├── vptr-non-unique-typeinfo.cpp │ │ │ ├── vptr-virtual-base-construction.cpp │ │ │ ├── vptr-virtual-base.cpp │ │ │ └── vptr.cpp │ ├── lit.common.cfg │ └── lit.site.cfg.in ├── ubsan_minimal │ ├── CMakeLists.txt │ ├── TestCases │ │ ├── implicit-integer-sign-change.c │ │ ├── implicit-signed-integer-truncation-or-sign-change.c │ │ ├── implicit-signed-integer-truncation.c │ │ ├── implicit-unsigned-integer-truncation.c │ │ ├── recover-dedup-limit.cpp │ │ ├── recover-dedup.cpp │ │ ├── test-darwin-interface.c │ │ └── uadd-overflow.cpp │ ├── lit.common.cfg │ └── lit.site.cfg.in └── xray │ ├── CMakeLists.txt │ ├── TestCases │ └── Posix │ │ ├── always-never-instrument.cc │ │ ├── arg1-arg0-logging.cc │ │ ├── arg1-logger.cc │ │ ├── arg1-logging-implicit-this.cc │ │ ├── argv0-log-file-name.cc │ │ ├── basic-filtering.cc │ │ ├── c-test.cc │ │ ├── clang-no-xray-instrument.cc │ │ ├── common-trampoline-alignment.cc │ │ ├── coverage-sample.cc │ │ ├── custom-event-handler-alignment.cc │ │ ├── custom-event-logging.cc │ │ ├── fdr-mode-inmemory.cc │ │ ├── fdr-mode-multiple.cc │ │ ├── fdr-mode.cc │ │ ├── fdr-reinit.cc │ │ ├── fdr-single-thread.cc │ │ ├── fdr-thread-order.cc │ │ ├── fixedsize-logging.cc │ │ ├── fork_basic_logging.cc │ │ ├── func-id-utils.cc │ │ ├── logging-modes.cc │ │ ├── optional-inmemory-log.cc │ │ ├── patching-unpatching.cc │ │ ├── pic_test.cc │ │ ├── profiling-multi-threaded.cc │ │ ├── profiling-single-threaded.cc │ │ └── quiet-start.cc │ ├── Unit │ └── lit.site.cfg.in │ ├── lit.cfg │ └── lit.site.cfg.in ├── unittests ├── CMakeLists.txt ├── lit.common.unit.cfg ├── lit.common.unit.configured.in └── lit_unittest_cfg_utils.py ├── utils ├── generate_netbsd_ioctls.awk └── generate_netbsd_syscalls.awk └── www ├── content.css ├── index.html ├── menu.css └── menu.html.incl /.arcconfig: -------------------------------------------------------------------------------- 1 | { 2 | "repository.callsign" : "CRT", 3 | "conduit_uri" : "https://reviews.llvm.org/" 4 | } 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | darwin_fat 3 | clang_darwin 4 | multi_arch 5 | *.sw? 6 | *.pyc 7 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | Compiler-RT 2 | ================================ 3 | 4 | This directory and its subdirectories contain source code for the compiler 5 | support routines. 6 | 7 | Compiler-RT is open source software. You may freely distribute it under the 8 | terms of the license agreement found in LICENSE.txt. 9 | 10 | ================================ 11 | 12 | -------------------------------------------------------------------------------- /lib/asan/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortIfStatementsOnASingleLine: false 3 | -------------------------------------------------------------------------------- /lib/asan/asan.syms.extra: -------------------------------------------------------------------------------- 1 | __asan_* 2 | __lsan_* 3 | __ubsan_* 4 | __sancov_* 5 | -------------------------------------------------------------------------------- /lib/asan/asan_blacklist.txt: -------------------------------------------------------------------------------- 1 | # Blacklist for AddressSanitizer. Turns off instrumentation of particular 2 | # functions or sources. Use with care. You may set location of blacklist 3 | # at compile-time using -fsanitize-blacklist= flag. 4 | 5 | # Example usage: 6 | # fun:*bad_function_name* 7 | # src:file_with_tricky_code.cc 8 | # global:*global_with_bad_access_or_initialization* 9 | # global:*global_with_initialization_issues*=init 10 | # type:*Namespace::ClassName*=init 11 | 12 | # Stack buffer overflow in VC/INCLUDE/xlocnum, see http://goo.gl/L4qqUG 13 | fun:*_Find_elem@*@std* 14 | -------------------------------------------------------------------------------- /lib/asan/asan_lock.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/lib/asan/asan_lock.h -------------------------------------------------------------------------------- /lib/asan/scripts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(ANDROID) 2 | add_compiler_rt_script(asan_device_setup) 3 | add_dependencies(asan asan_device_setup) 4 | endif() 5 | -------------------------------------------------------------------------------- /lib/asan/tests/asan_test.ignore: -------------------------------------------------------------------------------- 1 | # blacklisted functions for instrumented ASan unit test 2 | fun:*IgnoreTest* 3 | fun:*SomeOtherFunc* 4 | -------------------------------------------------------------------------------- /lib/asan/weak_symbols.txt: -------------------------------------------------------------------------------- 1 | ___asan_default_options 2 | ___asan_default_suppressions 3 | ___asan_on_error 4 | ___asan_set_shadow_00 5 | ___asan_set_shadow_f1 6 | ___asan_set_shadow_f2 7 | ___asan_set_shadow_f3 8 | ___asan_set_shadow_f4 9 | ___asan_set_shadow_f5 10 | ___asan_set_shadow_f6 11 | ___asan_set_shadow_f7 12 | ___asan_set_shadow_f8 13 | -------------------------------------------------------------------------------- /lib/builtins/Darwin-excludes/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB filter_files ${CMAKE_CURRENT_SOURCE_DIR}/*.txt) 2 | foreach(filter_file ${filter_files}) 3 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${filter_file}) 4 | endforeach() 5 | -------------------------------------------------------------------------------- /lib/builtins/Darwin-excludes/ios.txt: -------------------------------------------------------------------------------- 1 | apple_versioning 2 | -------------------------------------------------------------------------------- /lib/builtins/Darwin-excludes/ios7-arm64.txt: -------------------------------------------------------------------------------- 1 | clzti2 2 | divti3 3 | fixdfti 4 | fixsfti 5 | fixunsdfti 6 | floattidf 7 | floattisf 8 | floatuntidf 9 | floatuntisf 10 | gcc_personality_v0 11 | modti3 12 | powidf2 13 | powisf2 14 | udivmodti4 15 | udivti3 16 | umodti3 17 | -------------------------------------------------------------------------------- /lib/builtins/Darwin-excludes/iossim-x86_64.txt: -------------------------------------------------------------------------------- 1 | addtf3 2 | divtf3 3 | multf3 4 | powitf2 5 | subtf3 6 | trampoline_setup 7 | addtf3 8 | divtf3 9 | multf3 10 | powitf2 11 | subtf3 12 | trampoline_setup 13 | -------------------------------------------------------------------------------- /lib/builtins/Darwin-excludes/iossim.txt: -------------------------------------------------------------------------------- 1 | apple_versioning 2 | -------------------------------------------------------------------------------- /lib/builtins/Darwin-excludes/osx-i386.txt: -------------------------------------------------------------------------------- 1 | absvti2 2 | addvti3 3 | ashlti3 4 | ashrti3 5 | clzti2 6 | cmpti2 7 | ctzti2 8 | divti3 9 | ffsti2 10 | fixdfti 11 | fixsfti 12 | fixunsdfti 13 | fixunssfti 14 | fixunsxfti 15 | fixxfti 16 | floattidf 17 | floattisf 18 | floattixf 19 | floatuntidf 20 | floatuntisf 21 | floatuntixf 22 | lshrti3 23 | modti3 24 | muloti4 25 | multi3 26 | mulvti3 27 | negti2 28 | negvti2 29 | parityti2 30 | popcountti2 31 | subvti3 32 | ucmpti2 33 | udivmodti4 34 | udivti3 35 | umodti3 36 | -------------------------------------------------------------------------------- /lib/builtins/Darwin-excludes/osx.txt: -------------------------------------------------------------------------------- 1 | apple_versioning 2 | addtf3 3 | divtf3 4 | multf3 5 | powitf2 6 | subtf3 7 | trampoline_setup 8 | -------------------------------------------------------------------------------- /lib/builtins/macho_embedded/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB filter_files ${CMAKE_CURRENT_SOURCE_DIR}/*.txt) 2 | foreach(filter_file ${filter_files}) 3 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${filter_file}) 4 | endforeach() 5 | -------------------------------------------------------------------------------- /lib/builtins/macho_embedded/arm.txt: -------------------------------------------------------------------------------- 1 | aeabi_cdcmpeq 2 | aeabi_cdrcmple 3 | aeabi_cfcmpeq 4 | aeabi_cfrcmple 5 | aeabi_dcmpeq 6 | aeabi_dcmpge 7 | aeabi_dcmpgt 8 | aeabi_dcmple 9 | aeabi_dcmplt 10 | aeabi_drsub 11 | aeabi_fcmpeq 12 | aeabi_fcmpge 13 | aeabi_fcmpgt 14 | aeabi_fcmple 15 | aeabi_fcmplt 16 | aeabi_frsub 17 | -------------------------------------------------------------------------------- /lib/builtins/macho_embedded/i386.txt: -------------------------------------------------------------------------------- 1 | i686.get_pc_thunk.eax 2 | i686.get_pc_thunk.ebp 3 | i686.get_pc_thunk.ebx 4 | i686.get_pc_thunk.ecx 5 | i686.get_pc_thunk.edi 6 | i686.get_pc_thunk.edx 7 | i686.get_pc_thunk.esi 8 | -------------------------------------------------------------------------------- /lib/builtins/macho_embedded/thumb2-64.txt: -------------------------------------------------------------------------------- 1 | sync_fetch_and_add_8 2 | sync_fetch_and_sub_8 3 | sync_fetch_and_and_8 4 | sync_fetch_and_or_8 5 | sync_fetch_and_xor_8 6 | sync_fetch_and_nand_8 7 | sync_fetch_and_max_8 8 | sync_fetch_and_umax_8 9 | sync_fetch_and_min_8 10 | sync_fetch_and_umin_8 11 | -------------------------------------------------------------------------------- /lib/builtins/macho_embedded/thumb2.txt: -------------------------------------------------------------------------------- 1 | switch16 2 | switch32 3 | switch8 4 | switchu8 5 | sync_fetch_and_add_4 6 | sync_fetch_and_sub_4 7 | sync_fetch_and_and_4 8 | sync_fetch_and_or_4 9 | sync_fetch_and_xor_4 10 | sync_fetch_and_nand_4 11 | sync_fetch_and_max_4 12 | sync_fetch_and_umax_4 13 | sync_fetch_and_min_4 14 | sync_fetch_and_umin_4 15 | -------------------------------------------------------------------------------- /lib/builtins/x86_64/floatdidf.c: -------------------------------------------------------------------------------- 1 | /* This file is distributed under the University of Illinois Open Source 2 | * License. See LICENSE.TXT for details. 3 | */ 4 | 5 | /* double __floatdidf(di_int a); */ 6 | 7 | #if defined(__x86_64__) || defined(_M_X64) 8 | 9 | #include "../int_lib.h" 10 | 11 | double __floatdidf(int64_t a) 12 | { 13 | return (double)a; 14 | } 15 | 16 | #endif /* __x86_64__ */ 17 | -------------------------------------------------------------------------------- /lib/builtins/x86_64/floatdisf.c: -------------------------------------------------------------------------------- 1 | /* This file is distributed under the University of Illinois Open Source 2 | * License. See LICENSE.TXT for details. 3 | */ 4 | 5 | #if defined(__x86_64__) || defined(_M_X64) 6 | 7 | #include "../int_lib.h" 8 | 9 | float __floatdisf(int64_t a) 10 | { 11 | return (float)a; 12 | } 13 | 14 | #endif /* __x86_64__ */ 15 | -------------------------------------------------------------------------------- /lib/builtins/x86_64/floatdixf.c: -------------------------------------------------------------------------------- 1 | /* This file is distributed under the University of Illinois Open Source 2 | * License. See LICENSE.TXT for details. 3 | */ 4 | 5 | /* long double __floatdixf(di_int a); */ 6 | 7 | #ifdef __x86_64__ 8 | 9 | #include "../int_lib.h" 10 | 11 | long double __floatdixf(int64_t a) 12 | { 13 | return (long double)a; 14 | } 15 | 16 | #endif /* __i386__ */ 17 | -------------------------------------------------------------------------------- /lib/dfsan/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortIfStatementsOnASingleLine: false 3 | -------------------------------------------------------------------------------- /lib/dfsan/dfsan.syms.extra: -------------------------------------------------------------------------------- 1 | dfsan_* 2 | __dfsan_* 3 | __dfsw_* 4 | -------------------------------------------------------------------------------- /lib/esan/esan.syms.extra: -------------------------------------------------------------------------------- 1 | __esan_init 2 | __esan_exit 3 | __esan_aligned* 4 | __esan_unaligned* 5 | -------------------------------------------------------------------------------- /lib/fuzzer/README.txt: -------------------------------------------------------------------------------- 1 | See http://llvm.org/docs/LibFuzzer.html 2 | -------------------------------------------------------------------------------- /lib/fuzzer/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LIBFUZZER_SRC_DIR=$(dirname $0) 3 | CXX="${CXX:-clang}" 4 | for f in $LIBFUZZER_SRC_DIR/*.cpp; do 5 | $CXX -g -O2 -fno-omit-frame-pointer -std=c++11 $f -c & 6 | done 7 | wait 8 | rm -f libFuzzer.a 9 | ar ru libFuzzer.a Fuzzer*.o 10 | rm -f Fuzzer*.o 11 | 12 | -------------------------------------------------------------------------------- /lib/hwasan/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortIfStatementsOnASingleLine: false 3 | -------------------------------------------------------------------------------- /lib/hwasan/hwasan.syms.extra: -------------------------------------------------------------------------------- 1 | __hwasan_* 2 | __ubsan_* 3 | -------------------------------------------------------------------------------- /lib/hwasan/hwasan_blacklist.txt: -------------------------------------------------------------------------------- 1 | # Blacklist for HWAddressSanitizer. Turns off instrumentation of particular 2 | # functions or sources. Use with care. You may set location of blacklist 3 | # at compile-time using -fsanitize-blacklist= flag. 4 | 5 | # Example usage: 6 | # fun:*bad_function_name* 7 | # src:file_with_tricky_code.cc 8 | -------------------------------------------------------------------------------- /lib/hwasan/hwasan_thread_list.cc: -------------------------------------------------------------------------------- 1 | #include "hwasan_thread_list.h" 2 | 3 | namespace __hwasan { 4 | static ALIGNED(16) char thread_list_placeholder[sizeof(HwasanThreadList)]; 5 | static HwasanThreadList *hwasan_thread_list; 6 | 7 | HwasanThreadList &hwasanThreadList() { return *hwasan_thread_list; } 8 | 9 | void InitThreadList(uptr storage, uptr size) { 10 | CHECK(hwasan_thread_list == nullptr); 11 | hwasan_thread_list = 12 | new (thread_list_placeholder) HwasanThreadList(storage, size); 13 | } 14 | 15 | } // namespace 16 | -------------------------------------------------------------------------------- /lib/interception/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortIfStatementsOnASingleLine: false 3 | -------------------------------------------------------------------------------- /lib/lsan/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortIfStatementsOnASingleLine: false 3 | -------------------------------------------------------------------------------- /lib/lsan/weak_symbols.txt: -------------------------------------------------------------------------------- 1 | ___lsan_default_options 2 | ___lsan_default_suppressions 3 | ___lsan_is_turned_off 4 | -------------------------------------------------------------------------------- /lib/msan/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortIfStatementsOnASingleLine: false 3 | -------------------------------------------------------------------------------- /lib/msan/msan.syms.extra: -------------------------------------------------------------------------------- 1 | __msan_* 2 | __ubsan_* 3 | -------------------------------------------------------------------------------- /lib/msan/msan_blacklist.txt: -------------------------------------------------------------------------------- 1 | # Blacklist for MemorySanitizer. Turns off instrumentation of particular 2 | # functions or sources. Use with care. You may set location of blacklist 3 | # at compile-time using -fsanitize-blacklist= flag. 4 | 5 | # Example usage: 6 | # fun:*bad_function_name* 7 | # src:file_with_tricky_code.cc 8 | -------------------------------------------------------------------------------- /lib/safestack/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortIfStatementsOnASingleLine: false 3 | -------------------------------------------------------------------------------- /lib/sanitizer_common/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortIfStatementsOnASingleLine: false 3 | -------------------------------------------------------------------------------- /lib/sanitizer_common/sancov_begin.S: -------------------------------------------------------------------------------- 1 | .type __start___sancov_guards,@object 2 | .globl __start___sancov_guards 3 | .section __sancov_guards,"aw",@progbits 4 | .p2align 2 5 | __start___sancov_guards: 6 | -------------------------------------------------------------------------------- /lib/sanitizer_common/sancov_end.S: -------------------------------------------------------------------------------- 1 | .type __stop___sancov_guards,@object 2 | .globl __stop___sancov_guards 3 | .section __sancov_guards,"aw",@progbits 4 | .p2align 2 5 | __stop___sancov_guards: 6 | -------------------------------------------------------------------------------- /lib/sanitizer_common/weak_symbols.txt: -------------------------------------------------------------------------------- 1 | ___sanitizer_free_hook 2 | ___sanitizer_malloc_hook 3 | ___sanitizer_report_error_summary 4 | ___sanitizer_sandbox_on_notify 5 | ___sanitizer_symbolize_code 6 | ___sanitizer_symbolize_data 7 | ___sanitizer_symbolize_demangle 8 | ___sanitizer_symbolize_flush 9 | -------------------------------------------------------------------------------- /lib/tsan/.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | AllowShortIfStatementsOnASingleLine: false 3 | -------------------------------------------------------------------------------- /lib/tsan/check_cmake.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -u 3 | set -e 4 | 5 | ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 6 | if [ -d "$ROOT/llvm-build" ]; then 7 | cd $ROOT/llvm-build 8 | else 9 | mkdir -p $ROOT/llvm-build 10 | cd $ROOT/llvm-build 11 | CC=clang CXX=clang++ cmake -G Ninja -DLLVM_ENABLE_WERROR=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON $ROOT/../../../.. 12 | fi 13 | ninja 14 | ninja check-sanitizer 15 | ninja check-tsan 16 | ninja check-asan 17 | ninja check-msan 18 | ninja check-lsan 19 | -------------------------------------------------------------------------------- /lib/tsan/rtl/tsan.syms.extra: -------------------------------------------------------------------------------- 1 | __tsan_init 2 | __tsan_flush_memory 3 | __tsan_read* 4 | __tsan_write* 5 | __tsan_vptr* 6 | __tsan_func* 7 | __tsan_atomic* 8 | __tsan_java* 9 | __tsan_unaligned* 10 | __tsan_release 11 | __tsan_acquire 12 | __tsan_mutex_create 13 | __tsan_mutex_destroy 14 | __tsan_mutex_pre_lock 15 | __tsan_mutex_post_lock 16 | __tsan_mutex_pre_unlock 17 | __tsan_mutex_post_unlock 18 | __tsan_mutex_pre_signal 19 | __tsan_mutex_post_signal 20 | __tsan_mutex_pre_divert 21 | __tsan_mutex_post_divert 22 | __ubsan_* 23 | Annotate* 24 | WTFAnnotate* 25 | RunningOnValgrind 26 | ValgrindSlowdown 27 | -------------------------------------------------------------------------------- /lib/tsan/tests/rtl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TSAN_RTL_TEST_SOURCES 2 | tsan_bench.cc 3 | tsan_mop.cc 4 | tsan_mutex.cc 5 | tsan_posix.cc 6 | tsan_string.cc 7 | tsan_test.cc 8 | tsan_thread.cc) 9 | 10 | if(UNIX) 11 | list(APPEND TSAN_RTL_TEST_SOURCES tsan_test_util_posix.cc) 12 | endif() 13 | 14 | set(TSAN_RTL_TEST_HEADERS 15 | tsan_test_util.h) 16 | 17 | add_tsan_unittest(TsanRtlTest 18 | SOURCES ${TSAN_RTL_TEST_SOURCES} 19 | HEADERS ${TSAN_RTL_TEST_HEADERS}) 20 | -------------------------------------------------------------------------------- /lib/tsan/tests/unit/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TSAN_UNIT_TEST_SOURCES 2 | tsan_clock_test.cc 3 | tsan_flags_test.cc 4 | tsan_mman_test.cc 5 | tsan_mutex_test.cc 6 | tsan_shadow_test.cc 7 | tsan_stack_test.cc 8 | tsan_sync_test.cc 9 | tsan_unit_test_main.cc) 10 | 11 | add_tsan_unittest(TsanUnitTest 12 | SOURCES ${TSAN_UNIT_TEST_SOURCES}) 13 | -------------------------------------------------------------------------------- /lib/ubsan/ubsan.syms.extra: -------------------------------------------------------------------------------- 1 | __ubsan_* 2 | -------------------------------------------------------------------------------- /lib/ubsan/weak_symbols.txt: -------------------------------------------------------------------------------- 1 | ___ubsan_default_options 2 | -------------------------------------------------------------------------------- /lib/ubsan_minimal/ubsan.syms.extra: -------------------------------------------------------------------------------- 1 | __ubsan_* 2 | -------------------------------------------------------------------------------- /lib/xray/tests/unit/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_xray_unittest(XRayTest SOURCES 2 | allocator_test.cc 3 | buffer_queue_test.cc 4 | fdr_controller_test.cc 5 | fdr_log_writer_test.cc 6 | function_call_trie_test.cc 7 | profile_collector_test.cc 8 | segmented_array_test.cc 9 | test_helpers.cc 10 | xray_unit_test_main.cc) 11 | -------------------------------------------------------------------------------- /lib/xray/weak_symbols.txt: -------------------------------------------------------------------------------- 1 | ___start_xray_fn_idx 2 | ___start_xray_instr_map 3 | ___stop_xray_fn_idx 4 | ___stop_xray_instr_map 5 | -------------------------------------------------------------------------------- /lib/xray/xray_always_instrument.txt: -------------------------------------------------------------------------------- 1 | # List of function matchers common to C/C++ applications that make sense to 2 | # always instrument. You can use this as an argument to 3 | # -fxray-always-instrument= along with your project-specific lists. 4 | 5 | # Always instrument the main function. 6 | fun:main 7 | -------------------------------------------------------------------------------- /lib/xray/xray_never_instrument.txt: -------------------------------------------------------------------------------- 1 | # List of function matchers common to C/C++ applications that make sense to 2 | # never instrument. You can use this as an argument to 3 | # -fxray-never-instrument= along with your project-specific lists. 4 | 5 | # Never instrument any function whose symbol starts with __xray. 6 | fun:__xray* 7 | -------------------------------------------------------------------------------- /lib/xray/xray_trampoline_powerpc64.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace __xray { 5 | 6 | extern std::atomic XRayPatchedFunction; 7 | 8 | // Implement this in C++ instead of assembly, to avoid dealing with ToC by hand. 9 | void CallXRayPatchedFunction(int32_t FuncId, XRayEntryType Type) { 10 | auto fptr = __xray::XRayPatchedFunction.load(); 11 | if (fptr != nullptr) 12 | (*fptr)(FuncId, Type); 13 | } 14 | 15 | } // namespace __xray 16 | -------------------------------------------------------------------------------- /test/BlocksRuntime/c99.c: -------------------------------------------------------------------------------- 1 | // 2 | // The LLVM Compiler Infrastructure 3 | // 4 | // This file is distributed under the University of Illinois Open Source 5 | // License. See LICENSE.TXT for details. 6 | 7 | // 8 | // c99.m 9 | // 10 | // CONFIG C99 rdar://problem/6399225 11 | 12 | #import 13 | #import 14 | 15 | int main(int argc, char *argv[]) { 16 | void (^blockA)(void) = ^ { ; }; 17 | blockA(); 18 | printf("%s: success\n", argv[0]); 19 | exit(0); 20 | } 21 | -------------------------------------------------------------------------------- /test/BlocksRuntime/flagsisa.c: -------------------------------------------------------------------------------- 1 | // 2 | // The LLVM Compiler Infrastructure 3 | // 4 | // This file is distributed under the University of Illinois Open Source 5 | // License. See LICENSE.TXT for details. 6 | 7 | #include 8 | 9 | /* CONFIG rdar://6310599 10 | */ 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | __block int flags; 15 | __block void *isa; 16 | 17 | ^{ flags=1; isa = (void *)isa; }; 18 | printf("%s: success\n", argv[0]); 19 | return 0; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /test/BlocksRuntime/macro.c: -------------------------------------------------------------------------------- 1 | // 2 | // The LLVM Compiler Infrastructure 3 | // 4 | // This file is distributed under the University of Illinois Open Source 5 | // License. See LICENSE.TXT for details. 6 | 7 | // CONFIG open rdar://6718399 8 | #include 9 | 10 | void foo() { 11 | void (^bbb)(void) = Block_copy(^ { 12 | int j, cnt; 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /test/BlocksRuntime/modglobal.c: -------------------------------------------------------------------------------- 1 | // 2 | // The LLVM Compiler Infrastructure 3 | // 4 | // This file is distributed under the University of Illinois Open Source 5 | // License. See LICENSE.TXT for details. 6 | #include 7 | 8 | // CONFIG 9 | 10 | int AGlobal; 11 | 12 | int main(int argc, char *argv[]) { 13 | void (^f)(void) = ^ { AGlobal++; }; 14 | 15 | printf("%s: success\n", argv[0]); 16 | return 0; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /test/BlocksRuntime/shorthandexpression.c: -------------------------------------------------------------------------------- 1 | // 2 | // The LLVM Compiler Infrastructure 3 | // 4 | // This file is distributed under the University of Illinois Open Source 5 | // License. See LICENSE.TXT for details. 6 | 7 | /* 8 | * shorthandexpression.c 9 | * testObjects 10 | * 11 | * Created by Blaine Garst on 9/16/08. 12 | * 13 | * CONFIG error: 14 | */ 15 | 16 | 17 | void foo() { 18 | void (^b)(void) = ^(void)printf("hello world\n"); 19 | } 20 | 21 | int main(int argc, char *argv[]) { 22 | printf("%s: this shouldn't compile\n", argv[0]); 23 | return 1; 24 | } 25 | -------------------------------------------------------------------------------- /test/asan/TestCases/Android/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.android != "1": 9 | config.unsupported = True 10 | 11 | config.substitutions.append( ("%device", "/data/local/tmp/Output") ) 12 | -------------------------------------------------------------------------------- /test/asan/TestCases/Darwin/asan_gen_prefixes.cc: -------------------------------------------------------------------------------- 1 | // Make sure ___asan_gen_* strings have the correct prefixes on Darwin 2 | // ("L" in __TEXT,__cstring, "l" in __TEXT,__const 3 | 4 | // RUN: %clang_asan %s -S -o %t.s 5 | // RUN: cat %t.s | FileCheck %s || exit 1 6 | 7 | // UNSUPPORTED: ios 8 | 9 | int x, y, z; 10 | int main() { return 0; } 11 | // CHECK: .section{{.*}}__TEXT,__const 12 | // CHECK: l____asan_gen_ 13 | // CHECK: .section{{.*}}__TEXT,__cstring,cstring_literals 14 | // CHECK: L____asan_gen_ 15 | // CHECK: L____asan_gen_ 16 | // CHECK: L____asan_gen_ 17 | -------------------------------------------------------------------------------- /test/asan/TestCases/Darwin/empty-section.cc: -------------------------------------------------------------------------------- 1 | // Regression test with an empty (length = 0) custom section. 2 | 3 | // RUN: %clangxx_asan -g -O0 %s -c -o %t.o 4 | // RUN: %clangxx_asan -g -O0 %t.o -o %t -sectcreate mysegment mysection /dev/null 5 | // RUN: %run %t 2>&1 | FileCheck %s 6 | 7 | #include 8 | 9 | int main() { 10 | printf("Hello, world!\n"); 11 | // CHECK: Hello, world! 12 | } 13 | -------------------------------------------------------------------------------- /test/asan/TestCases/Darwin/fclose.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_asan %s -o %t 2 | // RUN: %run %t 2>&1 | FileCheck %s 3 | 4 | #include 5 | #include 6 | 7 | int main(int argc, const char * argv[]) { 8 | fclose(NULL); 9 | fprintf(stderr, "Finished.\n"); 10 | return 0; 11 | } 12 | 13 | // CHECK: Finished. 14 | -------------------------------------------------------------------------------- /test/asan/TestCases/Darwin/getpwnam.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_asan %s -o %t 2 | // RUN: %run %t 2>&1 | FileCheck %s 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main(int argc, const char * argv[]) { 10 | getpwnam(NULL); 11 | fprintf(stderr, "Finished.\n"); 12 | return 0; 13 | } 14 | 15 | // CHECK: Finished. 16 | -------------------------------------------------------------------------------- /test/asan/TestCases/Darwin/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Darwin']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/asan/TestCases/Darwin/malloc_size_crash.mm: -------------------------------------------------------------------------------- 1 | // RUN: %clang_asan %s -o %t -framework Foundation 2 | // RUN: %run %t 2>&1 | FileCheck %s 3 | 4 | #import 5 | #include 6 | 7 | int main(int argc, char *argv[]) { 8 | id obj = @0; 9 | fprintf(stderr, "obj = %p\n", obj); 10 | size_t size = malloc_size(obj); 11 | fprintf(stderr, "size = 0x%zx\n", size); 12 | fprintf(stderr, "Done.\n"); 13 | // CHECK: Done. 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /test/asan/TestCases/Darwin/malloc_zone-protected.cc: -------------------------------------------------------------------------------- 1 | // Make sure the zones created by malloc_create_zone() are write-protected. 2 | #include 3 | #include 4 | 5 | // RUN: %clangxx_asan %s -o %t 6 | // RUN: not %run %t 2>&1 | FileCheck %s 7 | 8 | 9 | void *pwn(malloc_zone_t *unused_zone, size_t unused_size) { 10 | printf("PWNED\n"); 11 | return NULL; 12 | } 13 | 14 | int main() { 15 | malloc_zone_t *zone = malloc_create_zone(0, 0); 16 | zone->malloc = pwn; 17 | void *v = malloc_zone_malloc(zone, 1); 18 | // CHECK-NOT: PWNED 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/blacklist-extra.cc: -------------------------------------------------------------------------------- 1 | // This function is broken, but this file is blacklisted 2 | int externalBrokenFunction(int argc) { 3 | char x[10] = {0}; 4 | return x[argc * 10]; // BOOM 5 | } 6 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/echo-env.cc: -------------------------------------------------------------------------------- 1 | // Helper binary for 2 | // lit_tests/TestCases/Darwin/unset-insert-libraries-on-exec.cc 3 | // Prints the environment variable with the given name. 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]) { 8 | if (argc != 2) { 9 | printf("Usage: %s ENVNAME\n", argv[0]); 10 | exit(1); 11 | } 12 | const char *value = getenv(argv[1]); 13 | if (value) { 14 | printf("%s = %s\n", argv[1], value); 15 | } else { 16 | printf("%s not set.\n", argv[1]); 17 | } 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/init-order-atexit-extra.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class C { 4 | public: 5 | C() { value = 42; } 6 | ~C() { } 7 | int value; 8 | }; 9 | 10 | C c; 11 | 12 | void AccessC() { 13 | printf("C value: %d\n", c.value); 14 | } 15 | 16 | int main() { return 0; } 17 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/initialization-blacklist-extra.cc: -------------------------------------------------------------------------------- 1 | int zero_init() { return 0; } 2 | int badGlobal = zero_init(); 3 | int readBadGlobal() { return badGlobal; } 4 | 5 | namespace badNamespace { 6 | class BadClass { 7 | public: 8 | BadClass() { value = 0; } 9 | int value; 10 | }; 11 | // Global object with non-trivial constructor. 12 | BadClass bad_object; 13 | } // namespace badNamespace 14 | 15 | int accessBadObject() { return badNamespace::bad_object.value; } 16 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/initialization-blacklist-extra2.cc: -------------------------------------------------------------------------------- 1 | int zero_init(); 2 | int badSrcGlobal = zero_init(); 3 | int readBadSrcGlobal() { return badSrcGlobal; } 4 | 5 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/initialization-blacklist.txt: -------------------------------------------------------------------------------- 1 | global:*badGlobal*=init 2 | type:*badNamespace::BadClass*=init 3 | src:*initialization-blacklist-extra2.cc=init 4 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/initialization-bug-extra.cc: -------------------------------------------------------------------------------- 1 | // This file simply declares a dynamically initialized var by the name of 'y'. 2 | int initY() { 3 | return 5; 4 | } 5 | int y = initY(); 6 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/initialization-bug-extra2.cc: -------------------------------------------------------------------------------- 1 | // 'z' is dynamically initialized global from different TU. 2 | extern int z; 3 | int __attribute__((noinline)) initY() { 4 | return z + 1; 5 | } 6 | int y = initY(); 7 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/initialization-constexpr-extra.cc: -------------------------------------------------------------------------------- 1 | // Constexpr: 2 | int getCoolestInteger(); 3 | static int coolest_integer = getCoolestInteger(); 4 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/initialization-nobug-extra.cc: -------------------------------------------------------------------------------- 1 | // Linker initialized: 2 | int getAB(); 3 | static int ab = getAB(); 4 | // Function local statics: 5 | int countCalls(); 6 | static int one = countCalls(); 7 | // Trivial constructor, non-trivial destructor: 8 | int getStructWithDtorValue(); 9 | static int val = getStructWithDtorValue(); 10 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/lit.local.cfg: -------------------------------------------------------------------------------- 1 | # Sources in this directory are helper files for tests which test functionality 2 | # involving multiple translation units. 3 | config.suffixes = [] 4 | -------------------------------------------------------------------------------- /test/asan/TestCases/Helpers/underflow.cc: -------------------------------------------------------------------------------- 1 | int YYY[3]={1,2,3}; 2 | -------------------------------------------------------------------------------- /test/asan/TestCases/Linux/asan_default_suppressions.cc: -------------------------------------------------------------------------------- 1 | // Test that we use the suppressions from __asan_default_suppressions. 2 | // RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s 3 | extern "C" { 4 | const char *__asan_default_suppressions() { return "FooBar"; } 5 | } 6 | // CHECK: AddressSanitizer: failed to parse suppressions 7 | int main() {} 8 | -------------------------------------------------------------------------------- /test/asan/TestCases/Linux/asan_rt_confict_test-1.cc: -------------------------------------------------------------------------------- 1 | // Test that preloading dynamic runtime to statically sanitized 2 | // executable is prohibited. 3 | // 4 | // RUN: %clangxx_asan_static %s -o %t 5 | // RUN: env LD_PRELOAD=%shared_libasan not %run %t 2>&1 | FileCheck %s 6 | 7 | // REQUIRES: asan-dynamic-runtime 8 | // XFAIL: android 9 | 10 | #include 11 | int main(int argc, char **argv) { return 0; } 12 | 13 | // CHECK: Your application is linked against incompatible ASan runtimes 14 | -------------------------------------------------------------------------------- /test/asan/TestCases/Linux/leak.cc: -------------------------------------------------------------------------------- 1 | // Minimal test for LeakSanitizer+AddressSanitizer. 2 | // REQUIRES: leak-detection 3 | // 4 | // RUN: %clangxx_asan %s -o %t 5 | // RUN: %env_asan_opts=detect_leaks=1 not %run %t 2>&1 | FileCheck %s 6 | // RUN: not %run %t 2>&1 | FileCheck %s 7 | // RUN: %env_asan_opts=detect_leaks=0 %run %t 8 | #include 9 | int *t; 10 | 11 | int main(int argc, char **argv) { 12 | t = new int[argc - 1]; 13 | printf("t: %p\n", t); 14 | t = 0; 15 | } 16 | // CHECK: LeakSanitizer: detected memory leaks 17 | -------------------------------------------------------------------------------- /test/asan/TestCases/Linux/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Linux']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/asan/TestCases/Linux/long-object-path.cc: -------------------------------------------------------------------------------- 1 | // RUN: mkdir -p %T/a-long-directory-name-to-test-allocations-for-exceptions-in-_dl_lookup_symbol_x-since-glibc-2.27 2 | // RUN: %clangxx_asan -g %s -o %T/long-object-path 3 | // RUN: %run %T/a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../a-*/../long-object-path 4 | 5 | int main(void) { 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /test/asan/TestCases/Linux/rlimit_mmap_test.cc: -------------------------------------------------------------------------------- 1 | // Check that we properly report mmap failure. 2 | // RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | static volatile void *x; 9 | 10 | int main(int argc, char **argv) { 11 | struct rlimit mmap_resource_limit = { 0, 0 }; 12 | assert(0 == setrlimit(RLIMIT_AS, &mmap_resource_limit)); 13 | x = malloc(10000000); 14 | // CHECK: ERROR: Failed to mmap 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/asan/TestCases/Linux/textdomain.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_asan -O0 -g %s -o %t 2 | // RUN: %env_asan_opts=strict_string_checks=1 %run %t 3 | 4 | // Android NDK does not have libintl.h 5 | // UNSUPPORTED: android 6 | 7 | #include 8 | #include 9 | 10 | int main() { 11 | textdomain(NULL); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/asan-symbolize-bad-path.cc: -------------------------------------------------------------------------------- 1 | // Test that asan_symbolize does not hang when provided with an non-existing 2 | // path. 3 | // RUN: echo '#0 0xabcdabcd (%t/bad/path+0x1234)' | %asan_symbolize | FileCheck %s 4 | // CHECK: #0 0xabcdabcd 5 | -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/asprintf.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | // RUN: %clangxx_asan -O3 %s -o %t && %run %t 2>&1 | FileCheck %s 3 | 4 | #ifndef _GNU_SOURCE 5 | #define _GNU_SOURCE 6 | #endif 7 | 8 | #include 9 | #include 10 | 11 | int main(int argc, char **argv) { 12 | char *p; 13 | int res = asprintf(&p, "%d", argc); 14 | fprintf(stderr, "x%d %sx\n", res, p); 15 | // CHECK: x1 1x 16 | free(p); 17 | fprintf(stderr, "DONE\n"); 18 | // CHECK: DONE 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/assign_large_valloc_to_global.cc: -------------------------------------------------------------------------------- 1 | // Make sure we don't report a leak nor hang. 2 | // RUN: %clangxx_asan -O3 %s -o %t && %run %t 3 | #include 4 | #include 5 | int *p; 6 | int main() { posix_memalign((void **)&p, 4096, 1 << 20); } 7 | -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/freopen.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O0 %s -o %t && %run %t 2 | 3 | // This fails on i386 Linux due to a glibc versioned symbols mixup. 4 | // REQUIRES: asan-64-bits 5 | 6 | #include 7 | #include 8 | 9 | int main() { 10 | FILE *fp = fopen("/dev/null", "w"); 11 | assert(fp); 12 | freopen(NULL, "a", fp); 13 | fclose(fp); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/glob_test_root/aa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/asan/TestCases/Posix/glob_test_root/aa -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/glob_test_root/ab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/asan/TestCases/Posix/glob_test_root/ab -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/glob_test_root/ba: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/asan/TestCases/Posix/glob_test_root/ba -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/handle_abort_on_error.cc: -------------------------------------------------------------------------------- 1 | // Regression test: this used to abort() in SIGABRT handler in an infinite loop. 2 | // RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=handle_abort=1,abort_on_error=1 not --crash %run %t 2>&1 | FileCheck %s 3 | 4 | // UNSUPPORTED: ios 5 | 6 | #include 7 | 8 | int main() { 9 | abort(); 10 | // CHECK: ERROR: AddressSanitizer: ABRT 11 | } 12 | -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os in ['Windows']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/lto-constmerge-odr.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O3 -flto %s -o %t 2 | // RUN: %run %t 2>&1 3 | 4 | // REQUIRES: lto 5 | 6 | int main(int argc, const char * argv[]) { 7 | struct { long width, height; } a = {16, 16}; 8 | struct { long width, height; } b = {16, 16}; 9 | 10 | // Just to make sure 'a' and 'b' don't get optimized out. 11 | asm volatile("" : : "r" (&a), "r" (&b)); 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/no_asan_gen_globals.c: -------------------------------------------------------------------------------- 1 | // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 2 | // XFAIL: android 3 | // Make sure ___asan_gen_* strings do not end up in the symbol table. 4 | 5 | // RUN: %clang_asan %s -o %t.exe 6 | // RUN: nm %t.exe | FileCheck %s 7 | 8 | int x, y, z; 9 | int main() { return 0; } 10 | // CHECK-NOT: ___asan_gen_ 11 | -------------------------------------------------------------------------------- /test/asan/TestCases/Posix/strerror_r_test.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O0 %s -o %t && %run %t 2 | 3 | // Regression test for PR17138. 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | int main() { 10 | char buf[1024]; 11 | char *res = (char *)strerror_r(300, buf, sizeof(buf)); 12 | printf("%p\n", res); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/beginthreadex.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_cl_asan -O0 %s -Fe%t 2 | // RUN: %run %t 3 | 4 | #include 5 | #include 6 | 7 | unsigned WINAPI thread_proc(void *) { 8 | volatile char stack_buffer[42]; 9 | for (int i = 0; i < sizeof(stack_buffer); ++i) 10 | stack_buffer[i] = 42; 11 | return 0; 12 | } 13 | 14 | int main() { 15 | HANDLE thr = (HANDLE)_beginthreadex(NULL, 0, thread_proc, NULL, 0, NULL); 16 | if (thr == 0) 17 | return 1; 18 | if (WAIT_OBJECT_0 != WaitForSingleObject(thr, INFINITE)) 19 | return 2; 20 | CloseHandle(thr); 21 | } 22 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/bitfield.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_cl_asan -O0 %s -Fe%t 2 | // RUN: %run %t 3 | 4 | #include 5 | 6 | typedef struct _S { 7 | unsigned int bf1:1; 8 | unsigned int bf2:2; 9 | unsigned int bf3:3; 10 | unsigned int bf4:4; 11 | } S; 12 | 13 | int main(void) { 14 | S *s = (S*)malloc(sizeof(S)); 15 | s->bf1 = 1; 16 | s->bf2 = 2; 17 | s->bf3 = 3; 18 | s->bf4 = 4; 19 | free(s); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/dll_large_function.cc: -------------------------------------------------------------------------------- 1 | // Make sure we can link a DLL with large functions which would mean 2 | // functions such as __asan_loadN and __asan_storeN will be called 3 | // from the DLL. We simulate the large function with 4 | // -mllvm -asan-instrumentation-with-call-threshold=0. 5 | // RUN: %clang_cl_asan %s -c -Fo%t.obj -mllvm -asan-instrumentation-with-call-threshold=0 6 | // RUN: link /nologo /DLL /OUT:%t.dll %t.obj %asan_dll_thunk 7 | // REQUIRES: asan-static-runtime 8 | 9 | void f(long* foo, long* bar) { 10 | // One load and one store 11 | *foo = *bar; 12 | } 13 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/fuse-lld.cc: -------------------------------------------------------------------------------- 1 | // If we have LLD, see that things more or less work. 2 | // 3 | // REQUIRES: lld-available 4 | // 5 | // RUN: %clangxx_asan -O2 %s -o %t.exe -g -gcodeview -fuse-ld=lld -Wl,-debug 6 | // RUN: not %run %t.exe 2>&1 | FileCheck %s 7 | 8 | #include 9 | 10 | int main() { 11 | char *x = (char*)malloc(10 * sizeof(char)); 12 | free(x); 13 | return x[5]; 14 | // CHECK: heap-use-after-free 15 | // CHECK: free 16 | // CHECK: main{{.*}}fuse-lld.cc:[[@LINE-4]]:3 17 | // CHECK: malloc 18 | // CHECK: main{{.*}}fuse-lld.cc:[[@LINE-7]]:20 19 | } 20 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/global_const_string.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_cl_asan -O0 %s -Fe%t 2 | // RUN: %run %t | FileCheck %s 3 | 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | static const char *foo = "foobarspam"; 9 | printf("Global string is `%s`\n", foo); 10 | // CHECK: Global string is `foobarspam` 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/hello_world.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_cl_asan -O0 %s -Fe%t 2 | // RUN: %run %t | FileCheck %s 3 | 4 | #include 5 | 6 | int main() { 7 | printf("Hello, world!\n"); 8 | // CHECK: Hello, world! 9 | } 10 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | # We only run a small set of tests on Windows for now. 9 | # Override the parent directory's "unsupported" decision until we can handle 10 | # all of its tests. 11 | if root.host_os in ['Windows']: 12 | config.unsupported = False 13 | else: 14 | config.unsupported = True 15 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/oom.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_cl_asan -O0 %s -Fe%t 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | // REQUIRES: asan-32-bits 4 | 5 | #include 6 | 7 | int main() { 8 | while (true) { 9 | void *ptr = malloc(200 * 1024 * 1024); // 200MB 10 | } 11 | // CHECK: SUMMARY: AddressSanitizer: out-of-memory 12 | } 13 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/operator_delete_wrong_argument.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_cl_asan -O0 %s -Fe%t 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | 4 | #include 5 | 6 | int main() { 7 | int *x = new int[42]; 8 | delete (x + 1); 9 | // CHECK: AddressSanitizer: attempting free on address which was not malloc()-ed 10 | // CHECK: {{#0 0x.* operator delete}} 11 | // CHECK: {{#1 .* main .*operator_delete_wrong_argument.cc}}:[[@LINE-3]] 12 | } 13 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/stack_array_sanity.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_cl_asan -O0 %s -Fe%t 2 | // RUN: %run %t | FileCheck %s 3 | 4 | #include 5 | 6 | int main() { 7 | int subscript = 1; 8 | char buffer[42]; 9 | buffer[subscript] = 42; 10 | printf("OK\n"); 11 | // CHECK: OK 12 | } 13 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/use_after_return_linkage.cc: -------------------------------------------------------------------------------- 1 | // Make sure LIBCMT doesn't accidentally get added to the list of DEFAULTLIB 2 | // directives. REQUIRES: asan-dynamic-runtime 3 | // RUN: %clang_cl_asan -LD %s | FileCheck %s 4 | // CHECK: Creating library 5 | // CHECK-NOT: LIBCMT 6 | 7 | void foo(int *p) { *p = 42; } 8 | 9 | __declspec(dllexport) void bar() { 10 | int x; 11 | foo(&x); 12 | } 13 | -------------------------------------------------------------------------------- /test/asan/TestCases/Windows/windows_h.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_cl_asan -O0 %s -Fe%t 2 | // RUN: %run %t 3 | 4 | // Just make sure we can parse 5 | #include 6 | 7 | int main() {} 8 | -------------------------------------------------------------------------------- /test/asan/TestCases/alloca_safe_access.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O0 -mllvm -asan-instrument-dynamic-allocas %s -o %t 2 | // RUN: %run %t 2>&1 3 | // 4 | 5 | #include 6 | 7 | __attribute__((noinline)) void foo(int index, int len) { 8 | volatile char str[len] __attribute__((aligned(32))); 9 | assert(!(reinterpret_cast(str) & 31L)); 10 | str[index] = '1'; 11 | } 12 | 13 | int main(int argc, char **argv) { 14 | foo(4, 5); 15 | foo(39, 40); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/asan/TestCases/asan_and_llvm_coverage_test.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -coverage -O0 %s -o %t 2 | // RUN: %env_asan_opts=check_initialization_order=1 %run %t 2>&1 | FileCheck %s 3 | 4 | // We don't really support running tests using profile runtime on Windows. 5 | // UNSUPPORTED: windows-msvc 6 | 7 | // profile is disabled by default 8 | // UNSUPPORTED: netbsd 9 | #include 10 | int foo() { return 1; } 11 | int XXX = foo(); 12 | int main() { 13 | printf("PASS\n"); 14 | // CHECK: PASS 15 | } 16 | -------------------------------------------------------------------------------- /test/asan/TestCases/asan_options-help.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O0 %s -o %t 2 | // RUN: %env_asan_opts=help=1 %run %t 2>&1 | FileCheck %s 3 | 4 | int main() { 5 | } 6 | 7 | // CHECK: Available flags for AddressSanitizer: 8 | // CHECK-DAG: handle_segv 9 | // CHECK-DAG: check_initialization_order 10 | -------------------------------------------------------------------------------- /test/asan/TestCases/coverage-disabled.cc: -------------------------------------------------------------------------------- 1 | // Test that no data is collected without a runtime flag. 2 | // 3 | // RUN: rm -rf %t-dir 4 | // RUN: mkdir -p %t-dir 5 | // 6 | // RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t 7 | // 8 | // RUN: %env_asan_opts=coverage_direct=0:coverage_dir='"%t-dir"':verbosity=1 %run %t 9 | // RUN: not %sancov print %t-dir/*.sancov 2>&1 10 | // 11 | // UNSUPPORTED: android 12 | 13 | int main(int argc, char **argv) { 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /test/asan/TestCases/default_blacklist.cc: -------------------------------------------------------------------------------- 1 | // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316 2 | // XFAIL: android 3 | // UNSUPPORTED: ios 4 | // 5 | // Test that ASan uses the default blacklist from resource directory. 6 | // RUN: %clangxx_asan -### %s 2>&1 | FileCheck %s 7 | // CHECK: fsanitize-blacklist={{.*}}asan_blacklist.txt 8 | -------------------------------------------------------------------------------- /test/asan/TestCases/default_options.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O2 %s -o %t 2 | // RUN: %run %t 2>&1 | FileCheck %s 3 | 4 | // FIXME: Doesn't work with DLLs 5 | // XFAIL: win32-dynamic-asan 6 | 7 | const char *kAsanDefaultOptions="verbosity=1 help=1"; 8 | 9 | extern "C" 10 | __attribute__((no_sanitize_address)) 11 | const char *__asan_default_options() { 12 | // CHECK: Available flags for AddressSanitizer: 13 | return kAsanDefaultOptions; 14 | } 15 | 16 | int main() { 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/asan/TestCases/force_inline_opt0.cc: -------------------------------------------------------------------------------- 1 | // This test checks that we are no instrumenting a memory access twice 2 | // (before and after inlining) 3 | // RUN: %clangxx_asan -O1 %s -o %t && %run %t 4 | // RUN: %clangxx_asan -O0 %s -o %t && %run %t 5 | __attribute__((always_inline)) 6 | void foo(int *x) { 7 | *x = 0; 8 | } 9 | 10 | int main() { 11 | int x; 12 | foo(&x); 13 | return x; 14 | } 15 | -------------------------------------------------------------------------------- /test/asan/TestCases/frexp_interceptor.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s 2 | 3 | // Test the frexp() interceptor. 4 | 5 | #include 6 | #include 7 | #include 8 | int main() { 9 | double x = 3.14; 10 | int *exp = (int*)malloc(sizeof(int)); 11 | free(exp); 12 | double y = frexp(x, exp); 13 | // CHECK: use-after-free 14 | // CHECK: SUMMARY 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/asan/TestCases/global-address.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -o %t %s 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | #include 4 | 5 | int g_i = 42; 6 | int main() { 7 | // CHECK: AddressSanitizer: attempting to call __sanitizer_get_allocated_size() for pointer which is not owned 8 | // CHECK-NOT: AddressSanitizer:DEADLYSIGNAL 9 | // CHECK: SUMMARY: AddressSanitizer: bad-__sanitizer_get_allocated_size 10 | // CHECK-NOT: AddressSanitizer:DEADLYSIGNAL 11 | return (int)__sanitizer_get_allocated_size(&g_i); 12 | } 13 | -------------------------------------------------------------------------------- /test/asan/TestCases/global-demangle.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s 2 | 3 | namespace XXX { 4 | class YYY { 5 | public: 6 | static char ZZZ[]; 7 | }; 8 | char YYY::ZZZ[] = "abc"; 9 | } 10 | 11 | int main(int argc, char **argv) { 12 | return (int)XXX::YYY::ZZZ[argc + 5]; // BOOM 13 | // CHECK: {{READ of size 1 at 0x.*}} 14 | // CHECK: {{0x.* is located 2 bytes to the right of global variable}} 15 | // CHECK: 'XXX::YYY::ZZZ' {{.*}} of size 4 16 | // CHECK: 'XXX::YYY::ZZZ' is ascii string 'abc' 17 | } 18 | -------------------------------------------------------------------------------- /test/asan/TestCases/handle_noreturn_bug.cc: -------------------------------------------------------------------------------- 1 | // Regression test: __asan_handle_no_return should unpoison stack even with poison_heap=0. 2 | // RUN: %clangxx_asan -O0 %s -o %t && \ 3 | // RUN: %env_asan_opts=poison_heap=1 %run %t && \ 4 | // RUN: %env_asan_opts=poison_heap=0 %run %t 5 | 6 | #include 7 | 8 | int main(int argc, char **argv) { 9 | int x[2]; 10 | int * volatile p = &x[0]; 11 | __asan_handle_no_return(); 12 | int volatile z = p[2]; 13 | } 14 | -------------------------------------------------------------------------------- /test/asan/TestCases/huge_negative_hea_oob.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s 2 | // RUN: %clangxx_asan -O %s -o %t && not %run %t 2>&1 | FileCheck %s 3 | // Check that we can find huge buffer overflows to the left. 4 | #include 5 | #include 6 | int main(int argc, char **argv) { 7 | char *x = (char*)malloc(1 << 20); 8 | memset(x, 0, 10); 9 | int res = x[-argc * 4000]; // BOOOM 10 | // CHECK: is located 4000 bytes to the left of 11 | free(x); 12 | return res; 13 | } 14 | -------------------------------------------------------------------------------- /test/asan/TestCases/inline.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O3 %s -o %t && %run %t 2 | 3 | // Test that no_sanitize_address attribute applies even when the function would 4 | // be normally inlined. 5 | 6 | #include 7 | 8 | __attribute__((no_sanitize_address)) 9 | int f(int *p) { 10 | return *p; // BOOOM?? Nope! 11 | } 12 | 13 | int main(int argc, char **argv) { 14 | int * volatile x = (int*)malloc(2*sizeof(int) + 2); 15 | int res = f(x + 2); 16 | if (res) 17 | exit(0); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /test/asan/TestCases/interface_test.cc: -------------------------------------------------------------------------------- 1 | // Check that user may include ASan interface header. 2 | // RUN: %clang_asan %s -o %t && %run %t 3 | // RUN: %clang_asan -x c %s -o %t && %run %t 4 | // RUN: %clang %s -pie -o %t && %run %t 5 | // RUN: %clang -x c %s -pie -o %t && %run %t 6 | #include 7 | 8 | int main() { 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /test/asan/TestCases/lsan_annotations.cc: -------------------------------------------------------------------------------- 1 | // Check that LSan annotations work fine. 2 | // RUN: %clangxx_asan -O0 %s -o %t && %run %t 3 | // RUN: %clangxx_asan -O3 %s -o %t && %run %t 4 | 5 | #include 6 | #include 7 | 8 | int main() { 9 | int *x = new int; 10 | __lsan_ignore_object(x); 11 | { 12 | __lsan::ScopedDisabler disabler; 13 | double *y = new double; 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/asan/TestCases/on_error_callback.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s 2 | 3 | // FIXME: Doesn't work with DLLs 4 | // XFAIL: win32-dynamic-asan 5 | 6 | #include 7 | #include 8 | 9 | extern "C" 10 | void __asan_on_error() { 11 | fprintf(stderr, "__asan_on_error called\n"); 12 | fflush(stderr); 13 | } 14 | 15 | int main() { 16 | char *x = (char*)malloc(10 * sizeof(char)); 17 | free(x); 18 | return x[5]; 19 | // CHECK: __asan_on_error called 20 | } 21 | -------------------------------------------------------------------------------- /test/asan/TestCases/pass-struct-byval.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O0 %s -o %t 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | 4 | struct A { 5 | int a[8]; 6 | }; 7 | 8 | int bar(A *a) { 9 | int *volatile ptr = &a->a[0]; 10 | return *(ptr - 1); 11 | } 12 | 13 | void foo(A a) { 14 | bar(&a); 15 | } 16 | 17 | int main() { 18 | foo(A()); 19 | } 20 | 21 | // CHECK: ERROR: AddressSanitizer: stack-buffer-underflow 22 | // CHECK: READ of size 4 at 23 | // CHECK: is located in stack of thread 24 | -------------------------------------------------------------------------------- /test/asan/TestCases/poison_partial.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O0 %s -o %t 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | // RUN: not %run %t heap 2>&1 | FileCheck %s 4 | // RUN: %env_asan_opts=poison_partial=0 %run %t 5 | // RUN: %env_asan_opts=poison_partial=0 %run %t heap 6 | #include 7 | char g[21]; 8 | char *x; 9 | 10 | int main(int argc, char **argv) { 11 | if (argc >= 2) 12 | x = new char[21]; 13 | else 14 | x = &g[0]; 15 | memset(x, 0, 21); 16 | int *y = (int*)x; 17 | return y[5]; 18 | } 19 | // CHECK: 0 bytes to the right 20 | -------------------------------------------------------------------------------- /test/asan/TestCases/printf-m.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_asan -O2 %s -o %t && %run %t 2 | 3 | // FIXME: printf is not intercepted on Windows yet. 4 | // UNSUPPORTED: windows-msvc 5 | 6 | #include 7 | 8 | int main() { 9 | char s[5] = {'w', 'o', 'r', 'l', 'd'}; 10 | // Test that %m does not consume an argument. If it does, %s would apply to 11 | // the 5-character buffer, resulting in a stack-buffer-overflow report. 12 | printf("%m %s, %.5s\n", "hello", s); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/asan/TestCases/sleep_after_init.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_asan -O2 %s -o %t 2 | // RUN: %env_asan_opts=sleep_after_init=1 not %run %t 2>&1 | FileCheck %s 3 | 4 | #include 5 | int main() { 6 | // CHECK: Sleeping for 1 second 7 | char *x = (char*)malloc(10 * sizeof(char)); 8 | free(x); 9 | return x[5]; 10 | } 11 | -------------------------------------------------------------------------------- /test/asan/TestCases/sleep_before_dying.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_asan -O2 %s -o %t 2 | // RUN: %env_asan_opts=sleep_before_dying=1 not %run %t 2>&1 | FileCheck %s 3 | 4 | #include 5 | int main() { 6 | char *x = (char*)malloc(10 * sizeof(char)); 7 | free(x); 8 | return x[5]; 9 | // CHECK: Sleeping for 1 second 10 | } 11 | -------------------------------------------------------------------------------- /test/asan/TestCases/strip_path_prefix.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_asan -O2 %s -o %t 2 | // RUN: %env_asan_opts=strip_path_prefix='"%S/"' not %run %t 2>&1 | FileCheck %s 3 | 4 | #include 5 | int main() { 6 | char *x = (char*)malloc(10 * sizeof(char)); 7 | free(x); 8 | return x[5]; 9 | // Check that paths in error report don't start with slash. 10 | // CHECK: heap-use-after-free 11 | // CHECK: #0 0x{{.*}} in main {{.*}}strip_path_prefix.c:[[@LINE-3]] 12 | } 13 | -------------------------------------------------------------------------------- /test/asan/TestCases/use-after-scope-capture.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan %stdcxx11 -O1 -fsanitize-address-use-after-scope %s -o %t && \ 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | 4 | #include 5 | 6 | int main() { 7 | std::function f; 8 | { 9 | int x = 0; 10 | f = [&x]() { 11 | return x; // BOOM 12 | // CHECK: ERROR: AddressSanitizer: stack-use-after-scope 13 | // CHECK: #0 0x{{.*}} in {{.*}}use-after-scope-capture.cc:[[@LINE-2]] 14 | }; 15 | } 16 | return f(); // BOOM 17 | } 18 | -------------------------------------------------------------------------------- /test/asan/TestCases/use-after-scope-if.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && \ 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | 4 | int *p; 5 | bool b = true; 6 | 7 | int main() { 8 | if (b) { 9 | int x[5]; 10 | p = x+1; 11 | } 12 | return *p; // BOOM 13 | // CHECK: ERROR: AddressSanitizer: stack-use-after-scope 14 | // CHECK: #0 0x{{.*}} in main {{.*}}.cc:[[@LINE-2]] 15 | } 16 | -------------------------------------------------------------------------------- /test/asan/TestCases/use-after-scope-loop.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && \ 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | 4 | int *p[3]; 5 | 6 | int main() { 7 | for (int i = 0; i < 3; i++) { 8 | int x; 9 | p[i] = &x; 10 | } 11 | return **p; // BOOM 12 | // CHECK: ERROR: AddressSanitizer: stack-use-after-scope 13 | // CHECK: #0 0x{{.*}} in main {{.*}}.cc:[[@LINE-2]] 14 | } 15 | -------------------------------------------------------------------------------- /test/asan/TestCases/use-after-scope-nobug.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_asan -O1 -fsanitize-address-use-after-scope %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | 6 | int *p[3]; 7 | 8 | int main() { 9 | // Variable goes in and out of scope. 10 | for (int i = 0; i < 3; i++) { 11 | int x; 12 | p[i] = &x; 13 | } 14 | printf("PASSED\n"); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/builtins/TestCases/Darwin/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Darwin']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/builtins/TestCases/Darwin/os_version_check_test_no_core_foundation.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t -mmacosx-version-min=10.6 2 | // RUN: %run %t 3 | 4 | int __isOSVersionAtLeast(int Major, int Minor, int Subminor); 5 | 6 | int main() { 7 | // When CoreFoundation isn't linked, we expect the system version to be 0, 0, 8 | // 0. 9 | if (__isOSVersionAtLeast(1, 0, 0)) 10 | return 1; 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/builtins/Unit/ppc/DD.h: -------------------------------------------------------------------------------- 1 | #ifndef __DD_HEADER 2 | #define __DD_HEADER 3 | 4 | #include 5 | 6 | typedef union { 7 | long double ld; 8 | struct { 9 | double hi; 10 | double lo; 11 | }; 12 | } DD; 13 | 14 | #endif // __DD_HEADER 15 | -------------------------------------------------------------------------------- /test/builtins/Unit/ppc/test: -------------------------------------------------------------------------------- 1 | for FILE in $(ls *.c); do 2 | if gcc -arch ppc -O0 $FILE ../../../Release/ppc/libcompiler_rt.Optimized.a -mlong-double-128 3 | then 4 | echo "Testing $FILE" 5 | if ./a.out 6 | then 7 | rm ./a.out 8 | else 9 | echo "fail" 10 | # exit 1 11 | fi 12 | else 13 | echo "$FILE failed to compile" 14 | # exit 1 15 | fi 16 | done 17 | echo "pass" 18 | exit 19 | -------------------------------------------------------------------------------- /test/builtins/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | # Load common config for all compiler-rt lit tests. 4 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") 5 | 6 | # Load tool-specific config that would do the real work. 7 | lit_config.load_config(config, "@BUILTINS_LIT_SOURCE_DIR@/lit.cfg") 8 | -------------------------------------------------------------------------------- /test/cfi/README.txt: -------------------------------------------------------------------------------- 1 | The tests in this directory use a common convention for exercising the 2 | functionality associated with bit sets of different sizes. When certain 3 | macros are defined the tests instantiate classes that force the bit sets 4 | to be of certain sizes. 5 | 6 | - B32 forces 32-bit bit sets. 7 | - B64 forces 64-bit bit sets. 8 | - BM forces memory bit sets. 9 | -------------------------------------------------------------------------------- /test/cfi/bad-split.cpp: -------------------------------------------------------------------------------- 1 | // GlobalSplit used to lose type metadata for classes with virtual bases but no virtual methods. 2 | // RUN: %clangxx_cfi -o %t1 %s && %run %t1 3 | 4 | // UNSUPPORTED: windows-msvc 5 | 6 | struct Z { 7 | }; 8 | 9 | struct ZZ : public virtual Z { 10 | }; 11 | 12 | struct A : public ZZ { 13 | }; 14 | 15 | struct B : public A { 16 | }; 17 | 18 | int main() { 19 | A* a = new B(); 20 | B *b = (B*)a; 21 | } 22 | -------------------------------------------------------------------------------- /test/cfi/cross-dso/icall/lit.local.cfg: -------------------------------------------------------------------------------- 1 | # The cfi-icall checker is only supported on x86 and x86_64 for now. 2 | if config.root.host_arch not in ['x86', 'x86_64']: 3 | config.unsupported = True 4 | -------------------------------------------------------------------------------- /test/cfi/cross-dso/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Linux', 'FreeBSD', 'NetBSD']: 9 | config.unsupported = True 10 | 11 | # Android O (API level 26) has support for cross-dso cfi in libdl.so. 12 | if config.android and 'android-26' not in config.available_features: 13 | config.unsupported = True 14 | -------------------------------------------------------------------------------- /test/cfi/icall/lit.local.cfg: -------------------------------------------------------------------------------- 1 | # The cfi-icall checker is only supported on x86 and x86_64 for now. 2 | if config.root.host_arch not in ['x86', 'x86_64']: 3 | config.unsupported = True 4 | -------------------------------------------------------------------------------- /test/cfi/icall/weak.c: -------------------------------------------------------------------------------- 1 | // Test that weak symbols stay weak. 2 | // RUN: %clang_cfi -lm -o %t1 %s && %t1 3 | // XFAIL: darwin 4 | 5 | __attribute__((weak)) void does_not_exist(void); 6 | 7 | __attribute__((noinline)) 8 | void foo(void (*p)(void)) { 9 | p(); 10 | } 11 | 12 | int main(int argc, char **argv) { 13 | if (does_not_exist) 14 | foo(does_not_exist); 15 | } 16 | -------------------------------------------------------------------------------- /test/cfi/vtable-may-alias.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_cfi -o %t %s 2 | // RUN: %run %t 3 | 4 | // In this example, both __typeid_A_global_addr and __typeid_B_global_addr will 5 | // refer to the same address. Make sure that the compiler does not assume that 6 | // they do not alias. 7 | 8 | struct A { 9 | virtual void f() = 0; 10 | }; 11 | 12 | struct B : A { 13 | virtual void f() {} 14 | }; 15 | 16 | __attribute__((weak)) void foo(void *p) { 17 | B *b = (B *)p; 18 | A *a = (A *)b; 19 | a->f(); 20 | } 21 | 22 | int main() { 23 | B b; 24 | foo(&b); 25 | } 26 | -------------------------------------------------------------------------------- /test/dfsan/Inputs/flags_abilist.txt: -------------------------------------------------------------------------------- 1 | fun:f=uninstrumented 2 | 3 | fun:main=uninstrumented 4 | fun:main=discard 5 | 6 | fun:dfsan_create_label=uninstrumented 7 | fun:dfsan_create_label=discard 8 | 9 | fun:dfsan_set_label=uninstrumented 10 | fun:dfsan_set_label=discard 11 | -------------------------------------------------------------------------------- /test/dfsan/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | # Tool-specific config options. 4 | config.name_suffix = "@DFSAN_TEST_CONFIG_SUFFIX@" 5 | config.target_cflags = "@DFSAN_TEST_TARGET_CFLAGS@" 6 | config.target_arch = "@DFSAN_TEST_TARGET_ARCH@" 7 | 8 | # Load common config for all compiler-rt lit tests. 9 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") 10 | 11 | # Load tool-specific config that would do the real work. 12 | lit_config.load_config(config, "@DFSAN_LIT_TESTS_DIR@/lit.cfg") 13 | -------------------------------------------------------------------------------- /test/fuzzer/BogusInitializeTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Make sure LLVMFuzzerInitialize does not change argv[0]. 5 | #include 6 | #include 7 | 8 | extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { 9 | ***argv = 'X'; 10 | return 0; 11 | } 12 | 13 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /test/fuzzer/CleanseTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Test the fuzzer is able to 'cleanse' the reproducer 5 | // by replacing all irrelevant bytes with garbage. 6 | #include 7 | #include 8 | #include 9 | 10 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 11 | if (Size >= 20 && Data[1] == '1' && Data[5] == '5' && Data[10] == 'A' && 12 | Data[19] == 'Z') 13 | abort(); 14 | return 0; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /test/fuzzer/CounterTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Test for a fuzzer: must find the case where a particular basic block is 5 | // executed many times. 6 | #include 7 | 8 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 9 | int Num = 0; 10 | for (size_t i = 0; i < Size; i++) 11 | if (Data[i] == 'A' + i) 12 | Num++; 13 | if (Num >= 4) { 14 | std::cerr << "BINGO!\n"; 15 | exit(1); 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/fuzzer/DSO1.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Source code for a simple DSO. 5 | #ifdef _WIN32 6 | __declspec( dllexport ) 7 | #endif 8 | int DSO1(int a) { 9 | if (a < 123456) 10 | return 0; 11 | return 1; 12 | } 13 | 14 | void Uncovered1() { } 15 | -------------------------------------------------------------------------------- /test/fuzzer/DSO2.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Source code for a simple DSO. 5 | #ifdef _WIN32 6 | __declspec( dllexport ) 7 | #endif 8 | int DSO2(int a) { 9 | if (a < 3598235) 10 | return 0; 11 | return 1; 12 | } 13 | 14 | void Uncovered2() {} 15 | -------------------------------------------------------------------------------- /test/fuzzer/DSOTestExtra.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Source code for a simple DSO. 5 | 6 | int DSOTestExtra(int a) { 7 | if (a < 452345) 8 | return 0; 9 | return 1; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /test/fuzzer/DivTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Simple test for a fuzzer: find the interesting argument for div. 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | static volatile int Sink; 12 | 13 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 14 | if (Size < 4) return 0; 15 | int a; 16 | memcpy(&a, Data, 4); 17 | Sink = 12345678 / (987654 - a); 18 | return 0; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /test/fuzzer/EmptyTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | // 4 | // A fuzzer with empty target function. 5 | 6 | #include 7 | #include 8 | 9 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /test/fuzzer/GcSectionsTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Simple test for a fuzzer. 5 | // The unused function should not be present in the binary. 6 | #include 7 | #include 8 | 9 | extern "C" void UnusedFunctionShouldBeRemovedByLinker() { } 10 | 11 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /test/fuzzer/LeakTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Test with a leak. 5 | #include 6 | #include 7 | 8 | static void * volatile Sink; 9 | 10 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 11 | if (Size > 0 && *Data == 'H') { 12 | Sink = new int; 13 | Sink = nullptr; 14 | } 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /test/fuzzer/LeakTimeoutTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Test with a leak. 5 | #include 6 | #include 7 | 8 | static volatile int *Sink; 9 | 10 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 11 | if (!Size) return 0; 12 | Sink = new int; 13 | Sink = new int; 14 | while (Sink) *Sink = 0; // Infinite loop. 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /test/fuzzer/NotinstrumentedTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // This test should not be instrumented. 5 | #include 6 | #include 7 | 8 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /test/fuzzer/NthRunCrashTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Crash on the N-th execution. 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | static int Counter; 11 | 12 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 13 | if (Counter++ == 1000) { 14 | std::cout << "BINGO; Found the target, exiting\n" << std::flush; 15 | exit(1); 16 | } 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /test/fuzzer/NullDerefOnEmptyTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Simple test for a fuzzer. The fuzzer must find the empty string. 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | static volatile int *Null = 0; 11 | 12 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 13 | if (Size == 0) { 14 | std::cout << "Found the target, dereferencing NULL\n"; 15 | *Null = 1; 16 | } 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /test/fuzzer/OverwriteInputTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Simple test for a fuzzer. Make sure we abort if Data is overwritten. 5 | #include 6 | #include 7 | 8 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 9 | if (Size) 10 | *const_cast(Data) = 1; 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /test/fuzzer/SingleByteInputTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Simple test for a fuzzer, need just one byte to crash. 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 11 | if (Size > 0 && Data[Size/2] == 42) { 12 | fprintf(stderr, "BINGO\n"); 13 | abort(); 14 | } 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /test/fuzzer/SingleMemcmpTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Simple test for a fuzzer. The fuzzer must find a particular string. 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 11 | const char *S = (const char*)Data; 12 | if (Size >= 6 && !memcmp(S, "qwerty", 6)) { 13 | fprintf(stderr, "BINGO\n"); 14 | exit(1); 15 | } 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/fuzzer/SleepOneSecondTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Simple test for a fuzzer: it simply sleeps for 1 second. 5 | #include 6 | #include 7 | #include 8 | 9 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 10 | std::this_thread::sleep_for(std::chrono::seconds(1)); 11 | return 0; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /test/fuzzer/ThreadedLeakTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // The fuzzer should find a leak in a non-main thread. 5 | #include 6 | #include 7 | #include 8 | 9 | static int * volatile Sink; 10 | 11 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 12 | if (Size == 0) return 0; 13 | if (Data[0] != 'F') return 0; 14 | std::thread T([&] { Sink = new int; }); 15 | T.join(); 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /test/fuzzer/ThreeBytes.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Find FUZ 5 | #include 6 | #include 7 | #include 8 | 9 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 10 | if (Size < 3) return 0; 11 | uint32_t x = Data[0] + 251 * Data[1] + 251 * 251 * Data[2]; 12 | if (x == 'F' + 251 * 'U' + 251 * 251 * 'Z') abort(); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/fuzzer/TimeoutEmptyTest.cpp: -------------------------------------------------------------------------------- 1 | // This file is distributed under the University of Illinois Open Source 2 | // License. See LICENSE.TXT for details. 3 | 4 | // Simple test for a fuzzer. The fuzzer must find the empty string. 5 | #include 6 | #include 7 | 8 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 9 | static volatile int Zero = 0; 10 | if (!Size) 11 | while(!Zero) 12 | ; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/fuzzer/UninitializedStrlen.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | volatile size_t Sink; 5 | 6 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { 7 | if (Size < 4) return 0; 8 | if (Data[0] == 'F' && Data[1] == 'U' && Data[2] == 'Z' && Data[3] == 'Z') { 9 | char uninit[7]; 10 | Sink = strlen(uninit); 11 | } 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /test/fuzzer/acquire-crash-state.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/AcquireCrashStateTest.cpp -o %t 2 | RUN: %run %t 2>&1 | FileCheck %s 3 | CHECK-NOT: fuzz target exited 4 | -------------------------------------------------------------------------------- /test/fuzzer/bad-strcmp.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/BadStrcmpTest.cpp -o %t-BadStrcmpTest 2 | RUN: %run %t-BadStrcmpTest -runs=100000 3 | -------------------------------------------------------------------------------- /test/fuzzer/bogus-initialize.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/BogusInitializeTest.cpp -o %t-BogusInitializeTest 2 | 3 | RUN: not %run %t-BogusInitializeTest 2>&1 | FileCheck %s --check-prefix=BOGUS_INITIALIZE 4 | BOGUS_INITIALIZE: argv[0] has been modified in LLVMFuzzerInitialize 5 | -------------------------------------------------------------------------------- /test/fuzzer/buffer-overflow-on-input.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/BufferOverflowOnInput.cpp -o %t-BufferOverflowOnInput 2 | 3 | RUN: not %run %t-BufferOverflowOnInput 2>&1 | FileCheck %s --check-prefix=OOB 4 | OOB: AddressSanitizer: heap-buffer-overflow 5 | OOB: is located 0 bytes to the right of 3-byte region 6 | -------------------------------------------------------------------------------- /test/fuzzer/caller-callee.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: freebsd 2 | RUN: %cpp_compiler %S/CallerCalleeTest.cpp -o %t-CallerCalleeTest 3 | CHECK: BINGO 4 | RUN: not %run %t-CallerCalleeTest -use_value_profile=1 -cross_over=0 -seed=1 -runs=10000000 2>&1 | FileCheck %s 5 | -------------------------------------------------------------------------------- /test/fuzzer/cleanse.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/CleanseTest.cpp -o %t-CleanseTest 2 | RUN: echo -n 0123456789ABCDEFGHIZ > %t-in 3 | RUN: %run %t-CleanseTest -cleanse_crash=1 %t-in -exact_artifact_path=%t-out 4 | RUN: echo -n ' 1 5 A Z' | diff - %t-out 5 | -------------------------------------------------------------------------------- /test/fuzzer/counters.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: aarch64, ios 2 | RUN: %cpp_compiler %S/CounterTest.cpp -o %t-CounterTest 3 | RUN: not %run %t-CounterTest -max_len=6 -seed=1 -timeout=15 2>&1 | FileCheck %s --check-prefix=COUNTERS 4 | 5 | COUNTERS: INITED {{.*}} {{bits:|ft:}} 6 | COUNTERS: NEW {{.*}} {{bits:|ft:}} {{[1-9]*}} 7 | COUNTERS: NEW {{.*}} {{bits:|ft:}} {{[1-9]*}} 8 | COUNTERS: BINGO 9 | -------------------------------------------------------------------------------- /test/fuzzer/cxxstring.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: windows,freebsd 2 | 3 | RUN: %cpp_compiler %S/CxxStringEqTest.cpp -o %t-CxxStringEqTest 4 | 5 | RUN: not %run %t-CxxStringEqTest -seed=1 -runs=1000000 2>&1 | FileCheck %s 6 | CHECK: BINGO 7 | -------------------------------------------------------------------------------- /test/fuzzer/deep-recursion.test: -------------------------------------------------------------------------------- 1 | # Test that we can find a stack overflow 2 | REQUIRES: linux 3 | RUN: %cpp_compiler %S/DeepRecursionTest.cpp -o %t 4 | RUN: not %run %t -seed=1 -runs=100000000 2>&1 | FileCheck %s 5 | CHECK: ERROR: libFuzzer: deadly signal 6 | -------------------------------------------------------------------------------- /test/fuzzer/dict1.txt: -------------------------------------------------------------------------------- 1 | # Dictionary for SimpleDictionaryTest 2 | 3 | a="Elvis" 4 | b="Presley" 5 | -------------------------------------------------------------------------------- /test/fuzzer/disable-leaks.test: -------------------------------------------------------------------------------- 1 | REQUIRES: lsan 2 | UNSUPPORTED: aarch64 3 | RUN: %cpp_compiler %S/AccumulateAllocationsTest.cpp -o %t-AccumulateAllocationsTest 4 | RUN: %run %t-AccumulateAllocationsTest -detect_leaks=1 -runs=100000 2>&1 | FileCheck %s --check-prefix=ACCUMULATE_ALLOCS 5 | ACCUMULATE_ALLOCS: INFO: libFuzzer disabled leak detection after every mutation 6 | 7 | -------------------------------------------------------------------------------- /test/fuzzer/dso.test: -------------------------------------------------------------------------------- 1 | # FIXME: Disabled on Windows because -fPIC cannot be used to compile for Windows. 2 | UNSUPPORTED: windows 3 | RUN: %cpp_compiler %S/DSO1.cpp -fPIC %ld_flags_rpath_so1 -shared -o %dynamiclib1 4 | RUN: %cpp_compiler %S/DSO2.cpp -fPIC %ld_flags_rpath_so2 -shared -o %dynamiclib2 5 | RUN: %cpp_compiler %S/DSOTestMain.cpp %S/DSOTestExtra.cpp %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t-DSOTest 6 | 7 | RUN: not %run %t-DSOTest 2>&1 | FileCheck %s --check-prefix=DSO 8 | DSO: INFO: Loaded 3 modules 9 | DSO: BINGO 10 | -------------------------------------------------------------------------------- /test/fuzzer/equivalence.test: -------------------------------------------------------------------------------- 1 | REQUIRES: this-test-is-deprecated 2 | UNSUPPORTED: freebsd 3 | RUN: %cpp_compiler %S/EquivalenceATest.cpp -o %t-EquivalenceATest 4 | RUN: %cpp_compiler %S/EquivalenceBTest.cpp -o %t-EquivalenceBTest 5 | 6 | RUN: %run %t-EquivalenceATest -run_equivalence_server=EQUIV_TEST & export APID=$! 7 | RUN: sleep 3 8 | RUN: not %run %t-EquivalenceBTest -use_equivalence_server=EQUIV_TEST -max_len=4096 2>&1 | FileCheck %s 9 | CHECK: ERROR: libFuzzer: equivalence-mismatch. Sizes: {{.*}}; offset 2 10 | CHECK: SUMMARY: libFuzzer: equivalence-mismatch 11 | RUN: kill -9 $APID 12 | -------------------------------------------------------------------------------- /test/fuzzer/exit-report.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/SimpleTest.cpp -o %t-SimpleTest 2 | RUN: not %run %t-SimpleTest 2>&1 | FileCheck %s 3 | 4 | CHECK: ERROR: libFuzzer: fuzz target exited 5 | CHECK: SUMMARY: libFuzzer: fuzz target exited 6 | CHECK: Test unit written to 7 | -------------------------------------------------------------------------------- /test/fuzzer/extra-counters.test: -------------------------------------------------------------------------------- 1 | REQUIRES: linux 2 | 3 | RUN: %cpp_compiler %S/TableLookupTest.cpp -o %t-TableLookupTest 4 | RUN: not %run %t-TableLookupTest -print_final_stats=1 2>&1 | FileCheck %s 5 | CHECK: INFO: {{[0-9]+}} Extra Counters 6 | // Expecting >= 4096 new_units_added 7 | CHECK: stat::new_units_added:{{.*[4][0-9][0-9][0-9]}} 8 | -------------------------------------------------------------------------------- /test/fuzzer/full-coverage-set.test: -------------------------------------------------------------------------------- 1 | CHECK: BINGO 2 | RUN: %cpp_compiler %S/FullCoverageSetTest.cpp -o %t-FullCoverageSetTest 3 | #not %run %t-FullCoverageSetTest -timeout=15 -seed=1 -mutate_depth=2 -use_full_coverage_set=1 2>&1 | FileCheck %s 4 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-customcrossover.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/CustomCrossOverTest.cpp -o %t-CustomCrossOverTest 2 | 3 | RUN: not %run %t-CustomCrossOverTest -seed=1 -runs=1000000 2>&1 | FileCheck %s --check-prefix=CHECK_CO 4 | Disable cross_over, verify that we can't find the target w/o it. 5 | RUN: %run %t-CustomCrossOverTest -seed=1 -runs=1000000 -cross_over=0 2>&1 | FileCheck %s --check-prefix=CHECK_NO_CO 6 | 7 | CHECK_CO: In LLVMFuzzerCustomCrossover 8 | CHECK_CO: BINGO 9 | 10 | CHECK_NO_CO-NO: LLVMFuzzerCustomCrossover 11 | CHECK_NO_CO: DONE 12 | 13 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-customcrossoverandmutate.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/CustomCrossOverAndMutateTest.cpp -o %t-CustomCrossOverAndMutateTest 2 | RUN: %run %t-CustomCrossOverAndMutateTest -seed=1 -runs=100000 3 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-custommutator.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/CustomMutatorTest.cpp -o %t-CustomMutatorTest 2 | RUN: not %run %t-CustomMutatorTest 2>&1 | FileCheck %s --check-prefix=LLVMFuzzerCustomMutator 3 | LLVMFuzzerCustomMutator: In LLVMFuzzerCustomMutator 4 | LLVMFuzzerCustomMutator: BINGO 5 | 6 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-dict.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/SimpleDictionaryTest.cpp -o %t-SimpleDictionaryTest 2 | 3 | CHECK: BINGO 4 | Done1000000: Done 1000000 runs in 5 | 6 | RUN: not %run %t-SimpleDictionaryTest -dict=%S/dict1.txt -seed=1 -runs=1000003 2>&1 | FileCheck %s 7 | RUN: %run %t-SimpleDictionaryTest -seed=1 -runs=1000000 2>&1 | FileCheck %s --check-prefix=Done1000000 8 | 9 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-oom-with-profile.test: -------------------------------------------------------------------------------- 1 | REQUIRES: linux 2 | RUN: %cpp_compiler %S/OutOfMemoryTest.cpp -o %t-OutOfMemoryTest 3 | RUN: not %run %t-OutOfMemoryTest -rss_limit_mb=300 2>&1 | FileCheck %s 4 | CHECK: ERROR: libFuzzer: out-of-memory (used: {{.*}}; limit: 300Mb) 5 | CHECK: Live Heap Allocations 6 | CHECK: Test unit written to ./oom- 7 | SUMMARY: libFuzzer: out-of-memory 8 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-printcovpcs.test: -------------------------------------------------------------------------------- 1 | XFAIL: ios 2 | UNSUPPORTED: aarch64 3 | RUN: %cpp_compiler %S/SimpleTest.cpp -o %t-SimpleTest 4 | RUN: not %run %t-SimpleTest -print_pcs=1 -seed=1 2>&1 | FileCheck %s --check-prefix=PCS 5 | PCS-NOT: NEW_PC 6 | PCS:INITED 7 | PCS:NEW_PC: {{0x[a-f0-9]+}} 8 | PCS:NEW_PC: {{0x[a-f0-9]+}} 9 | PCS:NEW 10 | PCS:BINGO 11 | 12 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-runs.test: -------------------------------------------------------------------------------- 1 | RUN: mkdir -p %t 2 | RUN: %cpp_compiler %S/NthRunCrashTest.cpp -o %t-NthRunCrashTest 3 | RUN: echo abcd > %t/NthRunCrashTest.in 4 | RUN: %run %t-NthRunCrashTest %t/NthRunCrashTest.in 5 | RUN: %run %t-NthRunCrashTest %t/NthRunCrashTest.in -runs=10 6 | RUN: not %run %t-NthRunCrashTest %t/NthRunCrashTest.in -runs=10000 2>&1 | FileCheck %s 7 | RUN: rm %t/NthRunCrashTest.in 8 | CHECK: BINGO 9 | 10 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-seed.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/NullDerefTest.cpp -o %t-SimpleCmpTest 2 | RUN: %run %t-SimpleCmpTest -seed=-1 -runs=0 2>&1 | FileCheck %s --check-prefix=CHECK_SEED_MINUS_ONE 3 | CHECK_SEED_MINUS_ONE: Seed: 4294967295 4 | 5 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-threaded.test: -------------------------------------------------------------------------------- 1 | CHECK: Done 1000 runs in 2 | RUN: %cpp_compiler %S/ThreadedTest.cpp -o %t-ThreadedTest 3 | 4 | RUN: %run %t-ThreadedTest -use_traces=1 -runs=1000 2>&1 | FileCheck %s 5 | RUN: %run %t-ThreadedTest -use_traces=1 -runs=1000 2>&1 | FileCheck %s 6 | RUN: %run %t-ThreadedTest -use_traces=1 -runs=1000 2>&1 | FileCheck %s 7 | RUN: %run %t-ThreadedTest -use_traces=1 -runs=1000 2>&1 | FileCheck %s 8 | 9 | -------------------------------------------------------------------------------- /test/fuzzer/fuzzer-ubsan.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler -fsanitize=undefined -fno-sanitize-recover=all %S/SignedIntOverflowTest.cpp -o %t-SignedIntOverflowTest-Ubsan 2 | RUN: not %run %t-SignedIntOverflowTest-Ubsan 2>&1 | FileCheck %s 3 | CHECK: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' 4 | CHECK: Test unit written to ./crash- 5 | 6 | -------------------------------------------------------------------------------- /test/fuzzer/hi.txt: -------------------------------------------------------------------------------- 1 | Hi! -------------------------------------------------------------------------------- /test/fuzzer/initialize.test: -------------------------------------------------------------------------------- 1 | CHECK: BINGO 2 | RUN: %cpp_compiler %S/InitializeTest.cpp -o %t-InitializeTest 3 | RUN: not %run %t-InitializeTest -use_value_profile=1 2>&1 | FileCheck %s 4 | -------------------------------------------------------------------------------- /test/fuzzer/max-number-of-runs.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/AccumulateAllocationsTest.cpp -o %t-AccumulateAllocationsTest 2 | 3 | RUN: %run %t-AccumulateAllocationsTest -seed=1 -runs=2 2>&1 | FileCheck %s --check-prefix=CHECK1 4 | CHECK1: Done 2 runs 5 | 6 | RUN: %run %t-AccumulateAllocationsTest -seed=1 -runs=3 2>&1 | FileCheck %s --check-prefix=CHECK2 7 | CHECK2: Done 3 runs 8 | 9 | RUN: %run %t-AccumulateAllocationsTest -seed=1 -runs=4 2>&1 | FileCheck %s --check-prefix=CHECK3 10 | CHECK3: Done 4 runs 11 | -------------------------------------------------------------------------------- /test/fuzzer/memcmp.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: freebsd 2 | RUN: %cpp_compiler %S/MemcmpTest.cpp -o %t-MemcmpTest 3 | RUN: not %run %t-MemcmpTest -seed=1 -runs=10000000 2>&1 | FileCheck %s 4 | CHECK: BINGO 5 | -------------------------------------------------------------------------------- /test/fuzzer/memcmp64.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: freebsd 2 | RUN: %cpp_compiler %S/Memcmp64BytesTest.cpp -o %t-Memcmp64BytesTest 3 | RUN: not %run %t-Memcmp64BytesTest -seed=1 -runs=1000000 2>&1 | FileCheck %s 4 | CHECK: BINGO 5 | -------------------------------------------------------------------------------- /test/fuzzer/not-instrumented.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/NotinstrumentedTest.cpp -fsanitize-coverage=0 -o %t-NotinstrumentedTest-NoCoverage 2 | RUN: not %run %t-NotinstrumentedTest-NoCoverage 2>&1 | FileCheck %s --check-prefix=NO_COVERAGE 3 | 4 | NO_COVERAGE: ERROR: no interesting inputs were found. Is the code instrumented for coverage? Exiting 5 | -------------------------------------------------------------------------------- /test/fuzzer/null-deref-on-empty.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: windows 2 | RUN: %cpp_compiler %S/NullDerefOnEmptyTest.cpp -o %t-NullDerefOnEmptyTest 3 | 4 | RUN: not %run %t-NullDerefOnEmptyTest -print_final_stats=1 2>&1 | FileCheck %s --check-prefix=NULL_DEREF_ON_EMPTY 5 | NULL_DEREF_ON_EMPTY: stat::number_of_executed_units: 6 | -------------------------------------------------------------------------------- /test/fuzzer/overwrite-input.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/OverwriteInputTest.cpp -o %t-OverwriteInputTest 2 | RUN: not %run %t-OverwriteInputTest 2>&1 | FileCheck %s 3 | CHECK: ERROR: libFuzzer: fuzz target overwrites it's const input 4 | -------------------------------------------------------------------------------- /test/fuzzer/print-func.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: darwin, aarch64 2 | RUN: %cpp_compiler %S/PrintFuncTest.cpp -o %t 3 | RUN: %run %t -seed=1 -runs=100000 2>&1 | FileCheck %s 4 | RUN: %run %t -seed=1 -runs=100000 -print_funcs=0 2>&1 | FileCheck %s --check-prefix=NO 5 | CHECK: NEW_FUNC{{.*}} FunctionA 6 | CHECK: NEW_FUNC{{.*}} FunctionB 7 | CHECK: NEW_FUNC{{.*}} FunctionC 8 | CHECK: BINGO 9 | 10 | NO-NOT: NEW_FUNC 11 | NO: BINGO 12 | -------------------------------------------------------------------------------- /test/fuzzer/read-binary.test: -------------------------------------------------------------------------------- 1 | # Test that libFuzzer reads files properly. 2 | 3 | # Account for the fact that echo will add a trailing newline. 4 | RUN: echo -e "Hello\r\nWorld\r" > %t-testcase 5 | RUN: %cpp_compiler %S/ReadBinaryTest.cpp -o %t-fuzzer 6 | RUN: %run %t-fuzzer %t-testcase | FileCheck %s 7 | CHECK: BINGO! 8 | -------------------------------------------------------------------------------- /test/fuzzer/recommended-dictionary.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: freebsd 2 | RUN: %cpp_compiler %S/RepeatedMemcmp.cpp -o %t-RepeatedMemcmp 3 | RUN: %run %t-RepeatedMemcmp -seed=11 -runs=100000 -max_len=20 2>&1 | FileCheck %s --check-prefix=RECOMMENDED_DICT 4 | RECOMMENDED_DICT:###### Recommended dictionary. ###### 5 | RECOMMENDED_DICT-DAG: "foo" 6 | RECOMMENDED_DICT-DAG: "bar" 7 | RECOMMENDED_DICT:###### End of recommended dictionary. ###### 8 | -------------------------------------------------------------------------------- /test/fuzzer/repeated-bytes.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/RepeatedBytesTest.cpp -o %t-RepeatedBytesTest 2 | CHECK: BINGO 3 | RUN: not %run %t-RepeatedBytesTest -seed=1 -runs=1000000 2>&1 | FileCheck %s 4 | -------------------------------------------------------------------------------- /test/fuzzer/sigusr.test: -------------------------------------------------------------------------------- 1 | # FIXME: Disabled on Windows for now because of reliance on posix only features 2 | # (eg: export, "&", pkill). 3 | UNSUPPORTED: darwin, windows 4 | # Check that libFuzzer honors SIGUSR1/SIGUSR2 5 | RUN: rm -rf %t 6 | RUN: mkdir -p %t 7 | RUN: %cpp_compiler %S/SleepOneSecondTest.cpp -o %t/LFSIGUSR 8 | 9 | RUN: %run %t/LFSIGUSR 2> %t/log & export PID=$! 10 | RUN: sleep 2 11 | RUN: kill -SIGUSR1 $PID 12 | RUN: sleep 3 13 | RUN: cat %t/log | FileCheck %s 14 | 15 | CHECK: INFO: signal received, trying to exit gracefully 16 | CHECK: INFO: libFuzzer: exiting as requested 17 | -------------------------------------------------------------------------------- /test/fuzzer/simple-cmp.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/SimpleCmpTest.cpp -o %t-SimpleCmpTest 2 | 3 | RUN: not %run %t-SimpleCmpTest -seed=1 -runs=100000000 2>&1 | FileCheck %s 4 | RUN: %run %t-SimpleCmpTest -max_total_time=1 -use_cmp=0 2>&1 | FileCheck %s --check-prefix=MaxTotalTime 5 | MaxTotalTime: Done {{.*}} runs in {{.}} second(s) 6 | 7 | CHECK: BINGO 8 | -------------------------------------------------------------------------------- /test/fuzzer/simple.test: -------------------------------------------------------------------------------- 1 | CHECK: BINGO 2 | RUN: %cpp_compiler %S/SimpleTest.cpp -o %t-SimpleTest 3 | 4 | RUN: not %run %t-SimpleTest 2>&1 | FileCheck %s 5 | 6 | # only_ascii mode. Will perform some minimal self-validation. 7 | RUN: not %run %t-SimpleTest -only_ascii=1 2>&1 8 | -------------------------------------------------------------------------------- /test/fuzzer/standalone.test: -------------------------------------------------------------------------------- 1 | RUN: %no_fuzzer_c_compiler %libfuzzer_src/standalone/StandaloneFuzzTargetMain.c -c -o %t_1.o 2 | RUN: %no_fuzzer_cpp_compiler %S/InitializeTest.cpp -c -o %t_2.o 3 | 4 | RUN: %no_fuzzer_cpp_compiler %t_1.o %t_2.o -o %t-StandaloneInitializeTest 5 | RUN: %run %t-StandaloneInitializeTest %S/hi.txt %S/dict1.txt 2>&1 | FileCheck %s 6 | CHECK: StandaloneFuzzTargetMain: running 2 inputs 7 | CHECK: Done: {{.*}}hi.txt: (3 bytes) 8 | CHECK: Done: {{.*}}dict1.txt: (61 bytes) 9 | -------------------------------------------------------------------------------- /test/fuzzer/strcmp.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: freebsd 2 | RUN: %cpp_compiler %S/StrcmpTest.cpp -o %t-StrcmpTest 3 | RUN: not %run %t-StrcmpTest -seed=1 -runs=2000000 2>&1 | FileCheck %s 4 | CHECK: BINGO 5 | 6 | -------------------------------------------------------------------------------- /test/fuzzer/strncmp-oob.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/StrncmpOOBTest.cpp -o %t-StrncmpOOBTest 2 | 3 | RUN: env ASAN_OPTIONS=strict_string_checks=1 not %run %t-StrncmpOOBTest -seed=1 -runs=1000000 2>&1 | FileCheck %s --check-prefix=STRNCMP 4 | STRNCMP: AddressSanitizer: heap-buffer-overflow 5 | STRNCMP-NOT: __sanitizer_weak_hook_strncmp 6 | STRNCMP: in LLVMFuzzerTestOneInput 7 | -------------------------------------------------------------------------------- /test/fuzzer/strncmp.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: freebsd 2 | RUN: %cpp_compiler %S/StrncmpTest.cpp -o %t-StrncmpTest 3 | RUN: not %run %t-StrncmpTest -seed=2 -runs=10000000 2>&1 | FileCheck %s 4 | CHECK: BINGO 5 | 6 | -------------------------------------------------------------------------------- /test/fuzzer/strstr.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: freebsd 2 | RUN: %cpp_compiler %S/StrstrTest.cpp -o %t-StrstrTest 3 | RUN: not %run %t-StrstrTest -seed=1 -runs=2000000 2>&1 | FileCheck %s 4 | CHECK: BINGO 5 | 6 | -------------------------------------------------------------------------------- /test/fuzzer/swap-cmp.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/SwapCmpTest.cpp -o %t-SwapCmpTest 2 | CHECK: BINGO 3 | RUN: not %run %t-SwapCmpTest -seed=1 -runs=10000000 2>&1 | FileCheck %s 4 | -------------------------------------------------------------------------------- /test/fuzzer/symbolize-deadlock.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/SymbolizeDeadlock.cpp -o %t 2 | RUN: not %run %t -rss_limit_mb=20 2>&1 3 | -------------------------------------------------------------------------------- /test/fuzzer/three-bytes.test: -------------------------------------------------------------------------------- 1 | Tests -use_value_profile=2 (alternative VP metric). 2 | RUN: %cpp_compiler %S/ThreeBytes.cpp -o %t 3 | 4 | RUN: %run %t -seed=1 -runs=30000 5 | RUN: %run %t -seed=1 -runs=30000 -use_value_profile=1 6 | RUN: not %run %t -seed=1 -runs=1000000 -use_value_profile=2 2>&1 | FileCheck %s 7 | 8 | CHECK: Test unit written 9 | -------------------------------------------------------------------------------- /test/fuzzer/trace-malloc-2.test: -------------------------------------------------------------------------------- 1 | // FIXME: This test infinite loops on darwin because it crashes 2 | // printing a stack trace repeatedly 3 | UNSUPPORTED: darwin 4 | 5 | RUN: %cpp_compiler %S/TraceMallocTest.cpp -o %t-TraceMallocTest 6 | 7 | RUN: %run %t-TraceMallocTest -seed=1 -trace_malloc=2 -runs=1000 2>&1 | FileCheck %s --check-prefix=TRACE2 8 | TRACE2-DAG: FREE[0] 9 | TRACE2-DAG: MALLOC[0] 10 | TRACE2-DAG: in LLVMFuzzerTestOneInput 11 | -------------------------------------------------------------------------------- /test/fuzzer/trace-malloc.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/TraceMallocTest.cpp -o %t-TraceMallocTest 2 | 3 | RUN: %run %t-TraceMallocTest -seed=1 -trace_malloc=1 -runs=10000 2>&1 | FileCheck %s 4 | CHECK-DAG: MallocFreeTracer: STOP 0 0 (same) 5 | CHECK-DAG: MallocFreeTracer: STOP 0 1 (DIFFERENT) 6 | CHECK-DAG: MallocFreeTracer: STOP 1 0 (DIFFERENT) 7 | CHECK-DAG: MallocFreeTracer: STOP 1 1 (same) 8 | -------------------------------------------------------------------------------- /test/fuzzer/trace-pc.test: -------------------------------------------------------------------------------- 1 | RUN: %cpp_compiler %S/SimpleTest.cpp -fsanitize-coverage=0 -fsanitize-coverage=trace-pc -o %t-SimpleTest-TracePC 2 | CHECK: BINGO 3 | RUN: not %run %t-SimpleTest-TracePC -runs=1000000 -seed=1 2>&1 | FileCheck %s 4 | -------------------------------------------------------------------------------- /test/fuzzer/ulimit.test: -------------------------------------------------------------------------------- 1 | # FIXME: Disabled on Windows for now because Windows has no ulimit command. 2 | UNSUPPORTED: windows 3 | RUN: %cpp_compiler %S/SimpleTest.cpp -o %t-SimpleTest 4 | RUN: ulimit -s 1000 5 | RUN: not %run %t-SimpleTest 6 | -------------------------------------------------------------------------------- /test/fuzzer/unit/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | config.name = "LLVMFuzzer-Unittest" 4 | # Load common config for all compiler-rt unit tests. 5 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/unittests/lit.common.unit.configured") 6 | 7 | config.test_exec_root = os.path.join("@COMPILER_RT_BINARY_DIR@", 8 | "lib", "fuzzer", "tests") 9 | config.test_source_root = config.test_exec_root 10 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-cmp.test: -------------------------------------------------------------------------------- 1 | # FIXME: Disabled on Windows because of hangs. 2 | UNSUPPORTED: windows, ios 3 | CHECK: BINGO 4 | RUN: %cpp_compiler %S/SimpleCmpTest.cpp -o %t-SimpleCmpTest 5 | RUN: not %run %t-SimpleCmpTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=100000000 2>&1 | FileCheck %s 6 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-cmp2.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: ios 2 | CHECK: BINGO 3 | RUN: %cpp_compiler -fno-sanitize=address %S/SimpleHashTest.cpp -o %t-SimpleHashTest 4 | RUN: not %run %t-SimpleHashTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=100000000 -max_len=64 2>&1 | FileCheck %s 5 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-cmp3.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: ios 2 | CHECK: BINGO 3 | RUN: %cpp_compiler %S/AbsNegAndConstantTest.cpp -o %t-AbsNegAndConstantTest 4 | RUN: not %run %t-AbsNegAndConstantTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=100000000 2>&1 | FileCheck %s 5 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-cmp4.test: -------------------------------------------------------------------------------- 1 | # FIXME: Disabled on Windows because of hangs. 2 | UNSUPPORTED: windows 3 | CHECK: BINGO 4 | RUN: %cpp_compiler %S/AbsNegAndConstant64Test.cpp -o %t-AbsNegAndConstant64Test 5 | RUN: not %run %t-AbsNegAndConstant64Test -seed=1 -use_cmp=0 -use_value_profile=1 -runs=100000000 2>&1 | FileCheck %s 6 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-div.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: ios 2 | UNSUPPORTED: aarch64 3 | CHECK: AddressSanitizer: {{FPE|int-divide-by-zero}} 4 | RUN: %cpp_compiler %S/DivTest.cpp -fsanitize-coverage=trace-div -o %t-DivTest 5 | RUN: not %run %t-DivTest -seed=1 -use_value_profile=1 -runs=10000000 2>&1 | FileCheck %s 6 | 7 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-load.test: -------------------------------------------------------------------------------- 1 | # FIXME: Disabled on Windows because of hangs. 2 | UNSUPPORTED: windows 3 | CHECK: AddressSanitizer: global-buffer-overflow 4 | RUN: %cpp_compiler %S/LoadTest.cpp -fsanitize-coverage=trace-gep -o %t-LoadTest 5 | RUN: not %run %t-LoadTest -seed=2 -use_cmp=0 -use_value_profile=1 -runs=20000000 2>&1 | FileCheck %s 6 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-mem.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: ios 2 | UNSUPPORTED: freebsd 3 | CHECK: BINGO 4 | RUN: %cpp_compiler %S/SingleMemcmpTest.cpp -o %t-SingleMemcmpTest 5 | RUN: not %run %t-SingleMemcmpTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=10000000 2>&1 | FileCheck %s 6 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-set.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: ios 2 | CHECK: BINGO 3 | RUN: %cpp_compiler %S/FourIndependentBranchesTest.cpp -o %t-FourIndependentBranchesTest 4 | RUN: not %run %t-FourIndependentBranchesTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=100000000 2>&1 | FileCheck %s 5 | 6 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-strcmp.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: ios 2 | UNSUPPORTED: freebsd 3 | CHECK: BINGO 4 | RUN: %cpp_compiler %S/SingleStrcmpTest.cpp -o %t-SingleStrcmpTest 5 | RUN: not %run %t-SingleStrcmpTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=10000000 2>&1 | FileCheck %s 6 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-strncmp.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: freebsd, aarch64 2 | CHECK: BINGO 3 | RUN: %cpp_compiler %S/SingleStrncmpTest.cpp -o %t-SingleStrncmpTest 4 | RUN: not %run %t-SingleStrncmpTest -seed=1 -use_cmp=0 -use_value_profile=1 -runs=100000000 2>&1 | FileCheck %s 5 | -------------------------------------------------------------------------------- /test/fuzzer/value-profile-switch.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: ios 2 | CHECK: BINGO 3 | RUN: %cpp_compiler %S/SwitchTest.cpp -o %t-SwitchTest 4 | RUN: %cpp_compiler %S/Switch2Test.cpp -o %t-Switch2Test 5 | RUN: not %run %t-SwitchTest -use_cmp=0 -use_value_profile=1 -runs=100000000 -seed=1 2>&1 | FileCheck %s 6 | RUN: not %run %t-Switch2Test -use_cmp=0 -use_value_profile=1 -runs=100000000 -seed=1 2>&1 | FileCheck %s 7 | -------------------------------------------------------------------------------- /test/fuzzer/windows-opt-ref.test: -------------------------------------------------------------------------------- 1 | REQUIRES: windows 2 | // Verify that the linker eliminating unreferenced functions (/OPT:REF) does not 3 | // strip sancov module constructor. 4 | RUN: %cpp_compiler %S/SimpleCmpTest.cpp -o %t-SimpleCmpTest /link /OPT:REF 5 | 6 | RUN: not %run %t-SimpleCmpTest -seed=1 -runs=100000000 2>&1 | FileCheck %s 7 | 8 | CHECK-NOT: ERROR: no interesting inputs were found. Is the code instrumented for coverage? Exiting. 9 | CHECK: BINGO 10 | -------------------------------------------------------------------------------- /test/hwasan/TestCases/Linux/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Linux']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/hwasan/TestCases/Posix/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os in ['Windows']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/hwasan/TestCases/malloc-test.c: -------------------------------------------------------------------------------- 1 | // Test basic malloc functionality. 2 | // RUN: %clang_hwasan %s -o %t 3 | // RUN: %run %t 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int main() { 11 | __hwasan_enable_allocator_tagging(); 12 | char *a1 = (char*)malloc(0); 13 | assert(a1 != 0); 14 | assert(__sanitizer_get_allocated_size(a1) == 0); 15 | free(a1); 16 | } 17 | -------------------------------------------------------------------------------- /test/hwasan/TestCases/new-test.cc: -------------------------------------------------------------------------------- 1 | // Test basic new functionality. 2 | // RUN: %clangxx_hwasan %s -o %t 3 | // RUN: %run %t 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int main() { 11 | __hwasan_enable_allocator_tagging(); 12 | 13 | size_t volatile n = 0; 14 | char *a1 = new char[n]; 15 | assert(a1 != nullptr); 16 | assert(__sanitizer_get_allocated_size(a1) == 0); 17 | delete[] a1; 18 | } 19 | -------------------------------------------------------------------------------- /test/hwasan/TestCases/pthread_exit.c: -------------------------------------------------------------------------------- 1 | // Tests pthread_exit. 2 | // RUN: %clang_hwasan %s -o %t && %run %t 3 | // REQUIRES: stable-runtime 4 | #include 5 | int main() { pthread_exit(NULL); } 6 | -------------------------------------------------------------------------------- /test/hwasan/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | # Tool-specific config options. 4 | config.name_suffix = "@HWASAN_TEST_CONFIG_SUFFIX@" 5 | config.target_cflags = "@HWASAN_TEST_TARGET_CFLAGS@" 6 | config.target_arch = "@HWASAN_TEST_TARGET_ARCH@" 7 | 8 | # Load common config for all compiler-rt lit tests. 9 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") 10 | 11 | # Load tool-specific config that would do the real work. 12 | lit_config.load_config(config, "@HWASAN_LIT_SOURCE_DIR@/lit.cfg") 13 | -------------------------------------------------------------------------------- /test/lsan/TestCases/Darwin/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Darwin']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/lsan/TestCases/Linux/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Linux']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/lsan/TestCases/Posix/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os in ['Windows']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/lsan/TestCases/default_options.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_lsan -O2 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | 3 | extern "C" 4 | const char *__lsan_default_options() { 5 | // CHECK: Available flags for {{Leak|Address}}Sanitizer: 6 | return "verbosity=1 help=1"; 7 | } 8 | 9 | int main() { 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /test/lsan/TestCases/new_array_with_dtor_0.cc: -------------------------------------------------------------------------------- 1 | // Regression test: 2 | // https://code.google.com/p/address-sanitizer/issues/detail?id=257 3 | // RUN: %clangxx_lsan %s -o %t && %run %t 2>&1 | FileCheck %s 4 | 5 | #include 6 | 7 | struct T { 8 | ~T() { printf("~T\n"); } 9 | }; 10 | 11 | T *t; 12 | 13 | int main(int argc, char **argv) { 14 | t = new T[argc - 1]; 15 | printf("OK\n"); 16 | } 17 | 18 | // CHECK: OK 19 | 20 | -------------------------------------------------------------------------------- /test/lsan/TestCases/sanity_check_pure_c.c: -------------------------------------------------------------------------------- 1 | // Check that we can build C code. 2 | // RUN: %clang_lsan %s -o %t 3 | #ifdef __cplusplus 4 | #error "This test must be built in C mode" 5 | #endif 6 | 7 | int main() { 8 | // FIXME: ideally this should somehow check that we don't have libstdc++ 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /test/lsan/TestCases/strace_test.cc: -------------------------------------------------------------------------------- 1 | // Test that lsan reports a proper error when running under strace. 2 | // REQUIRES: strace 3 | // RUN: %clangxx_lsan %s -o %t 4 | // RUN: not strace -o /dev/null %run %t 2>&1 | FileCheck %s 5 | 6 | #include 7 | #include 8 | 9 | static volatile void *sink; 10 | 11 | int main() { 12 | sink = malloc(42); 13 | } 14 | // CHECK: LeakSanitizer has encountered a fatal error 15 | // CHECK: HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc) 16 | -------------------------------------------------------------------------------- /test/lsan/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | # Tool-specific config options. 4 | config.name_suffix = "@LSAN_TEST_CONFIG_SUFFIX@" 5 | config.target_cflags = "@LSAN_TEST_TARGET_CFLAGS@" 6 | config.lsan_lit_test_mode = "@LSAN_LIT_TEST_MODE@" 7 | config.target_arch = "@LSAN_TEST_TARGET_ARCH@" 8 | 9 | # Load common config for all compiler-rt lit tests. 10 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") 11 | 12 | # Load tool-specific config that would do the real work. 13 | lit_config.load_config(config, "@LSAN_LIT_SOURCE_DIR@/lit.common.cfg") 14 | -------------------------------------------------------------------------------- /test/msan/Linux/eventfd.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | int main(int argc, char *argv[]) { 9 | int efd = eventfd(42, 0); 10 | assert(efd >= 0); 11 | 12 | eventfd_t v; 13 | int ret = eventfd_read(efd, &v); 14 | assert(ret == 0); 15 | __msan_check_mem_is_initialized(&v, sizeof(v)); 16 | 17 | assert(v == 42); 18 | } 19 | -------------------------------------------------------------------------------- /test/msan/Linux/glob_test_root/aa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/msan/Linux/glob_test_root/aa -------------------------------------------------------------------------------- /test/msan/Linux/glob_test_root/ab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/msan/Linux/glob_test_root/ab -------------------------------------------------------------------------------- /test/msan/Linux/glob_test_root/ba: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/msan/Linux/glob_test_root/ba -------------------------------------------------------------------------------- /test/msan/Linux/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Linux']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/msan/Linux/mallinfo.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t 2 | // UNSUPPORTED: aarch64-target-arch 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | int main(void) { 10 | struct mallinfo mi = mallinfo(); 11 | assert(__msan_test_shadow(&mi, sizeof(mi)) == -1); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/msan/Linux/strerror_r.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_msan -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main() { 8 | char buf[1000]; 9 | char *res = strerror_r(EINVAL, buf, sizeof(buf)); 10 | assert(res); 11 | volatile int z = strlen(res); 12 | 13 | res = strerror_r(-1, buf, sizeof(buf)); 14 | assert(res); 15 | z = strlen(res); 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/msan/Linux/tcgetattr.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t %p 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int main(int argc, char *argv[]) { 11 | int fd = getpt(); 12 | assert(fd >= 0); 13 | 14 | struct termios t; 15 | int res = tcgetattr(fd, &t); 16 | assert(!res); 17 | 18 | if (t.c_iflag == 0) 19 | exit(0); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /test/msan/Linux/xattr_test_root/a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/msan/Linux/xattr_test_root/a -------------------------------------------------------------------------------- /test/msan/Unit/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | # Load common config for all compiler-rt unit tests. 4 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/unittests/lit.common.unit.configured") 5 | 6 | # Setup config name. 7 | config.name = 'MemorySanitizer-Unit' 8 | 9 | # Setup test source and exec root. For unit tests, we define 10 | # it as build directory with MSan unit tests. 11 | # FIXME: Don't use hardcoded path to MSan unit tests. 12 | config.test_exec_root = "@COMPILER_RT_BINARY_DIR@/lib/msan/tests" 13 | config.test_source_root = config.test_exec_root 14 | -------------------------------------------------------------------------------- /test/msan/__strxfrm_l.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -std=c++11 -O0 -g %s -o %t && %run %t 2 | // REQUIRES: x86_64-linux 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | extern "C" decltype(strxfrm_l) __strxfrm_l; 11 | 12 | int main(void) { 13 | char q[10]; 14 | locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0); 15 | size_t n = __strxfrm_l(q, "qwerty", sizeof(q), loc); 16 | assert(n < sizeof(q)); 17 | __msan_check_mem_is_initialized(q, n + 1); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /test/msan/c-strdup.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_msan -O0 %s -o %t && %run %t >%t.out 2>&1 2 | // RUN: %clang_msan -O1 %s -o %t && %run %t >%t.out 2>&1 3 | // RUN: %clang_msan -O2 %s -o %t && %run %t >%t.out 2>&1 4 | // RUN: %clang_msan -O3 %s -o %t && %run %t >%t.out 2>&1 5 | 6 | // Test that strdup in C programs is intercepted. 7 | // GLibC headers translate strdup to __strdup at -O1 and higher. 8 | 9 | #include 10 | #include 11 | int main(int argc, char **argv) { 12 | char buf[] = "abc"; 13 | char *p = strdup(buf); 14 | if (*p) 15 | exit(0); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/msan/check-handler.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s 2 | 3 | // Verify that CHECK handler prints a stack on CHECK fail. 4 | 5 | #include 6 | 7 | int main(void) { 8 | // Allocate chunk from the secondary allocator to trigger CHECK(IsALigned()) 9 | // in its free() path. 10 | void *p = malloc(8 << 20); 11 | free(reinterpret_cast(p) + 1); 12 | // CHECK: MemorySanitizer: bad pointer 13 | // CHECK: MemorySanitizer CHECK failed 14 | // CHECK: #0 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/msan/ctermid.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -std=c++11 -O0 %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | unsigned char s[L_ctermid + 1]; 9 | char *res = ctermid((char *)s); 10 | if (res) 11 | printf("%zd\n", strlen(res)); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/msan/default_blacklist.cc: -------------------------------------------------------------------------------- 1 | // Test that MSan uses the default blacklist from resource directory. 2 | // RUN: %clangxx_msan -### %s 2>&1 | FileCheck %s 3 | // CHECK: fsanitize-blacklist={{.*}}msan_blacklist.txt 4 | -------------------------------------------------------------------------------- /test/msan/dlerror.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main(void) { 9 | void *p = dlopen("/bad/file/name", RTLD_NOW); 10 | assert(!p); 11 | char *s = dlerror(); 12 | printf("%s, %zu\n", s, strlen(s)); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/msan/dlopen_executable.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | static int my_global; 8 | 9 | int main(void) { 10 | int *uninit = (int*)malloc(sizeof(int)); 11 | my_global = *uninit; 12 | void *p = dlopen(0, RTLD_NOW); 13 | assert(p && "failed to get handle to executable"); 14 | return my_global; 15 | // CHECK: MemorySanitizer: use-of-uninitialized-value 16 | // CHECK: #0 {{.*}} in main{{.*}}dlopen_executable.cc:[[@LINE-2]] 17 | } 18 | -------------------------------------------------------------------------------- /test/msan/errno.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main() 9 | { 10 | int x; 11 | int *volatile p = &x; 12 | errno = *p; 13 | int res = read(-1, 0, 0); 14 | assert(res == -1); 15 | if (errno) printf("errno %d\n", errno); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/msan/fstat.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | 6 | int main(void) { 7 | struct stat st; 8 | if (fstat(0, &st)) 9 | exit(1); 10 | 11 | if (S_ISBLK(st.st_mode)) 12 | exit(0); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /test/msan/ftime.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t 2 | 3 | // ftime() is deprecated on FreeBSD and NetBSD. 4 | // UNSUPPORTED: freebsd, netbsd 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | int main(void) { 12 | struct timeb tb; 13 | int res = ftime(&tb); 14 | assert(!res); 15 | assert(__msan_test_shadow(&tb, sizeof(tb)) == -1); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/msan/getloadavg.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t 2 | 3 | #define _BSD_SOURCE 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | int main(void) { 10 | double x[4]; 11 | int ret = getloadavg(x, 3); 12 | assert(ret > 0); 13 | assert(ret <= 3); 14 | assert(__msan_test_shadow(x, sizeof(double) * ret) == -1); 15 | assert(__msan_test_shadow(&x[ret], sizeof(double)) == 0); 16 | } 17 | -------------------------------------------------------------------------------- /test/msan/getutent.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t 2 | 3 | #ifndef __FreeBSD__ 4 | #include 5 | #endif 6 | #include 7 | #include 8 | 9 | int main(void) { 10 | #ifndef __FreeBSD__ 11 | setutent(); 12 | while (struct utmp *ut = getutent()) 13 | __msan_check_mem_is_initialized(ut, sizeof(*ut)); 14 | endutent(); 15 | #endif 16 | 17 | setutxent(); 18 | while (struct utmpx *utx = getutxent()) 19 | __msan_check_mem_is_initialized(utx, sizeof(*utx)); 20 | endutxent(); 21 | } 22 | -------------------------------------------------------------------------------- /test/msan/icmp_slt_allones.cc: -------------------------------------------------------------------------------- 1 | // PR24561 2 | // RUN: %clangxx_msan -O2 -g %s -o %t && %run %t 3 | 4 | #include 5 | 6 | struct A { 7 | int c1 : 7; 8 | int c8 : 1; 9 | int c9 : 1; 10 | A(); 11 | }; 12 | 13 | __attribute__((noinline)) A::A() : c8(1) {} 14 | 15 | int main() { 16 | A* a = new A(); 17 | if (a->c8 == 0) 18 | printf("zz\n"); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/msan/initgroups.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include // FreeBSD declares initgroups() here. 6 | 7 | int main(void) { 8 | initgroups("root", 0); 9 | // The above fails unless you are root. Does not matter, MSan false positive 10 | // (which we are testing for) happens anyway. 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/msan/inline.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O3 %s -o %t && %run %t 2 | 3 | // Test that no_sanitize_memory attribute applies even when the function would 4 | // be normally inlined. 5 | 6 | #include 7 | 8 | __attribute__((no_sanitize_memory)) 9 | int f(int *p) { 10 | if (*p) // BOOOM?? Nope! 11 | exit(0); 12 | return 0; 13 | } 14 | 15 | int main(int argc, char **argv) { 16 | int x; 17 | int * volatile p = &x; 18 | int res = f(p); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/msan/ioctl.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t 2 | // RUN: %clangxx_msan -O3 -g %s -o %t && %run %t 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | int main(int argc, char **argv) { 11 | int fd = socket(AF_UNIX, SOCK_DGRAM, 0); 12 | 13 | unsigned int z; 14 | int res = ioctl(fd, FIOGETOWN, &z); 15 | assert(res == 0); 16 | close(fd); 17 | if (z) 18 | exit(0); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/msan/memcmp_test.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | // RUN: MSAN_OPTIONS=intercept_memcmp=0 %run %t 4 | 5 | #include 6 | #include 7 | int main(int argc, char **argv) { 8 | char a1[4]; 9 | char a2[4]; 10 | for (int i = 0; i < argc * 3; i++) 11 | a2[i] = a1[i] = i; 12 | int res = memcmp(a1, a2, 4); 13 | if (!res) 14 | printf("equals"); 15 | return 0; 16 | // CHECK: Uninitialized bytes in __interceptor_memcmp at offset 3 17 | // CHECK: MemorySanitizer: use-of-uninitialized-value 18 | } 19 | -------------------------------------------------------------------------------- /test/msan/msan_print_shadow3.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t >%t.out 2>&1 2 | // RUN: FileCheck %s < %t.out 3 | 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | unsigned long long x = 0; // For 8-byte alignment. 9 | char x_s[4] = {0x77, 0x65, 0x43, 0x21}; 10 | __msan_partial_poison(&x, &x_s, sizeof(x_s)); 11 | __msan_print_shadow(&x, sizeof(x_s)); 12 | return 0; 13 | } 14 | 15 | // CHECK: Shadow map of [{{.*}}), 4 bytes: 16 | // CHECK: 0x{{.*}}: 77654321 ........ ........ ........ 17 | -------------------------------------------------------------------------------- /test/msan/poison_in_free.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1 2 | // FileCheck %s <%t.out 3 | // RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=poison_in_free=0 %run %t >%t.out 2>&1 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | int main(int argc, char **argv) { 10 | char *volatile x = (char*)malloc(50 * sizeof(char)); 11 | memset(x, 0, 50); 12 | free(x); 13 | return x[25]; 14 | // CHECK: MemorySanitizer: use-of-uninitialized-value 15 | // CHECK: #0 {{.*}} in main{{.*}}poison_in_free.cc:[[@LINE-2]] 16 | } 17 | -------------------------------------------------------------------------------- /test/msan/pr32842.c: -------------------------------------------------------------------------------- 1 | // Regression test for https://bugs.llvm.org/show_bug.cgi?id=32842 2 | // 3 | // RUN: %clang_msan -g %s -o %t 4 | // RUN: not %run %t 2>&1 | FileCheck %s 5 | 6 | struct iphdr { 7 | unsigned char pad1: 2, ihl:4, pad2: 2; 8 | }; 9 | 10 | int raw_send_hdrinc(unsigned long int length) { 11 | struct iphdr iph; 12 | if (iph.ihl * 4 > length) { 13 | return 1; 14 | } 15 | return 0; 16 | } 17 | 18 | int main(int argc, char *argv[]) { 19 | return raw_send_hdrinc(12); 20 | } 21 | 22 | // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value 23 | -------------------------------------------------------------------------------- /test/msan/rand_r.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t 2 | // RUN: %clangxx_msan -O0 -g -DUNINIT %s -o %t && not %run %t 2>&1 | FileCheck %s 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main(void) { 9 | unsigned seed; 10 | #ifndef UNINIT 11 | seed = 42; 12 | #endif 13 | int v = rand_r(&seed); 14 | // CHECK: MemorySanitizer: use-of-uninitialized-value 15 | // CHECK: in main{{.*}}rand_r.cc:[[@LINE-2]] 16 | if (v) printf(".\n"); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/msan/scandir_test_root/aaa: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/msan/scandir_test_root/aaa -------------------------------------------------------------------------------- /test/msan/scandir_test_root/aab: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/msan/scandir_test_root/aab -------------------------------------------------------------------------------- /test/msan/scandir_test_root/bbb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solana-labs/compiler-rt/09f92a1affb0d04f2b5bdc4d77ac1b4b0fe86379/test/msan/scandir_test_root/bbb -------------------------------------------------------------------------------- /test/msan/sem_getvalue.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | sem_t sem; 9 | int res = sem_init(&sem, 0, 42); 10 | assert(res == 0); 11 | 12 | int v; 13 | res = sem_getvalue(&sem, &v); 14 | assert(res == 0); 15 | __msan_check_mem_is_initialized(&v, sizeof(v)); 16 | assert(v == 42); 17 | 18 | res = sem_destroy(&sem); 19 | assert(res == 0); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /test/msan/setlocale.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | char *locale = setlocale (LC_ALL, ""); 9 | assert(locale); 10 | if (locale[0]) 11 | exit(0); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/msan/strerror_r-non-gnu.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_msan -std=c99 -O0 -g %s -o %t && %run %t 2 | 3 | // strerror_r under a weird set of circumstances can be redirected to 4 | // __xpg_strerror_r. Test that MSan handles this correctly. 5 | 6 | #define _POSIX_C_SOURCE 200112 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | int main() { 13 | char buf[1000]; 14 | int res = strerror_r(EINVAL, buf, sizeof(buf)); 15 | assert(!res); 16 | volatile int z = strlen(buf); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/msan/sync_lock_set_and_test.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2 | 3 | int main(void) { 4 | int i; 5 | __sync_lock_test_and_set(&i, 0); 6 | return i; 7 | } 8 | -------------------------------------------------------------------------------- /test/msan/test.h: -------------------------------------------------------------------------------- 1 | #if __LP64__ 2 | # define SANITIZER_WORDSIZE 64 3 | #else 4 | # define SANITIZER_WORDSIZE 32 5 | #endif 6 | 7 | // This is a simplified version of GetMaxVirtualAddress function. 8 | unsigned long SystemVMA () { 9 | #if SANITIZER_WORDSIZE == 64 10 | unsigned long vma = (unsigned long)__builtin_frame_address(0); 11 | return SANITIZER_WORDSIZE - __builtin_clzll(vma); 12 | #else 13 | return SANITIZER_WORDSIZE; 14 | #endif 15 | } 16 | -------------------------------------------------------------------------------- /test/msan/textdomain.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t 2 | // textdomain() is not a part of libc on FreeBSD and NetBSD. 3 | // UNSUPPORTED: netbsd, freebsd 4 | 5 | #include 6 | #include 7 | 8 | int main() { 9 | const char *td = textdomain("abcd"); 10 | if (td[0] == 0) { 11 | printf("Try read"); 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/msan/times.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | int main(void) { 10 | struct tms t; 11 | clock_t res = times(&t); 12 | assert(res != (clock_t)-1); 13 | 14 | if (t.tms_utime) printf("1\n"); 15 | if (t.tms_stime) printf("2\n"); 16 | if (t.tms_cutime) printf("3\n"); 17 | if (t.tms_cstime) printf("4\n"); 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/msan/tls_reuse.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2 | 3 | // Check that when TLS block is reused between threads, its shadow is cleaned. 4 | 5 | #include 6 | #include 7 | 8 | int __thread x; 9 | 10 | void *ThreadFn(void *) { 11 | if (!x) 12 | printf("zzz\n"); 13 | int y; 14 | int * volatile p = &y; 15 | x = *p; 16 | return 0; 17 | } 18 | 19 | int main(void) { 20 | pthread_t t; 21 | for (int i = 0; i < 100; ++i) { 22 | pthread_create(&t, 0, ThreadFn, 0); 23 | pthread_join(t, 0); 24 | } 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /test/msan/tzset.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2 | // XFAIL: freebsd 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | extern char *tzname[2]; 9 | 10 | int main(void) { 11 | if (!strlen(tzname[0]) || !strlen(tzname[1])) 12 | exit(1); 13 | tzset(); 14 | if (!strlen(tzname[0]) || !strlen(tzname[1])) 15 | exit(1); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/msan/unpoison_string.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t 2 | // RUN: %run %t 3 | // RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t 4 | // RUN: %run %t 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | int main(int argc, char **argv) { 11 | char s[20] = "string"; 12 | __msan_poison(s, sizeof(s)); 13 | __msan_unpoison_string(s); 14 | assert(__msan_test_shadow(s, sizeof(s)) == strlen("string") + 1); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/msan/vector_div.cc: -------------------------------------------------------------------------------- 1 | // Regression test for https://bugs.llvm.org/show_bug.cgi?id=37523 2 | 3 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 4 | // RUN: %clangxx_msan -O3 %s -o %t && %run %t 5 | // REQUIRES: x86_64-target-arch 6 | 7 | #include 8 | #include 9 | 10 | int main() { 11 | volatile int scale = 5; 12 | volatile auto zz = _mm_div_ps(_mm_set1_ps(255), _mm_set1_ps(scale)); 13 | assert(zz[0] == 51); 14 | assert(zz[1] == 51); 15 | assert(zz[2] == 51); 16 | assert(zz[3] == 51); 17 | } 18 | -------------------------------------------------------------------------------- /test/msan/vector_select.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_msan -O0 %s -c -o %t 2 | // RUN: %clangxx_msan -O3 %s -c -o %t 3 | 4 | // Regression test for MemorySanitizer instrumentation of a select instruction 5 | // with vector arguments. 6 | 7 | #if defined(__x86_64__) 8 | #include 9 | 10 | __m128d select(bool b, __m128d c, __m128d d) 11 | { 12 | return b ? c : d; 13 | } 14 | #elif defined (__mips64) || defined (__powerpc64__) 15 | typedef double __w64d __attribute__ ((vector_size(16))); 16 | 17 | __w64d select(bool b, __w64d c, __w64d d) 18 | { 19 | return b ? c : d; 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /test/profile/Inputs/comdat_rename.h: -------------------------------------------------------------------------------- 1 | struct FOO { 2 | FOO() : a(0), b(0) {} 3 | int callee(); 4 | __attribute__((noinline)) void caller(int n) { 5 | int r = callee(); 6 | if (r == 0) { 7 | a += n; 8 | b += 1; 9 | } 10 | } 11 | int a; 12 | int volatile b; 13 | }; 14 | -------------------------------------------------------------------------------- /test/profile/Inputs/comdat_rename_2.cc: -------------------------------------------------------------------------------- 1 | #include "comdat_rename.h" 2 | extern void test(FOO *); 3 | FOO foo; 4 | int main() { 5 | test(&foo); 6 | foo.caller(20); 7 | return 0; 8 | } 9 | 10 | // The copy of 'caller' defined in this module -- it has 11 | // 'callee' call remaining. 12 | // 13 | // CHECK-LABEL: define {{.*}}caller{{.*}} 14 | // CHECK: {{.*}} call {{.*}} 15 | // CHECK-NOT: br i1 {{.*}} 16 | // CHECK: br {{.*}}label %[[BB1:.*]], label{{.*}}!prof ![[PD1:[0-9]+]] 17 | // CHECK: {{.*}}[[BB1]]: 18 | // CHECK:![[PD1]] = !{!"branch_weights", i32 0, i32 1} 19 | -------------------------------------------------------------------------------- /test/profile/Inputs/extern_template.cpp: -------------------------------------------------------------------------------- 1 | #define DEF 2 | #include "extern_template.h" 3 | #undef DEF 4 | extern int bar(); 5 | extern int foo(); 6 | extern Test TO; 7 | int main() { 8 | foo(); 9 | int R = bar(); 10 | 11 | if (R != 10) 12 | return 1; 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/profile/Inputs/extern_template.h: -------------------------------------------------------------------------------- 1 | template struct Test { 2 | Test() : M(10) {} 3 | void doIt(int N) { // CHECK: [[@LINE]]| 2| void doIt 4 | if (N > 10) { // CHECK: [[@LINE]]| 2| if (N > 10) { 5 | M += 2; // CHECK: [[@LINE]]| 1| M += 2; 6 | } else // CHECK: [[@LINE]]| 1| } else 7 | M -= 2; // CHECK: [[@LINE]]| 1| M -= 2; 8 | } 9 | T M; 10 | }; 11 | 12 | #ifdef USE 13 | extern template struct Test; 14 | #endif 15 | #ifdef DEF 16 | template struct Test; 17 | #endif 18 | -------------------------------------------------------------------------------- /test/profile/Inputs/extern_template1.cpp: -------------------------------------------------------------------------------- 1 | #define USE 2 | #include "extern_template.h" 3 | #undef USE 4 | 5 | Test TO; 6 | int foo() { 7 | TO.doIt(20); 8 | return TO.M; 9 | } 10 | -------------------------------------------------------------------------------- /test/profile/Inputs/extern_template2.cpp: -------------------------------------------------------------------------------- 1 | #define USE 2 | #include "extern_template.h" 3 | #undef USE 4 | 5 | extern Test TO; 6 | int bar() { 7 | TO.doIt(5); 8 | return TO.M; 9 | } 10 | -------------------------------------------------------------------------------- /test/profile/Inputs/gcc-flag-compatibility.c: -------------------------------------------------------------------------------- 1 | int X = 0; 2 | 3 | int main() { 4 | int i; 5 | for (i = 0; i < 100; i++) 6 | X += i; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-comdat-1.cpp: -------------------------------------------------------------------------------- 1 | #include "instrprof-comdat.h" 2 | int g; 3 | extern int bar(int); 4 | 5 | int main() { 6 | 7 | FOO Foo; 8 | 9 | int Res = Foo.DoIt(10); 10 | 11 | if (Res > 10) 12 | g = bar(10); 13 | else 14 | g = bar(1) + bar(2); 15 | return 0; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-comdat-2.cpp: -------------------------------------------------------------------------------- 1 | #include "instrprof-comdat.h" 2 | 3 | int bar(int I) { 4 | 5 | FOO Foo; 6 | FOO Foo2; 7 | 8 | if (I > 5) 9 | return (int)Foo.DoIt(10); 10 | else 11 | return (int)Foo2.DoIt(I); 12 | } 13 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dlopen-func.c: -------------------------------------------------------------------------------- 1 | void func(int K) {} 2 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dlopen-func.c.gcov: -------------------------------------------------------------------------------- 1 | // CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-func.c 2 | // CHECK-NEXT: -: 0:Graph:instrprof-dlopen-func.gcno 3 | // CHECK-NEXT: -: 0:Data:instrprof-dlopen-func.gcda 4 | // CHECK-NEXT: -: 0:Runs:1 5 | // CHECK-NEXT: -: 0:Programs:1 6 | // CHECK-NEXT: 1: 1:void func(int K) {} 7 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dlopen-func2.c: -------------------------------------------------------------------------------- 1 | void func2(int K) {} 2 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dlopen-func2.c.gcov: -------------------------------------------------------------------------------- 1 | // CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-func2.c 2 | // CHECK-NEXT: -: 0:Graph:instrprof-dlopen-func2.gcno 3 | // CHECK-NEXT: -: 0:Data:instrprof-dlopen-func2.gcda 4 | // CHECK-NEXT: -: 0:Runs:1 5 | // CHECK-NEXT: -: 0:Programs:1 6 | // CHECK-NEXT: 1: 1:void func2(int K) {} 7 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dlopen-func3.c: -------------------------------------------------------------------------------- 1 | void func3(int K) {} 2 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dlopen-func3.c.gcov: -------------------------------------------------------------------------------- 1 | // CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-func2.c 2 | // CHECK-NEXT: -: 0:Graph:instrprof-dlopen-func2.gcno 3 | // CHECK-NEXT: -: 0:Data:instrprof-dlopen-func2.gcda 4 | // CHECK-NEXT: -: 0:Runs:1 5 | // CHECK-NEXT: -: 0:Programs:1 6 | // CHECK-NEXT: 1: 1:void func2(int K) {} 7 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dynamic-a.cpp: -------------------------------------------------------------------------------- 1 | #include "instrprof-dynamic-header.h" 2 | void a() { // COV: [[@LINE]]| 1|void a 3 | if (true) { // COV: [[@LINE]]| 1| if 4 | bar(1); // COV: [[@LINE]]| 1| bar 5 | bar(1); // COV: [[@LINE]]| 1| bar 6 | } // COV: [[@LINE]]| 1| } 7 | } 8 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dynamic-b.cpp: -------------------------------------------------------------------------------- 1 | #include "instrprof-dynamic-header.h" 2 | void b() { 3 | if (true) { 4 | bar(1); 5 | bar(1); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dynamic-header.h: -------------------------------------------------------------------------------- 1 | template void bar(int X) { 2 | if (X) { 3 | X *= 4; 4 | } 5 | } 6 | void a(); 7 | void b(); 8 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-dynamic-main.cpp: -------------------------------------------------------------------------------- 1 | #include "instrprof-dynamic-header.h" 2 | void foo(int K) { if (K) {} } 3 | int main(int argc, char *argv[]) { 4 | foo(5); 5 | bar(1); 6 | a(); 7 | b(); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-__gcov_flush-multiple.c: -------------------------------------------------------------------------------- 1 | int main(void) { 2 | __gcov_flush(); 3 | 4 | if (remove("instrprof-gcov-__gcov_flush-multiple.gcda") != 0) { 5 | return 1; 6 | } 7 | 8 | __gcov_flush(); 9 | __gcov_flush(); 10 | 11 | if (remove("instrprof-gcov-__gcov_flush-multiple.gcda") != 0) { 12 | return 1; 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c: -------------------------------------------------------------------------------- 1 | int main(void) { 2 | int i = 22; 3 | 4 | __gcov_flush(); 5 | 6 | i = 42; 7 | 8 | asm("int $3"); 9 | 10 | i = 84; 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-exceptions.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void asd(std::string i) { 4 | } 5 | 6 | int main(void) 7 | { 8 | asd("22"); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-execlp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void func1() {} 4 | void func2() {} 5 | 6 | int main(void) 7 | { 8 | func1(); 9 | 10 | execlp("ls", "-l", "-h", (char*)0); 11 | 12 | func2(); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-execvp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void func1() {} 4 | void func2() {} 5 | 6 | int main(void) 7 | { 8 | char *const args[] = {"-l", "-h", (char*)0}; 9 | 10 | func1(); 11 | 12 | execvp("ls", args); 13 | 14 | func2(); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-fork.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void func1() {} 4 | void func2() {} 5 | 6 | int main(void) 7 | { 8 | func1(); 9 | 10 | fork(); 11 | 12 | func2(); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | int var; 4 | 5 | int a = 1; 6 | if (a) { 7 | var++; 8 | } 9 | 10 | if (a) {} 11 | 12 | int b = 0; 13 | if (b) { 14 | var++; 15 | } 16 | 17 | if (b) {} 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-one-line-function.c: -------------------------------------------------------------------------------- 1 | void foo() { } 2 | 3 | void bar() { } 4 | 5 | int main(void) { 6 | foo(); 7 | 8 | bar(); 9 | 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-switch1.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | int i = 22; 4 | 5 | switch (i) { 6 | case 7: 7 | break; 8 | 9 | case 22: 10 | i = 7; 11 | break; 12 | 13 | case 42: 14 | break; 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-gcov-switch2.c: -------------------------------------------------------------------------------- 1 | int main(void) 2 | { 3 | int i = 22; 4 | 5 | switch (i) { 6 | case 7: 7 | break; 8 | 9 | case 22: 10 | i = 7; 11 | 12 | case 42: 13 | i = 22; 14 | break; 15 | } 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-icall-promo.h: -------------------------------------------------------------------------------- 1 | struct A { 2 | virtual int foo() { return 1; }; 3 | virtual int bar(); 4 | }; 5 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-icall-promo_1.cc: -------------------------------------------------------------------------------- 1 | #include "instrprof-icall-promo.h" 2 | 3 | A a; 4 | 5 | A* ap = &a; 6 | 7 | int ref(A* ap) { return ap->A::foo(); } 8 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-icall-promo_2.cc: -------------------------------------------------------------------------------- 1 | #include "instrprof-icall-promo.h" 2 | extern int ref(A *); 3 | 4 | int A::bar() { return 2; } 5 | 6 | extern A *ap; 7 | int test() { 8 | for (int i = 0; i < 10000; i++) ap->foo(); 9 | return ref(ap); 10 | } 11 | 12 | int main() { 13 | test(); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-shared-lib.c: -------------------------------------------------------------------------------- 1 | int g1 = 0; 2 | int g2 = 1; 3 | 4 | void foo(int n) { 5 | if (n % 5 == 0) 6 | g1++; 7 | else 8 | g2++; 9 | } 10 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-shared-main.c: -------------------------------------------------------------------------------- 1 | extern int g1, g2; 2 | extern void foo(int n); 3 | 4 | int main() { 5 | int i, j; 6 | for (i = 0; i < 1000; i++) 7 | for (j = 0; j < 1000; j++) 8 | foo(i * j); 9 | 10 | if (g2 - g1 == 280001) 11 | return 0; 12 | return 1; 13 | } 14 | -------------------------------------------------------------------------------- /test/profile/Inputs/instrprof-visibility-helper.cpp: -------------------------------------------------------------------------------- 1 | namespace N1 { 2 | void f4() {} 3 | } 4 | -------------------------------------------------------------------------------- /test/profile/Linux/instrprof-alloc.test: -------------------------------------------------------------------------------- 1 | // RUN: %clang_pgogen -fuse-ld=gold -Wl,-wrap,malloc -Wl,-wrap,calloc -o %t -O3 %S/../Inputs/instrprof-alloc.c 2 | // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t 3 | 4 | // RUN: %clang_pgogen -mllvm -vp-static-alloc=false -fuse-ld=gold -Wl,-wrap,malloc -Wl,-wrap,calloc -o %t.dyn -O3 %S/../Inputs/instrprof-alloc.c 5 | // RUN: env LLVM_PROFILE_FILE=%t.profraw not %run %t.dyn 6 | 7 | -------------------------------------------------------------------------------- /test/profile/Linux/instrprof-comdat.test: -------------------------------------------------------------------------------- 1 | RUN: mkdir -p %t.d 2 | RUN: %clangxx_profgen -o %t.d/comdat -fcoverage-mapping -fuse-ld=gold %S/../Inputs/instrprof-comdat-1.cpp %S/../Inputs/instrprof-comdat-2.cpp 3 | RUN: LLVM_PROFILE_FILE=%t-comdat.profraw %run %t.d/comdat 4 | RUN: llvm-profdata merge -o %t.d/comdat.prof %t-comdat.profraw 5 | RUN: llvm-cov show --path-equivalence=/tmp,%S --instr-profile=%t.d/comdat.prof %t.d/comdat | FileCheck --check-prefix=HEADER %S/../Inputs/instrprof-comdat.h 6 | 7 | -------------------------------------------------------------------------------- /test/profile/Linux/instrprof-dir.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_pgogen -o %t %s 2 | // RUN: env LLVM_PROFILE_FILE="%t.d/%m.profraw" 3 | // RUN: rm -fr %t.d 4 | // RUN: %run %t %t.d 5 | 6 | #include 7 | #include 8 | 9 | int main(int argc, char **argv) { 10 | if (access(argv[1], F_OK) == 0) 11 | return 1; // %t.d should not exist yet. 12 | return !(errno == ENOENT); 13 | } 14 | -------------------------------------------------------------------------------- /test/profile/Posix/instrprof-gcov-execlp.test: -------------------------------------------------------------------------------- 1 | RUN: mkdir -p %t.d 2 | RUN: cd %t.d 3 | 4 | RUN: %clang --coverage -o %t %S/../Inputs/instrprof-gcov-execlp.c 5 | RUN: test -f instrprof-gcov-execlp.gcno 6 | 7 | RUN: rm -f instrprof-gcov-execlp.gcda 8 | RUN: %run %t 9 | RUN: llvm-cov gcov -b -c instrprof-gcov-execlp.gcda 10 | RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-execlp.c.gcov %S/../Inputs/instrprof-gcov-execlp.c.gcov 11 | -------------------------------------------------------------------------------- /test/profile/Posix/instrprof-gcov-execvp.test: -------------------------------------------------------------------------------- 1 | RUN: mkdir -p %t.d 2 | RUN: cd %t.d 3 | 4 | RUN: %clang --coverage -o %t %S/../Inputs/instrprof-gcov-execvp.c 5 | RUN: test -f instrprof-gcov-execvp.gcno 6 | 7 | RUN: rm -f instrprof-gcov-execvp.gcda 8 | RUN: %run %t 9 | RUN: llvm-cov gcov -b -c instrprof-gcov-execvp.gcda 10 | RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-execvp.c.gcov %S/../Inputs/instrprof-gcov-execvp.c.gcov 11 | -------------------------------------------------------------------------------- /test/profile/Posix/instrprof-gcov-fork.test: -------------------------------------------------------------------------------- 1 | RUN: mkdir -p %t.d 2 | RUN: cd %t.d 3 | 4 | RUN: %clang --coverage -o %t %S/../Inputs/instrprof-gcov-fork.c 5 | RUN: test -f instrprof-gcov-fork.gcno 6 | 7 | RUN: rm -f instrprof-gcov-fork.gcda 8 | RUN: %run %t 9 | RUN: llvm-cov gcov -b -c instrprof-gcov-fork.gcda 10 | RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-fork.c.gcov %S/../Inputs/instrprof-gcov-fork.c.gcov 11 | -------------------------------------------------------------------------------- /test/profile/instrprof-error.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_profgen -o %t -O3 %s 2 | // RUN: env LLVM_PROFILE_FILE=%t/ %run %t 1 2>&1 | FileCheck %s 3 | 4 | int main(int argc, const char *argv[]) { 5 | if (argc < 2) 6 | return 1; 7 | return 0; 8 | } 9 | // CHECK: LLVM Profile Error: Failed to write file 10 | -------------------------------------------------------------------------------- /test/profile/instrprof-gcov-__gcov_flush-multiple.test: -------------------------------------------------------------------------------- 1 | RUN: mkdir -p %t.d 2 | RUN: cd %t.d 3 | 4 | RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-__gcov_flush-multiple.c 5 | RUN: test -f instrprof-gcov-__gcov_flush-multiple.gcno 6 | 7 | RUN: rm -f instrprof-gcov-__gcov_flush-multiple.gcda 8 | RUN: %run %t 9 | RUN: llvm-cov gcov instrprof-gcov-__gcov_flush-multiple.gcda 10 | RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-__gcov_flush-multiple.c.gcov %S/Inputs/instrprof-gcov-__gcov_flush-multiple.c.gcov 11 | -------------------------------------------------------------------------------- /test/profile/instrprof-gcov-__gcov_flush-terminate.test: -------------------------------------------------------------------------------- 1 | XFAIL: * 2 | 3 | RUN: mkdir -p %t.d 4 | RUN: cd %t.d 5 | 6 | RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-__gcov_flush-terminate.c 7 | RUN: test -f instrprof-gcov-__gcov_flush-terminate.gcno 8 | 9 | RUN: rm -f instrprof-gcov-__gcov_flush-terminate.gcda 10 | RUN: %expect_crash %run %t 11 | RUN: llvm-cov gcov instrprof-gcov-__gcov_flush-terminate.gcda 12 | RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-__gcov_flush-terminate.c.gcov %S/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov 13 | -------------------------------------------------------------------------------- /test/profile/instrprof-gcov-one-line-function.test: -------------------------------------------------------------------------------- 1 | RUN: mkdir -p %t.d 2 | RUN: cd %t.d 3 | 4 | RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-one-line-function.c 5 | RUN: test -f instrprof-gcov-one-line-function.gcno 6 | RUN: rm -f instrprof-gcov-one-line-function.gcda 7 | RUN: %run %t 8 | RUN: llvm-cov gcov instrprof-gcov-one-line-function.gcda 9 | RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-one-line-function.c.gcov %S/Inputs/instrprof-gcov-one-line-function.c.gcov 10 | -------------------------------------------------------------------------------- /test/profile/instrprof-merge-match.test: -------------------------------------------------------------------------------- 1 | // RUN: mkdir -p %t.d 2 | // RUN: %clang_profgen -o %t.d/libt.so -fPIC -shared %S/Inputs/instrprof-merge-match-lib.c 3 | // RUN: %clang_profgen -o %t -L %t.d -rpath %t.d %S/Inputs/instrprof-merge-match.c -lt 4 | // RUN: %run %t 5 | 6 | -------------------------------------------------------------------------------- /test/profile/instrprof-override-filename-with-env.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_profgen=%t.bad.profraw -o %t -O3 %s 2 | // RUN: env LLVM_PROFILE_FILE=%t.good.profraw %run %t %t.bad.profraw 3 | // RUN: llvm-profdata merge -o %t.profdata %t.good.profraw 4 | // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s 5 | 6 | void bar () {} 7 | int main(int argc, const char *argv[]) { 8 | // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]] 9 | if (argc < 2) 10 | return 1; 11 | bar(); 12 | return 0; 13 | } 14 | // CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2} 15 | -------------------------------------------------------------------------------- /test/profile/instrprof-set-filename-shared.test: -------------------------------------------------------------------------------- 1 | # Test that __llvm_profile_set_filename is honored by shared libary too. 2 | RUN: mkdir -p %t.d 3 | RUN: %clang_profgen=%t.shared.profraw -fPIC -shared -o %t.d/t.shared %S/Inputs/instrprof-dlopen-func.c 4 | RUN: %clang_profgen -DCALL_SHARED -o %t.m -O3 -rpath %t.d %t.d/t.shared %S/instrprof-set-filename.c 5 | RUN: %run %t.m %t.main.profraw 6 | RUN: llvm-profdata show %t.main.profraw | FileCheck --check-prefix=SHARED %s 7 | 8 | # SHARED: Total functions: 2 9 | -------------------------------------------------------------------------------- /test/profile/instrprof-version-mismatch.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_profgen -o %t -O3 %s 2 | // RUN: %run %t 1 2>&1 | FileCheck %s 3 | 4 | // override the version variable with a bogus version: 5 | unsigned long long __llvm_profile_raw_version = 10000; 6 | int main(int argc, const char *argv[]) { 7 | if (argc < 2) 8 | return 1; 9 | return 0; 10 | } 11 | // CHECK: LLVM Profile Error: Runtime and instrumentation version mismatch 12 | -------------------------------------------------------------------------------- /test/profile/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | # Tool-specific config options. 4 | config.profile_lit_binary_dir = "@PROFILE_LIT_BINARY_DIR@" 5 | config.target_cflags = "@PROFILE_TEST_TARGET_CFLAGS@" 6 | config.target_arch = "@PROFILE_TEST_TARGET_ARCH@" 7 | 8 | # Load common config for all compiler-rt lit tests. 9 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") 10 | 11 | # Load tool-specific config that would do the real work. 12 | lit_config.load_config(config, "@PROFILE_LIT_SOURCE_DIR@/lit.cfg") 13 | -------------------------------------------------------------------------------- /test/safestack/init.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_safestack %s -o %t 2 | // RUN: %run %t 3 | 4 | // Basic smoke test for the runtime library. 5 | 6 | int main(int argc, char **argv) 7 | { 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/safestack/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | # Load common config for all compiler-rt lit tests. 4 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") 5 | 6 | # Load tool-specific config that would do the real work. 7 | lit_config.load_config(config, "@SAFESTACK_LIT_SOURCE_DIR@/lit.cfg") 8 | -------------------------------------------------------------------------------- /test/safestack/lto.c: -------------------------------------------------------------------------------- 1 | // REQUIRES: lto 2 | 3 | // RUN: %clang_lto_safestack %s -o %t 4 | // RUN: %run %t 5 | 6 | // Test that safe stack works with LTO. 7 | 8 | int main() { 9 | char c[] = "hello world"; 10 | puts(c); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/safestack/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILS_H 2 | #define UTILS_H 3 | 4 | static inline void break_optimization(void *arg) { 5 | __asm__ __volatile__("" : : "r" (arg) : "memory"); 6 | } 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Darwin/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Darwin']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/aligned_alloc.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang -std=c11 -O0 %s -o %t && %run %t 2 | #include 3 | extern void *aligned_alloc (size_t alignment, size_t size); 4 | int main() { 5 | volatile void *p = aligned_alloc(128, 1024); 6 | free((void*)p); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/clock_gettime.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -Wl,-as-needed -o %t && %run %t 2 | // Regression test for PR15823 3 | // (http://llvm.org/bugs/show_bug.cgi?id=15823). 4 | #include 5 | #include 6 | 7 | int main() { 8 | struct timespec ts; 9 | clock_gettime(CLOCK_REALTIME, &ts); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/closedir.c: -------------------------------------------------------------------------------- 1 | // Check that closedir(NULL) is ok. 2 | // RUN: %clang -O2 %s -o %t && %run %t 3 | #include 4 | #include 5 | int main() { closedir(0); } 6 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/deepbind.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx %s -o %t && %run not %t 1 2>&1 | FileCheck %s 2 | // UNSUPPORTED: lsan,ubsan,android 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main (int argc, char *argv[]) { 9 | // CHECK: You are trying to dlopen a shared library with RTLD_DEEPBIND flag 10 | void *lib = dlopen("", RTLD_NOW | RTLD_DEEPBIND); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Linux']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/mallopt.cc: -------------------------------------------------------------------------------- 1 | // Check that mallopt does not return invalid values (ex. -1). 2 | // RUN: %clangxx -O2 %s -o %t && %run %t 3 | #include 4 | #include 5 | 6 | int main() { 7 | // Try a random mallopt option, possibly invalid. 8 | int res = mallopt(-42, 0); 9 | assert(res == 0 || res == 1); 10 | } 11 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/mlock_test.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2 | // XFAIL: ubsan,lsan 3 | 4 | #include 5 | #include 6 | 7 | int main() { 8 | assert(0 == mlockall(MCL_CURRENT)); 9 | assert(0 == mlock((void *)0x12345, 0x5678)); 10 | assert(0 == munlockall()); 11 | assert(0 == munlock((void *)0x987, 0x654)); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/mmap64_test.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2 | 3 | #define _LARGEFILE64_SOURCE 1 4 | 5 | #include 6 | #include 7 | 8 | int main() { 9 | char *buf = (char *)mmap64(0, 100000, PROT_READ | PROT_WRITE, 10 | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 11 | assert(buf); 12 | munmap(buf, 100000); 13 | } 14 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/sched_getparam.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | struct sched_param param; 9 | int res = sched_getparam(0, ¶m); 10 | assert(res == 0); 11 | if (param.sched_priority == 42) printf(".\n"); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Linux/unexpected_format_specifier_test.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang -w -O0 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | // UNSUPPORTED: lsan 3 | // UNSUPPORTED: msan 4 | // UNSUPPORTED: ubsan 5 | #include 6 | int main() { 7 | int a; 8 | printf("%Q\n", 1); 9 | printf("%Q\n", 1); 10 | printf("%Q\n", 1); 11 | } 12 | // CHECK: unexpected format specifier in printf interceptor: %Q (reported once per process) 13 | // CHECK-NOT: unexpected format specifier in printf interceptor 14 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/NetBSD/faccessat.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | 6 | int main(void) { return faccessat(AT_FDCWD, "/root", F_OK, 0); } 7 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/NetBSD/gid_from_group.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | 6 | int main(void) { 7 | gid_t nobody; 8 | 9 | if (gid_from_group("nobody", &nobody) == -1) 10 | exit(1); 11 | 12 | if (nobody) 13 | exit(0); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/NetBSD/group_from_gid.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | const char *nobody; 9 | 10 | if (!(nobody = group_from_gid(0, 0))) 11 | exit(1); 12 | 13 | if (strlen(nobody)) 14 | exit(0); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/NetBSD/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['NetBSD']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/NetBSD/strmode.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main(void) { 9 | struct stat st; 10 | char modep[15]; 11 | 12 | if (stat("/etc/hosts", &st)) 13 | exit(1); 14 | 15 | strmode(st.st_mode, modep); 16 | 17 | printf("%s\n", modep); 18 | 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/NetBSD/uid_from_user.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | 6 | int main(void) { 7 | uid_t nobody; 8 | 9 | if (uid_from_user("nobody", &nobody) == -1) 10 | exit(1); 11 | 12 | if (nobody) 13 | exit(0); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/NetBSD/user_from_uid.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | const char *nobody; 9 | 10 | if (!(nobody = user_from_uid(0, 0))) 11 | exit(1); 12 | 13 | if (strlen(nobody)) 14 | exit(0); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/access.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | 5 | int main(void) { return access("/dev/null", F_OK); } 6 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/devname.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s 2 | // UNSUPPORTED: linux, solaris 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main(void) { 9 | struct stat st; 10 | char *name; 11 | 12 | if (stat("/dev/null", &st)) 13 | exit(1); 14 | 15 | if (!(name = devname(st.st_rdev, S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK))) 16 | exit(1); 17 | 18 | printf("%s\n", name); 19 | 20 | // CHECK: null 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/fgetln.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2 | // UNSUPPORTED: linux 3 | 4 | #include 5 | #include 6 | 7 | int main(void) { 8 | FILE *fp; 9 | size_t len; 10 | char *s; 11 | 12 | fp = fopen("/etc/hosts", "r"); 13 | if (!fp) 14 | exit(1); 15 | 16 | s = fgetln(fp, &len); 17 | 18 | printf("%.*s\n", (int)len, s); 19 | 20 | if (fclose(fp) == EOF) 21 | exit(1); 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/fgets.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -g %s -o %t && %run %t 2 | 3 | #include 4 | 5 | int main(int argc, char **argv) { 6 | FILE *fp; 7 | char buf[2]; 8 | char *s; 9 | 10 | fp = fopen(argv[0], "r"); 11 | if (!fp) 12 | return 1; 13 | 14 | s = fgets(buf, sizeof(buf), fp); 15 | if (!s) 16 | return 2; 17 | 18 | fclose(fp); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/fputs_puts.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -g %s -o %t && %run %t | FileCheck %s 2 | // CHECK: {{^foobar$}} 3 | 4 | #include 5 | 6 | int main(void) { 7 | int r; 8 | 9 | r = fputs("foo", stdout); 10 | if (r < 0) 11 | return 1; 12 | 13 | r = puts("bar"); 14 | if (r < 0) 15 | return 1; 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/illegal_read_test.cc: -------------------------------------------------------------------------------- 1 | // Test that there was an illegal READ memory access. 2 | // RUN: %clangxx -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s 3 | 4 | // REQUIRES: stable-runtime 5 | // XFAIL: powerpc64, s390x 6 | 7 | volatile int *null = 0; 8 | volatile int a; 9 | 10 | int main(int argc, char **argv) { 11 | a = *null; 12 | return 0; 13 | } 14 | 15 | // CHECK: The signal is caused by a READ memory access. 16 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/illegal_write_test.cc: -------------------------------------------------------------------------------- 1 | // Test that there was an illegal WRITE memory access. 2 | // RUN: %clangxx -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s 3 | 4 | // REQUIRES: stable-runtime 5 | // XFAIL: powerpc64, s390x 6 | 7 | volatile int *null = 0; 8 | 9 | int main(int argc, char **argv) { 10 | *null = 0; 11 | return 0; 12 | } 13 | 14 | // CHECK: The signal is caused by a WRITE memory access. 15 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os in ['Windows']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/lstat.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 -g %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | 6 | int main(void) { 7 | struct stat st; 8 | 9 | if (lstat("/dev/null", &st)) 10 | exit(1); 11 | 12 | if (!S_ISCHR(st.st_mode)) 13 | exit(1); 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/mmap_test.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2 | 3 | #include 4 | #include 5 | 6 | int main() { 7 | char *buf = (char *)mmap(0, 100000, PROT_READ | PROT_WRITE, 8 | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 9 | assert(buf); 10 | munmap(buf, 100000); 11 | } 12 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/strxfrm.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang -O0 %s -o %t && %run %t 2 | // UNSUPPORTED: darwin 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int argc, char **argv) { 9 | char q[10]; 10 | size_t n = strxfrm(q, "abcdef", sizeof(q)); 11 | assert(n < sizeof(q)); 12 | 13 | char q2[10]; 14 | locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0); 15 | n = strxfrm_l(q2, L"qwerty", sizeof(q), loc); 16 | assert(n < sizeof(q2)); 17 | 18 | freelocale(loc); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/Posix/wcsxfrm.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang -O0 %s -o %t && %run %t 2 | // UNSUPPORTED: darwin 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int argc, char **argv) { 9 | wchar_t q[10]; 10 | size_t n = wcsxfrm(q, L"abcdef", sizeof(q) / sizeof(wchar_t)); 11 | assert(n < sizeof(q)); 12 | 13 | wchar_t q2[10]; 14 | locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0); 15 | n = wcsxfrm_l(q2, L"qwerty", sizeof(q) / sizeof(wchar_t), loc); 16 | assert(n < sizeof(q2)); 17 | 18 | freelocale(loc); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/corelimit.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 %s -o %t && %run %t 2 | // UNSUPPORTED: lsan,ubsan 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | int main() { 9 | struct rlimit lim_core; 10 | getrlimit(RLIMIT_CORE, &lim_core); 11 | void *p; 12 | if (sizeof(p) == 8) { 13 | assert(0 == lim_core.rlim_cur); 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/fopen_nullptr.c: -------------------------------------------------------------------------------- 1 | // Check that fopen(NULL, "r") is ok. 2 | // RUN: %clang -O2 %s -o %t && %run %t 3 | #include 4 | const char *fn = NULL; 5 | FILE *f; 6 | int main() { f = fopen(fn, "r"); } 7 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/options-help.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 %s -o %t 2 | // RUN: %env_tool_opts=help=1 %run %t 2>&1 | FileCheck %s 3 | 4 | int main() { 5 | } 6 | 7 | // CHECK: Available flags for {{.*}}Sanitizer: 8 | // CHECK: handle_segv 9 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/options-invalid.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -O0 %s -o %t 2 | // RUN: %env_tool_opts=invalid_option_name=10,verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-V1 3 | // RUN: %env_tool_opts=invalid_option_name=10 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-V0 4 | 5 | #include 6 | 7 | int main() { 8 | fprintf(stderr, "done\n"); 9 | } 10 | 11 | // CHECK-V1: WARNING: found 1 unrecognized 12 | // CHECK-V1: invalid_option_name 13 | // CHECK-V0-NOT: WARNING: found 1 unrecognized 14 | // CHECK-V0-NOT: invalid_option_name 15 | // CHECK: done 16 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/printf-ldbl.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2>&1 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char **argv) { 8 | char buf[20]; 9 | long double ld = 4.0; 10 | snprintf(buf, sizeof buf, "%Lf %d", ld, 123); 11 | assert(!strcmp(buf, "4.000000 123")); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/scanf-ldbl.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2>&1 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char **argv) { 8 | long double ld; 9 | memset(&ld, 255, sizeof ld); 10 | sscanf("4.0", "%Lf", &ld); 11 | assert(ld == 4.0); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/strcasestr.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2>&1 2 | 3 | // There's no interceptor for strcasestr on Windows 4 | // XFAIL: windows-msvc 5 | 6 | #define _GNU_SOURCE 7 | #include 8 | #include 9 | int main(int argc, char **argv) { 10 | char *r = 0; 11 | char s1[] = "aB"; 12 | char s2[] = "b"; 13 | r = strcasestr(s1, s2); 14 | assert(r == s1 + 1); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/strcspn.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2>&1 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) { 7 | size_t r; 8 | char s1[] = "ad"; 9 | char s2[] = "cd"; 10 | r = strcspn(s1, s2); 11 | assert(r == 1); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/strnlen.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2>&1 2 | 3 | #include 4 | #include 5 | int main(int argc, char **argv) { 6 | const char *s = "mytest"; 7 | assert(strnlen(s, 0) == 0UL); 8 | assert(strnlen(s, 1) == 1UL); 9 | assert(strnlen(s, 6) == strlen(s)); 10 | assert(strnlen(s, 7) == strlen(s)); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/strpbrk.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2>&1 2 | 3 | #include 4 | #include 5 | 6 | 7 | int main(int argc, char **argv) { 8 | char *r = 0; 9 | char s1[] = "ad"; 10 | char s2[] = "cd"; 11 | r = strpbrk(s1, s2); 12 | assert(r == s1 + 1); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/strspn.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2>&1 2 | 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv) { 7 | size_t r; 8 | char s1[] = "ab"; 9 | char s2[] = "ac"; 10 | r = strspn(s1, s2); 11 | assert(r == 1); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/sanitizer_common/TestCases/strstr.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang %s -o %t && %run %t 2>&1 2 | 3 | #include 4 | #include 5 | int main(int argc, char **argv) { 6 | char *r = 0; 7 | char s1[] = "ab"; 8 | char s2[] = "b"; 9 | r = strstr(s1, s2); 10 | assert(r == s1 + 1); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/sanitizer_common/ios_commands/iossim_env.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import os, sys, subprocess 4 | 5 | 6 | idx = 1 7 | for arg in sys.argv[1:]: 8 | if not "=" in arg: 9 | break 10 | idx += 1 11 | (argname, argval) = arg.split("=") 12 | os.environ["SIMCTL_CHILD_" + argname] = argval 13 | 14 | exitcode = subprocess.call(sys.argv[idx:]) 15 | if exitcode > 125: 16 | exitcode = 126 17 | sys.exit(exitcode) 18 | -------------------------------------------------------------------------------- /test/sanitizer_common/ios_commands/iossim_prepare.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import os, sys, subprocess, json 4 | 5 | print(json.dumps({"env": {}})) 6 | -------------------------------------------------------------------------------- /test/scudo/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | config.name_suffix = "@SCUDO_TEST_CONFIG_SUFFIX@" 4 | config.target_arch = "@SCUDO_TEST_TARGET_ARCH@" 5 | config.target_cflags = "@SCUDO_TEST_TARGET_CFLAGS@" 6 | 7 | # Load common config for all compiler-rt lit tests. 8 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") 9 | 10 | # Load tool-specific config that would do the real work. 11 | lit_config.load_config(config, "@SCUDO_LIT_SOURCE_DIR@/lit.cfg") 12 | -------------------------------------------------------------------------------- /test/scudo/symbols.test: -------------------------------------------------------------------------------- 1 | UNSUPPORTED: android 2 | 3 | Verify that various functions are *not* present in the minimal binary. Presence 4 | of those symbols in the minimal runtime would mean that the split code made it 5 | back into the core Sanitizer runtime library. 6 | 7 | RUN: nm %shared_minlibscudo | not grep Symbolizer 8 | RUN: nm %shared_minlibscudo | not grep Coverage 9 | -------------------------------------------------------------------------------- /test/shadowcallstack/init.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_scs %s -o %t 2 | // RUN: %run %t 3 | 4 | // Basic smoke test for the runtime 5 | 6 | #include "libc_support.h" 7 | #include "minimal_runtime.h" 8 | 9 | int scs_main(void) { 10 | scs_fputs_stdout("In main.\n"); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /test/shadowcallstack/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | # Tool-specific config options. 4 | config.name_suffix = "@SHADOWCALLSTACK_TEST_CONFIG_SUFFIX@" 5 | config.target_cflags = "@SHADOWCALLSTACK_TEST_TARGET_CFLAGS@" 6 | config.target_arch = "@SHADOWCALLSTACK_TEST_TARGET_ARCH@" 7 | 8 | # Load common config for all compiler-rt lit tests. 9 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") 10 | 11 | # Load tool-specific config that would do the real work. 12 | lit_config.load_config(config, "@SHADOWCALLSTACK_LIT_SOURCE_DIR@/lit.cfg") 13 | -------------------------------------------------------------------------------- /test/shadowcallstack/overflow-aarch64.c: -------------------------------------------------------------------------------- 1 | // See overflow.c for a description. 2 | 3 | // REQUIRES: aarch64-target-arch 4 | // RUN: %clang_scs %S/overflow.c -o %t -DITERATIONS=12 5 | // RUN: %run %t | FileCheck %S/overflow.c 6 | -------------------------------------------------------------------------------- /test/shadowcallstack/overflow-x86_64.c: -------------------------------------------------------------------------------- 1 | // See overflow.c for a description. 2 | 3 | // REQUIRES: x86_64-target-arch 4 | // RUN: %clang_scs %S/overflow.c -o %t -DITERATIONS=12 5 | // RUN: not --crash %run %t 6 | -------------------------------------------------------------------------------- /test/tsan/Darwin/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Darwin']: 9 | config.unsupported = True 10 | 11 | config.environment['TSAN_OPTIONS'] += ':ignore_noninstrumented_modules=1' 12 | -------------------------------------------------------------------------------- /test/tsan/Darwin/objc-simple.mm: -------------------------------------------------------------------------------- 1 | // Test that a simple Obj-C program runs and exits without any warnings. 2 | 3 | // RUN: %clang_tsan %s -o %t -framework Foundation 4 | // RUN: %run %t 2>&1 | FileCheck %s 5 | 6 | #import 7 | 8 | int main() { 9 | NSLog(@"Hello world"); 10 | } 11 | 12 | // CHECK: Hello world 13 | // CHECK-NOT: WARNING: ThreadSanitizer 14 | -------------------------------------------------------------------------------- /test/tsan/Darwin/realloc-zero.cc: -------------------------------------------------------------------------------- 1 | // Test that realloc(nullptr, 0) return a non-NULL pointer. 2 | 3 | // RUN: %clang_tsan %s -o %t 4 | // RUN: %run %t 2>&1 | FileCheck %s 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | int main() { 12 | void *p = realloc(NULL, 0); 13 | if (!p) { 14 | abort(); 15 | } 16 | fprintf(stderr, "Okay.\n"); 17 | return 0; 18 | } 19 | 20 | // CHECK: Okay. 21 | -------------------------------------------------------------------------------- /test/tsan/Linux/check_memcpy.cc: -------------------------------------------------------------------------------- 1 | // Test that verifies TSan runtime doesn't contain compiler-emitted 2 | // memcpy/memmove calls. It builds the binary with TSan and passes it to 3 | // check_memcpy.sh script. 4 | 5 | // RUN: %clangxx_tsan -O1 %s -o %t 6 | // RUN: llvm-objdump -d %t | FileCheck %s 7 | 8 | // REQUIRES: compiler-rt-optimized 9 | 10 | int main() { 11 | return 0; 12 | } 13 | 14 | // CHECK-NOT: callq {{.*<(__interceptor_)?mem(cpy|set)>}} 15 | // tail calls: 16 | // CHECK-NOT: jmpq {{.*<(__interceptor_)?mem(cpy|set)>}} 17 | 18 | -------------------------------------------------------------------------------- /test/tsan/Linux/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Linux']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/tsan/Linux/pie_no_aslr.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan %s -pie -fPIE -o %t && %run setarch x86_64 -R %t 2 | // REQUIRES: x86_64-target-arch 3 | 4 | int main() { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /test/tsan/atexit.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | 3 | #include 4 | #include 5 | 6 | class Logger { 7 | public: 8 | Logger() { 9 | fprintf(stderr, "Logger ctor\n"); 10 | } 11 | 12 | ~Logger() { 13 | fprintf(stderr, "Logger dtor\n"); 14 | } 15 | }; 16 | 17 | Logger logger; 18 | 19 | void log_from_atexit() { 20 | fprintf(stderr, "In log_from_atexit\n"); 21 | } 22 | 23 | int main() { 24 | atexit(log_from_atexit); 25 | } 26 | 27 | // CHECK: Logger ctor 28 | // CHECK: In log_from_atexit 29 | // CHECK: Logger dtor 30 | -------------------------------------------------------------------------------- /test/tsan/atexit2.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | 3 | #include 4 | #include 5 | 6 | int n; 7 | const int N = 10000; 8 | 9 | static void atexit1() { 10 | n++; 11 | } 12 | 13 | static void atexit0() { 14 | fprintf(stderr, "run count: %d\n", n); 15 | } 16 | 17 | int main() { 18 | atexit(atexit0); 19 | for (int i = 0; i < N; i++) 20 | atexit(atexit1); 21 | } 22 | 23 | // CHECK-NOT: FATAL: ThreadSanitizer 24 | // CHECK-NOT: WARNING: ThreadSanitizer 25 | // CHECK: run count: 10000 26 | 27 | -------------------------------------------------------------------------------- /test/tsan/atomic_free2.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s 2 | #include "test.h" 3 | 4 | void *Thread(void *a) { 5 | barrier_wait(&barrier); 6 | __atomic_fetch_add((int*)a, 1, __ATOMIC_SEQ_CST); 7 | return 0; 8 | } 9 | 10 | int main() { 11 | barrier_init(&barrier, 2); 12 | int *a = new int(0); 13 | pthread_t t; 14 | pthread_create(&t, 0, Thread, a); 15 | delete a; 16 | barrier_wait(&barrier); 17 | pthread_join(t, 0); 18 | } 19 | 20 | // CHECK: WARNING: ThreadSanitizer: heap-use-after-free 21 | -------------------------------------------------------------------------------- /test/tsan/bench_acquire_only.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_tsan %s -o %t 2 | // RUN: %run %t 2>&1 | FileCheck %s 3 | 4 | // bench.h needs pthread barriers which are not available on OS X 5 | // UNSUPPORTED: darwin 6 | 7 | #include "bench.h" 8 | 9 | int x; 10 | 11 | void thread(int tid) { 12 | for (int i = 0; i < bench_niter; i++) 13 | __atomic_load_n(&x, __ATOMIC_ACQUIRE); 14 | } 15 | 16 | void bench() { 17 | __atomic_store_n(&x, 0, __ATOMIC_RELEASE); 18 | start_thread_group(bench_nthread, thread); 19 | } 20 | 21 | // CHECK: DONE 22 | 23 | -------------------------------------------------------------------------------- /test/tsan/bench_acquire_release.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_tsan %s -o %t 2 | // RUN: %run %t 2>&1 | FileCheck %s 3 | 4 | // bench.h needs pthread barriers which are not available on OS X 5 | // UNSUPPORTED: darwin 6 | 7 | #include "bench.h" 8 | 9 | int x; 10 | 11 | void thread(int tid) { 12 | for (int i = 0; i < bench_niter; i++) 13 | __atomic_fetch_add(&x, 1, __ATOMIC_ACQ_REL); 14 | } 15 | 16 | void bench() { 17 | start_thread_group(bench_nthread, thread); 18 | } 19 | 20 | // CHECK: DONE 21 | 22 | -------------------------------------------------------------------------------- /test/tsan/deflake.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # This script is used to deflake inherently flaky tsan tests. 3 | # It is invoked from lit tests as: 4 | # %deflake mybinary 5 | # which is then substituted by lit to: 6 | # $(dirname %s)/deflake.bash mybinary 7 | # The script runs the target program up to 10 times, 8 | # until it fails (i.e. produces a race report). 9 | 10 | for i in $(seq 1 10); do 11 | OUT=`$@ 2>&1` 12 | if [[ $? != 0 ]]; then 13 | echo "$OUT" 14 | exit 0 15 | fi 16 | done 17 | exit 1 18 | -------------------------------------------------------------------------------- /test/tsan/free_race.c.supp: -------------------------------------------------------------------------------- 1 | # Suppression for a use-after-free in free_race.c 2 | race:^Thread2$ 3 | -------------------------------------------------------------------------------- /test/tsan/heap_race.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s 2 | #include "test.h" 3 | #include 4 | #include 5 | #include 6 | 7 | void *Thread(void *a) { 8 | ((int*)a)[0]++; 9 | barrier_wait(&barrier); 10 | return NULL; 11 | } 12 | 13 | int main() { 14 | barrier_init(&barrier, 2); 15 | int *p = new int(42); 16 | pthread_t t; 17 | pthread_create(&t, NULL, Thread, p); 18 | barrier_wait(&barrier); 19 | p[0]++; 20 | pthread_join(t, NULL); 21 | delete p; 22 | } 23 | 24 | // CHECK: WARNING: ThreadSanitizer: data race 25 | -------------------------------------------------------------------------------- /test/tsan/ignore_lib0.cc.supp: -------------------------------------------------------------------------------- 1 | called_from_lib:/libignore_lib0.so 2 | 3 | -------------------------------------------------------------------------------- /test/tsan/ignore_lib1.cc.supp: -------------------------------------------------------------------------------- 1 | called_from_lib:/libignore_lib1.so$ 2 | 3 | -------------------------------------------------------------------------------- /test/tsan/ignore_lib2.cc.supp: -------------------------------------------------------------------------------- 1 | called_from_lib:ignore_lib2 2 | 3 | -------------------------------------------------------------------------------- /test/tsan/ignore_lib3.cc.supp: -------------------------------------------------------------------------------- 1 | called_from_lib:ignore_lib3.so 2 | 3 | -------------------------------------------------------------------------------- /test/tsan/ignore_lib5.cc.supp: -------------------------------------------------------------------------------- 1 | called_from_lib:/libignore_lib1.so$ 2 | 3 | -------------------------------------------------------------------------------- /test/tsan/interface_atomic_test.c: -------------------------------------------------------------------------------- 1 | // Test that we can include header with TSan atomic interface. 2 | // RUN: %clang_tsan %s -o %t && %run %t 2>&1 | FileCheck %s 3 | #include 4 | #include 5 | 6 | int main() { 7 | __tsan_atomic32 a; 8 | __tsan_atomic32_store(&a, 100, __tsan_memory_order_release); 9 | int res = __tsan_atomic32_load(&a, __tsan_memory_order_acquire); 10 | if (res == 100) { 11 | // CHECK: PASS 12 | fprintf(stderr, "PASS\n"); 13 | return 0; 14 | } 15 | return 1; 16 | } 17 | -------------------------------------------------------------------------------- /test/tsan/libcxx/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | # Only run if we have an instrumented libcxx. On Darwin, run always (we have 9 | # interceptors to support the system-provided libcxx). 10 | if not root.has_libcxx and root.host_os != 'Darwin': 11 | config.unsupported = True 12 | 13 | -------------------------------------------------------------------------------- /test/tsan/longjmp.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int foo(jmp_buf env) { 8 | longjmp(env, 42); 9 | } 10 | 11 | int main() { 12 | jmp_buf env; 13 | if (setjmp(env) == 42) { 14 | fprintf(stderr, "JUMPED\n"); 15 | return 0; 16 | } 17 | foo(env); 18 | fprintf(stderr, "FAILED\n"); 19 | return 0; 20 | } 21 | 22 | // CHECK-NOT: FAILED 23 | // CHECK: JUMPED 24 | -------------------------------------------------------------------------------- /test/tsan/longjmp2.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int foo(sigjmp_buf env) { 8 | printf("env=%p\n", env); 9 | siglongjmp(env, 42); 10 | } 11 | 12 | int main() { 13 | sigjmp_buf env; 14 | printf("env=%p\n", env); 15 | if (sigsetjmp(env, 1) == 42) { 16 | fprintf(stderr, "JUMPED\n"); 17 | return 0; 18 | } 19 | foo(env); 20 | fprintf(stderr, "FAILED\n"); 21 | return 0; 22 | } 23 | 24 | // CHECK-NOT: FAILED 25 | // CHECK: JUMPED 26 | -------------------------------------------------------------------------------- /test/tsan/pie_test.cc: -------------------------------------------------------------------------------- 1 | // Check if tsan work with PIE binaries. 2 | // RUN: %clang_tsan %s -pie -fpic -o %t && %run %t 3 | 4 | int main(void) { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /test/tsan/printf-1.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O2 %s -o %t 2 | // RUN: %env_tsan_opts=check_printf=1 %run %t 2>&1 | FileCheck %s 3 | // RUN: %env_tsan_opts=check_printf=0 %run %t 2>&1 | FileCheck %s 4 | // RUN: %run %t 2>&1 | FileCheck %s 5 | 6 | #include 7 | int main() { 8 | volatile char c = '0'; 9 | volatile int x = 12; 10 | volatile float f = 1.239; 11 | volatile char s[] = "34"; 12 | printf("%c %d %.3f %s\n", c, x, f, s); 13 | return 0; 14 | // Check that printf works fine under Tsan. 15 | // CHECK: 0 12 1.239 34 16 | } 17 | -------------------------------------------------------------------------------- /test/tsan/sleep_sync2.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s 2 | #include "test.h" 3 | 4 | int X = 0; 5 | 6 | void *Thread(void *p) { 7 | X = 42; 8 | barrier_wait(&barrier); 9 | return 0; 10 | } 11 | 12 | int main() { 13 | barrier_init(&barrier, 2); 14 | pthread_t t; 15 | sleep(1); // must not appear in the report 16 | pthread_create(&t, 0, Thread, 0); 17 | barrier_wait(&barrier); 18 | X = 43; 19 | pthread_join(t, 0); 20 | return 0; 21 | } 22 | 23 | // CHECK: WARNING: ThreadSanitizer: data race 24 | // CHECK-NOT: As if synchronized via sleep 25 | -------------------------------------------------------------------------------- /test/tsan/stack_race.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s 2 | #include "test.h" 3 | 4 | void *Thread(void *a) { 5 | barrier_wait(&barrier); 6 | *(int*)a = 43; 7 | return 0; 8 | } 9 | 10 | int main() { 11 | barrier_init(&barrier, 2); 12 | int Var = 42; 13 | pthread_t t; 14 | pthread_create(&t, 0, Thread, &Var); 15 | Var = 43; 16 | barrier_wait(&barrier); 17 | pthread_join(t, 0); 18 | } 19 | 20 | // CHECK: WARNING: ThreadSanitizer: data race 21 | // CHECK: Location is stack of main thread. 22 | 23 | -------------------------------------------------------------------------------- /test/tsan/suppressions_global.cc.supp: -------------------------------------------------------------------------------- 1 | race:RacyGlobal 2 | 3 | -------------------------------------------------------------------------------- /test/tsan/suppressions_mutex.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %env_tsan_opts=suppressions='%s.supp' %run %t 2>&1 | FileCheck %s 2 | #include "test.h" 3 | 4 | void __attribute__((noinline)) suppress_this(pthread_mutex_t *mu) { 5 | pthread_mutex_destroy(mu); 6 | } 7 | 8 | int main() { 9 | pthread_mutex_t mu; 10 | pthread_mutex_init(&mu, 0); 11 | pthread_mutex_lock(&mu); 12 | suppress_this(&mu); 13 | fprintf(stderr, "DONE\n"); 14 | return 0; 15 | } 16 | 17 | // CHECK-NOT: failed to open suppressions file 18 | // CHECK-NOT: WARNING: ThreadSanitizer: 19 | // CHECK: DONE 20 | -------------------------------------------------------------------------------- /test/tsan/suppressions_mutex.cc.supp: -------------------------------------------------------------------------------- 1 | mutex:suppress_this 2 | 3 | -------------------------------------------------------------------------------- /test/tsan/suppressions_race.cc.supp: -------------------------------------------------------------------------------- 1 | race:Thread1 2 | 3 | -------------------------------------------------------------------------------- /test/tsan/suppressions_race2.cc.supp: -------------------------------------------------------------------------------- 1 | race:Thread2 2 | 3 | -------------------------------------------------------------------------------- /test/tsan/thread_detach.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | #include "test.h" 3 | 4 | void *Thread(void *x) { 5 | barrier_wait(&barrier); 6 | return 0; 7 | } 8 | 9 | int main() { 10 | barrier_init(&barrier, 2); 11 | pthread_t t; 12 | pthread_create(&t, 0, Thread, 0); 13 | barrier_wait(&barrier); 14 | pthread_detach(t); 15 | fprintf(stderr, "PASS\n"); 16 | return 0; 17 | } 18 | 19 | // CHECK-NOT: WARNING: ThreadSanitizer: thread leak 20 | // CHECK: PASS 21 | -------------------------------------------------------------------------------- /test/tsan/thread_end_with_ignore2.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s 2 | extern "C" void AnnotateIgnoreWritesBegin(const char *f, int l); 3 | 4 | int main() { 5 | AnnotateIgnoreWritesBegin("", 0); 6 | } 7 | 8 | // CHECK: ThreadSanitizer: main thread finished with ignores enabled 9 | // CHECK: Ignore was enabled at: 10 | // CHECK: #0 AnnotateIgnoreWritesBegin 11 | // CHECK: #1 main 12 | 13 | -------------------------------------------------------------------------------- /test/tsan/thread_leak.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | #include 3 | #include 4 | 5 | void *Thread(void *x) { 6 | return 0; 7 | } 8 | 9 | int main() { 10 | pthread_t t; 11 | pthread_create(&t, 0, Thread, 0); 12 | pthread_join(t, 0); 13 | fprintf(stderr, "PASS\n"); 14 | return 0; 15 | } 16 | 17 | // CHECK-NOT: WARNING: ThreadSanitizer: thread leak 18 | -------------------------------------------------------------------------------- /test/tsan/thread_leak2.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | #include 3 | #include 4 | 5 | void *Thread(void *x) { 6 | return 0; 7 | } 8 | 9 | int main() { 10 | pthread_t t; 11 | pthread_create(&t, 0, Thread, 0); 12 | pthread_detach(t); 13 | fprintf(stderr, "PASS\n"); 14 | return 0; 15 | } 16 | 17 | // CHECK-NOT: WARNING: ThreadSanitizer: thread leak 18 | -------------------------------------------------------------------------------- /test/tsan/thread_leak3.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s 2 | #include "test.h" 3 | 4 | void *Thread(void *x) { 5 | barrier_wait(&barrier); 6 | return 0; 7 | } 8 | 9 | int main() { 10 | barrier_init(&barrier, 2); 11 | pthread_t t; 12 | pthread_create(&t, 0, Thread, 0); 13 | barrier_wait(&barrier); 14 | sleep(1); // wait for the thread to finish and exit 15 | return 0; 16 | } 17 | 18 | // CHECK: WARNING: ThreadSanitizer: thread leak 19 | // CHECK: SUMMARY: ThreadSanitizer: thread leak{{.*}}main 20 | -------------------------------------------------------------------------------- /test/tsan/thread_leak4.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s 2 | #include "test.h" 3 | 4 | void *Thread(void *x) { 5 | sleep(100); // leave the thread "running" 6 | return 0; 7 | } 8 | 9 | int main() { 10 | pthread_t t; 11 | pthread_create(&t, 0, Thread, 0); 12 | fprintf(stderr, "DONE\n"); 13 | return 0; 14 | } 15 | 16 | // CHECK: DONE 17 | // CHECK-NOT: WARNING: ThreadSanitizer: thread leak 18 | 19 | -------------------------------------------------------------------------------- /test/tsan/tiny_race.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s 2 | #include "test.h" 3 | 4 | int Global; 5 | 6 | void *Thread1(void *x) { 7 | barrier_wait(&barrier); 8 | Global = 42; 9 | return x; 10 | } 11 | 12 | int main() { 13 | barrier_init(&barrier, 2); 14 | pthread_t t; 15 | pthread_create(&t, 0, Thread1, 0); 16 | Global = 43; 17 | barrier_wait(&barrier); 18 | pthread_join(t, 0); 19 | return Global; 20 | } 21 | 22 | // CHECK: WARNING: ThreadSanitizer: data race 23 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/Integer/div-overflow.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s 2 | 3 | #include 4 | 5 | int main() { 6 | unsigned(0x80000000) / -1; 7 | 8 | // CHECK: div-overflow.cpp:9:23: runtime error: division of -2147483648 by -1 cannot be represented in type 'int' 9 | int32_t(0x80000000) / -1; 10 | } 11 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/Integer/mul-overflow.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s 2 | 3 | #include 4 | 5 | int main() { 6 | // These promote to 'int'. 7 | (void)(int8_t(-2) * int8_t(0x7f)); 8 | (void)(int16_t(0x7fff) * int16_t(0x7fff)); 9 | (void)(uint16_t(0xffff) * int16_t(0x7fff)); 10 | (void)(uint16_t(0xffff) * uint16_t(0x8000)); 11 | 12 | // CHECK: mul-overflow.cpp:13:27: runtime error: signed integer overflow: 65535 * 32769 cannot be represented in type 'int' 13 | (void)(uint16_t(0xffff) * uint16_t(0x8001)); 14 | } 15 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/Misc/Inputs/no-interception-dso.c: -------------------------------------------------------------------------------- 1 | int dso_function(int i) { 2 | return i + 1; 3 | } 4 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/Misc/Inputs/returns-unexpectedly.c: -------------------------------------------------------------------------------- 1 | void returns_unexpectedly() {} 2 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/Misc/Linux/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Linux']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/Misc/Linux/ubsan_options.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -fsanitize=integer -fsanitize-recover=integer %s -o %t 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | 4 | // __ubsan_default_options() doesn't work on Darwin. 5 | // XFAIL: darwin 6 | 7 | #include 8 | 9 | extern "C" const char *__ubsan_default_options() { 10 | return "halt_on_error=1"; 11 | } 12 | 13 | int main() { 14 | (void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull)); 15 | // CHECK: ubsan_options.cc:[[@LINE-1]]:44: runtime error: unsigned integer overflow 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/Misc/bool.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -fsanitize=bool %s -O3 -o %t 2 | // RUN: not %run %t 2>&1 | FileCheck %s 3 | // RUN: %env_ubsan_opts=print_summary=1:report_error_type=1 not %run %t 2>&1 | FileCheck %s --check-prefix=SUMMARY 4 | 5 | unsigned char NotABool = 123; 6 | 7 | int main(int argc, char **argv) { 8 | bool *p = (bool*)&NotABool; 9 | 10 | // CHECK: bool.cpp:[[@LINE+1]]:10: runtime error: load of value 123, which is not a valid value for type 'bool' 11 | return *p; 12 | // SUMMARY: SUMMARY: {{.*}}Sanitizer: invalid-bool-load {{.*}}bool.cpp:[[@LINE-1]] 13 | } 14 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/Misc/vla.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang -fsanitize=vla-bound %s -O3 -o %t 2 | // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MINUS-ONE 3 | // RUN: %run %t a 2>&1 | FileCheck %s --check-prefix=CHECK-ZERO 4 | // RUN: %run %t a b 5 | 6 | int main(int argc, char **argv) { 7 | // CHECK-MINUS-ONE: vla.c:[[@LINE+2]]:11: runtime error: variable length array bound evaluates to non-positive value -1 8 | // CHECK-ZERO: vla.c:[[@LINE+1]]:11: runtime error: variable length array bound evaluates to non-positive value 0 9 | int arr[argc - 2]; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg: -------------------------------------------------------------------------------- 1 | # The function type checker is only supported on x86 and x86_64 for now. 2 | if config.target_arch not in ['x86', 'x86_64']: 3 | config.unsupported = True 4 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/TypeCheck/Linux/lit.local.cfg: -------------------------------------------------------------------------------- 1 | def getRoot(config): 2 | if not config.parent: 3 | return config 4 | return getRoot(config.parent) 5 | 6 | root = getRoot(config) 7 | 8 | if root.host_os not in ['Linux']: 9 | config.unsupported = True 10 | -------------------------------------------------------------------------------- /test/ubsan/TestCases/TypeCheck/vptr-virtual-base-construction.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr %s -o %t 2 | // RUN: %run %t 3 | 4 | // REQUIRES: cxxabi 5 | // UNSUPPORTED: windows-msvc 6 | 7 | int volatile n; 8 | 9 | struct A { virtual ~A() {} }; 10 | struct B: virtual A {}; 11 | struct C: virtual A { ~C() { n = 0; } }; 12 | struct D: virtual B, virtual C {}; 13 | 14 | int main() { delete new D; } 15 | -------------------------------------------------------------------------------- /test/ubsan_minimal/TestCases/implicit-integer-sign-change.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang -fsanitize=implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK 2 | 3 | #include 4 | 5 | int main() { 6 | // CHECK-NOT: implicit-conversion 7 | 8 | // Explicitly casting hides it, 9 | int32_t n0 = (int32_t)(~((uint32_t)0)); 10 | 11 | // Positive tests. 12 | int32_t t0 = (~((uint32_t)0)); 13 | // CHECK: implicit-conversion 14 | // CHECK-NOT: implicit-conversion 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/ubsan_minimal/TestCases/implicit-signed-integer-truncation-or-sign-change.c: -------------------------------------------------------------------------------- 1 | // RUN: %clang -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefixes=CHECK 2 | 3 | #include 4 | 5 | int main() { 6 | // CHECK-NOT: implicit-conversion 7 | 8 | // Explicitly casting hides it, 9 | int8_t n0 = (int8_t)((uint32_t)-1); 10 | 11 | // Positive tests. 12 | int8_t t0 = (uint32_t)-1; 13 | // CHECK: implicit-conversion 14 | // CHECK-NOT: implicit-conversion 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /test/ubsan_minimal/TestCases/uadd-overflow.cpp: -------------------------------------------------------------------------------- 1 | // RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s 2 | // RUN: %clangxx -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=all %s -o %t && not --crash %run %t 2>&1 | FileCheck %s 3 | 4 | #include 5 | 6 | int main() { 7 | uint32_t k = 0x87654321; 8 | k += 0xedcba987; 9 | // CHECK: add-overflow 10 | } 11 | -------------------------------------------------------------------------------- /test/ubsan_minimal/lit.site.cfg.in: -------------------------------------------------------------------------------- 1 | @LIT_SITE_CFG_IN_HEADER@ 2 | 3 | # Tool-specific config options. 4 | config.target_cflags = "@UBSAN_TEST_TARGET_CFLAGS@" 5 | config.target_arch = "@UBSAN_TEST_TARGET_ARCH@" 6 | 7 | # Load common config for all compiler-rt lit tests. 8 | lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured") 9 | 10 | # Load tool-specific config that would do the real work. 11 | lit_config.load_config(config, "@UBSAN_LIT_TESTS_DIR@/lit.common.cfg") 12 | -------------------------------------------------------------------------------- /test/xray/TestCases/Posix/c-test.cc: -------------------------------------------------------------------------------- 1 | // RUN: %clang_xray -g -fxray-modes=xray-basic,xray-fdr,xray-profiling -o %t %s 2 | // RUN: rm -f xray-log.c-test.* 3 | // RUN: XRAY_OPTIONS=patch_premain=true:verbosity=1:xray_mode=xray-basic %t \ 4 | // RUN: 2>&1 | FileCheck %s 5 | // RUN: rm -f xray-log.c-test.* 6 | // 7 | // REQUIRES: x86_64-target-arch 8 | // REQUIRES: built-in-llvm-tree 9 | __attribute__((xray_always_instrument)) void always() {} 10 | 11 | int main() { 12 | always(); 13 | } 14 | 15 | // CHECK: =={{[0-9].*}}==XRay: Log file in '{{.*}}' 16 | -------------------------------------------------------------------------------- /unittests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Needed for lit support in standalone builds. 2 | include(AddLLVM) 3 | 4 | configure_compiler_rt_lit_site_cfg( 5 | ${CMAKE_CURRENT_SOURCE_DIR}/lit.common.unit.configured.in 6 | ${CMAKE_CURRENT_BINARY_DIR}/lit.common.unit.configured) 7 | -------------------------------------------------------------------------------- /unittests/lit_unittest_cfg_utils.py: -------------------------------------------------------------------------------- 1 | # Put all 64-bit sanitizer tests in the darwin-64bit-sanitizer parallelism 2 | # group. This will only run three of them concurrently. 3 | def darwin_sanitizer_parallelism_group_func(test): 4 | return "darwin-64bit-sanitizer" if "x86_64" in test.file_path else "" 5 | --------------------------------------------------------------------------------