hanchenye-llvm-project/compiler-rt/lib/asan
Kamil Rytarowski 271018d216 [Sanitizers] Basic sanitizer Solaris support (PR 33274)
Summary:
This is the first mostly working version of the Sanitizer port to 32-bit Solaris/x86.
It is currently based on Solaris 11.4 Beta.

This part was initially developed inside libsanitizer in the GCC tree and should apply to
both.  Subsequent parts will address changes to clang, the compiler-rt build system
and testsuite.

I'm not yet sure what the right patch granularity is: if it's profitable to split the patch
up, I'd like to get guidance on how to do so.

Most of the changes are probably straightforward with a few exceptions:

* The Solaris syscall interface isn't stable, undocumented and can change within an
  OS release.  The stable interface is the libc interface, which I'm using here, if possible
  using the internal _-prefixed names.

* While the patch primarily target 32-bit x86, I've left a few sparc changes in.  They
  cannot currently be used with clang due to a backend limitation, but have worked
  fine inside the gcc tree.

* Some functions (e.g. largefile versions of functions like open64) only exist in 32-bit
  Solaris, so I've introduced a separate SANITIZER_SOLARIS32 to check for that.

The patch (with the subsequent ones to be submitted shortly) was tested
on i386-pc-solaris2.11.  Only a few failures remain, some of them analyzed, some
still TBD:

    AddressSanitizer-i386-sunos :: TestCases/Posix/concurrent_overflow.cc
    AddressSanitizer-i386-sunos :: TestCases/init-order-atexit.cc
    AddressSanitizer-i386-sunos :: TestCases/log-path_test.cc
    AddressSanitizer-i386-sunos :: TestCases/malloc-no-intercept.c
    AddressSanitizer-i386-sunos-dynamic :: TestCases/Posix/concurrent_overflow.cc
    AddressSanitizer-i386-sunos-dynamic :: TestCases/Posix/start-deactivated.cc
    AddressSanitizer-i386-sunos-dynamic :: TestCases/default_options.cc
    AddressSanitizer-i386-sunos-dynamic :: TestCases/init-order-atexit.cc
    AddressSanitizer-i386-sunos-dynamic :: TestCases/log-path_test.cc
    AddressSanitizer-i386-sunos-dynamic :: TestCases/malloc-no-intercept.c

   SanitizerCommon-Unit :: ./Sanitizer-i386-Test/MemoryMappingLayout.DumpListOfModules
    SanitizerCommon-Unit :: ./Sanitizer-i386-Test/SanitizerCommon.PthreadDestructorIterations

Maybe this is good enough the get the ball rolling.

Reviewers: kcc, alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, jyknight, kubamracek, krytarowski, fedor.sergeev, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D40898

llvm-svn: 320740
2017-12-14 20:14:29 +00:00
..
scripts [asan] Fix asan_device_setup on KitKat. 2017-11-17 23:52:34 +00:00
tests [asan] Properly mark or disable tests that only work with shadow scale of 3 2017-11-16 23:29:19 +00:00
.clang-format
CMakeLists.txt [asan] Use dynamic shadow on 32-bit Android, try 2. 2017-11-20 17:41:57 +00:00
README.txt
asan.syms.extra [asan] Export __sancov_* symbols symbols. 2017-01-31 20:23:07 +00:00
asan_activation.cc [asan] Ensure that the minimum redzone is at least SHADOW_GRANULARITY 2017-11-16 17:03:25 +00:00
asan_activation.h
asan_activation_flags.inc ASAN activate/deactive controls thread_local_quarantine_size_kb option. 2017-01-12 18:51:25 +00:00
asan_allocator.cc [asan] Use linker initialization for the allocator 2017-12-14 00:07:15 +00:00
asan_allocator.h [Sanitizers] ASan: detect new/delete calls with mismatched alignment. 2017-10-25 17:21:37 +00:00
asan_blacklist.txt
asan_debugging.cc [asan] Add a new AddressDescription structure, which can describe any type of address. 2016-09-09 20:43:20 +00:00
asan_descriptions.cc [ASan] Enhance libsanitizer support for invalid-pointer-pair. 2017-12-04 18:00:24 +00:00
asan_descriptions.h [ASan] Enhance libsanitizer support for invalid-pointer-pair. 2017-12-04 18:00:24 +00:00
asan_errors.cc [sanitizer] Remove unused <signal.h> which conflicts with asan declarations 2017-11-10 03:18:53 +00:00
asan_errors.h [Sanitizers] ASan: detect new/delete calls with mismatched alignment. 2017-10-25 17:21:37 +00:00
asan_fake_stack.cc [asan] Avoid assert failure for non-default shadow scale 2017-11-16 22:02:58 +00:00
asan_fake_stack.h fix random typos [NFC] 2016-08-05 18:49:08 +00:00
asan_flags.cc [asan] Ensure that the minimum redzone is at least SHADOW_GRANULARITY 2017-11-16 17:03:25 +00:00
asan_flags.h
asan_flags.inc [compiler-rt] Move dump_instruction_bytes and dump_registers into sanitizer_common 2017-09-13 06:24:59 +00:00
asan_fuchsia.cc (NFC) Rename GetMax{,User}VirtualAddress. 2017-11-07 23:51:22 +00:00
asan_globals.cc [asan] Unpoison global metadata on dlclose. 2017-09-28 13:38:58 +00:00
asan_globals_win.cc [sanitizer] Split dll_thunks into different sanitizers. 2017-02-02 23:01:28 +00:00
asan_init_version.h [asan] Use dynamic shadow on 32-bit Android, try 2. 2017-11-20 17:41:57 +00:00
asan_interceptors.cc [sanitizer] Move signal interceptors from asan to sanitizer_common 2017-09-16 07:16:29 +00:00
asan_interceptors.h [Sanitizers] Basic sanitizer Solaris support (PR 33274) 2017-12-14 20:14:29 +00:00
asan_interceptors_memintrinsics.cc [asan] Interceptors for Fuchsia 2017-08-02 07:59:30 +00:00
asan_interceptors_memintrinsics.h [asan] Move memcpy, memmove, memset code out of asan_interceptors.cc 2017-07-20 01:29:01 +00:00
asan_interface.inc [asan] Fix dead stripping of globals on Linux (compiler-rt). 2017-04-27 20:27:33 +00:00
asan_interface_internal.h [asan] Fix dead stripping of globals on Linux (compiler-rt). 2017-04-27 20:27:33 +00:00
asan_internal.h [asan] Refactor thread creation bookkeeping 2017-08-09 00:38:57 +00:00
asan_linux.cc [Sanitizers] Basic sanitizer Solaris support (PR 33274) 2017-12-14 20:14:29 +00:00
asan_lock.h
asan_mac.cc [asan] For iOS/AArch64, if the dynamic shadow doesn't fit, restrict the VM space 2017-07-12 23:29:21 +00:00
asan_malloc_linux.cc [Sanitizers] Basic sanitizer Solaris support (PR 33274) 2017-12-14 20:14:29 +00:00
asan_malloc_mac.cc
asan_malloc_win.cc Fix -Wstring-conversion instance 2017-03-15 19:50:02 +00:00
asan_mapping.h [PowerPC][asan] Update asan to handle changed memory layouts in newer kernels 2017-12-07 22:53:49 +00:00
asan_memory_profile.cc [Sanitizers] Add more details to ASan allocator stats report. 2017-10-13 18:38:10 +00:00
asan_new_delete.cc [Sanitizers] ASan: detect new/delete calls with mismatched alignment. 2017-10-25 17:21:37 +00:00
asan_poisoning.cc [asan] Remove semicolon after do {} while (0) 2017-11-13 20:59:20 +00:00
asan_poisoning.h [asan] Complete the Fuchsia port 2017-08-09 00:21:45 +00:00
asan_posix.cc [sanitizer] Remove unused <signal.h> which conflicts with asan declarations 2017-11-10 04:12:35 +00:00
asan_preinit.cc
asan_premap_shadow.cc [asan] Use dynamic shadow on 32-bit Android, try 2. 2017-11-20 17:41:57 +00:00
asan_premap_shadow.h [asan] Use dynamic shadow on 32-bit Android, try 2. 2017-11-20 17:41:57 +00:00
asan_report.cc [ASan] Enhance libsanitizer support for invalid-pointer-pair. 2017-12-04 18:00:24 +00:00
asan_report.h [Sanitizers] ASan: detect new/delete calls with mismatched alignment. 2017-10-25 17:21:37 +00:00
asan_rtl.cc [sanitizers] Add init function to set alignment of low level allocator 2017-11-21 01:01:32 +00:00
asan_scariness_score.h [asan] Add const into ScarinessScoreBase::Print 2017-09-14 03:06:20 +00:00
asan_shadow_setup.cc [asan] Use dynamic shadow on 32-bit Android, try 2. 2017-11-20 17:41:57 +00:00
asan_stack.cc
asan_stack.h [sanitizers] Rename GetStackTraceWithPcBpAndContext 2017-11-09 07:53:06 +00:00
asan_stats.cc
asan_stats.h
asan_suppressions.cc General definition for weak functions 2017-01-29 05:44:59 +00:00
asan_suppressions.h
asan_thread.cc [ASan] Enhance libsanitizer support for invalid-pointer-pair. 2017-12-04 18:00:24 +00:00
asan_thread.h [ASan] Enhance libsanitizer support for invalid-pointer-pair. 2017-12-04 18:00:24 +00:00
asan_win.cc [compiler-rt] Cleanup SignalContext initialization 2017-09-14 02:48:41 +00:00
asan_win_dll_thunk.cc Fix WinASan after moving wcslen interceptor to sanitizer_common 2017-06-29 17:15:53 +00:00
asan_win_dynamic_runtime_thunk.cc [sanitizer] Add dynamic_runtime_thunk for different sanitizers. 2017-02-02 23:01:41 +00:00
asan_win_weak_interception.cc [sanitizer] Use interception to access to strong definitions in the executable. 2017-02-02 23:02:11 +00:00
weak_symbols.txt Add lsan interceptors for libdispatch functions on darwin 2017-06-19 19:21:31 +00:00

README.txt

AddressSanitizer RT
================================
This directory contains sources of the AddressSanitizer (ASan) runtime library.

Directory structure:
README.txt       : This file.
Makefile.mk      : File for make-based build.
CMakeLists.txt   : File for cmake-based build.
asan_*.{cc,h}    : Sources of the asan runtime library.
scripts/*        : Helper scripts.
tests/*          : ASan unit tests.

Also ASan runtime needs the following libraries:
lib/interception/      : Machinery used to intercept function calls.
lib/sanitizer_common/  : Code shared between various sanitizers.

ASan runtime currently also embeds part of LeakSanitizer runtime for
leak detection (lib/lsan/lsan_common.{cc,h}).

ASan runtime can only be built by CMake. You can run ASan tests
from the root of your CMake build tree:

make check-asan

For more instructions see:
https://github.com/google/sanitizers/wiki/AddressSanitizerHowToBuild