llvm-project/compiler-rt/lib/asan
Luís Marques 0c3bc1f3a4 [ASan][RISCV] Fix RISC-V memory mapping
Fixes the ASan RISC-V memory mapping (originally introduced by D87580 and
D87581). This should be an improvement both in terms of first principles
soundness and observed test failures --- test failures would occur
non-deterministically depending on the ASLR random offset.

On RISC-V Linux (64-bit), `TASK_UNMAPPED_BASE` is currently defined as
`PAGE_ALIGN(TASK_SIZE / 3)`. The non-power-of-two divisor makes the result
be the not very round number 0x1555556000. That address had to be further
rounded to ensure page alignment after the shadow scale shifting is applied.
Still, that value explains why the mapping table may look less regular than
expected.

Further cleanups:
- Moved the mapping table comment, to ensure that the two Linux/AArch64
tables stayed together;
- Removed mention of Sv48. Neither the original mapping nor this one are
compatible with an actual Linux Sv48 address space (mainline Linux still
operates Sv48 in Sv39 mode). A future patch can improve this;
- Removed the additional comments, for consistency.

Differential Revision: https://reviews.llvm.org/D97646
2021-04-06 20:46:17 +01:00
..
scripts [RISCV][ASAN] mark asan as supported for RISCV64 and enable tests 2020-10-05 10:38:30 +03:00
tests [sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl 2021-01-06 10:55:40 -08:00
.clang-format
CMakeLists.txt [CMake] Remove cxx-headers from runtime deps 2020-10-30 20:03:38 -07:00
README.txt
asan.syms.extra
asan_activation.cpp compiler-rt: Rename .cc file in lib/asan to .cpp 2019-08-01 13:43:28 +00:00
asan_activation.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
asan_activation_flags.inc Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
asan_allocator.cpp [ASan] Stop blocking child thread progress from parent thread in `pthread_create` interceptor. 2021-01-22 23:34:43 -08:00
asan_allocator.h [RISCV][ASAN] support code for architecture-specific parts of asan 2020-10-04 15:21:48 +03:00
asan_blacklist.txt
asan_debugging.cpp Update compiler-rt cpplint.py 2019-09-11 21:33:06 +00:00
asan_descriptions.cpp [sanitizer] Remove max_len parameter from InternalScopedString 2021-03-17 16:57:09 -07:00
asan_descriptions.h Revert "Revert "[compiler-rt][asan] Make wild-pointer crash error more useful"" 2021-03-12 11:35:50 -05:00
asan_errors.cpp [sanitizer] Remove max_len parameter from InternalScopedString 2021-03-17 16:57:09 -07:00
asan_errors.h Reland "[ASan] Do not misrepresent high value address dereferences as null dereferences" 2019-10-10 17:19:58 +00:00
asan_fake_stack.cpp [sanitizer] Remove max_len parameter from InternalScopedString 2021-03-17 16:57:09 -07:00
asan_fake_stack.h compiler-rt: Rename .cc file in lib/asan to .cpp 2019-08-01 13:43:28 +00:00
asan_flags.cpp [sanitizers] Remove unneeded MaybeCall*DefaultOptions() and nullptr checks 2020-09-08 10:12:05 -07:00
asan_flags.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
asan_flags.inc [compiler-rt] Better lint output for .inc files 2019-09-12 01:35:09 +00:00
asan_fuchsia.cpp [sanitizer_common] Use zx_system_get_page_size() on Fuchsia 2021-02-03 10:45:46 -08:00
asan_globals.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
asan_globals_win.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
asan_init_version.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
asan_interceptors.cpp [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
asan_interceptors.h [sanitizers] Fix interception of GLibc regexec 2021-03-08 10:53:55 +00:00
asan_interceptors_memintrinsics.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
asan_interceptors_memintrinsics.h Remove a few straggler ".cc"s in compiler-rt/lib 2019-08-01 17:53:25 +00:00
asan_interceptors_vfork.S [RISCV][ASAN] implementation for vfork interceptor for riscv64 2020-09-22 22:23:29 -07:00
asan_interface.inc [asan] Provide an interface to update an allocation stack trace. 2019-10-31 13:54:46 -07:00
asan_interface_internal.h [sanitizers] Remove unneeded MaybeCall*DefaultOptions() and nullptr checks 2020-09-08 10:12:05 -07:00
asan_internal.h Revert "[lsan] On Fuchsia, don't use atexit hook for leak checks" 2020-09-23 21:10:56 +02:00
asan_linux.cpp [asan][memprof] Declare _DYNAMIC and fix -Wparentheses 2020-12-27 20:28:59 -08:00
asan_lock.h
asan_mac.cpp [compiler-rt][asan] decommit shadow memory for unmaps in fuchsia. 2020-07-21 11:07:47 -07:00
asan_malloc_linux.cpp [compiler-rt] Replace INLINE with inline 2020-09-17 16:24:20 +02:00
asan_malloc_local.h [compiler-rt] Replace INLINE with inline 2020-09-17 16:24:20 +02:00
asan_malloc_mac.cpp compiler-rt: Rename .cc file in lib/asan to .cpp 2019-08-01 13:43:28 +00:00
asan_malloc_win.cpp Remove unused variables, as suggested by @mcgov. 2019-11-04 14:55:51 -05:00
asan_mapping.h [ASan][RISCV] Fix RISC-V memory mapping 2021-04-06 20:46:17 +01:00
asan_mapping_myriad.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
asan_mapping_sparc64.h [asan] Dedup MemToShadowSize 2020-07-17 02:40:08 -07:00
asan_memory_profile.cpp compiler-rt: Rename .cc file in lib/asan to .cpp 2019-08-01 13:43:28 +00:00
asan_new_delete.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
asan_poisoning.cpp [asan] Increase CHECK limit in __sanitizer_annotate_contiguous_container 2021-02-23 22:14:42 -08:00
asan_poisoning.h [ASan] Use __sanitizer_fill_shadow for FastPoisonShadow on Fuchsia 2019-07-11 07:30:11 +00:00
asan_posix.cpp [Sanitizer][NFC] Fix typo 2021-03-01 23:47:03 +00:00
asan_preinit.cpp compiler-rt: Rename .cc file in lib/asan to .cpp 2019-08-01 13:43:28 +00:00
asan_premap_shadow.cpp [compiler-rt][asan][hwasan] Refactor shadow setup into sanitizer_common (NFCI) 2020-07-16 11:47:05 -07:00
asan_premap_shadow.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
asan_report.cpp [sanitizer] Convert PrintModuleMap to DumpProcessMap 2020-10-21 12:46:49 -07:00
asan_report.h [sanitizer] Implement reallocarray. 2019-05-01 17:33:01 +00:00
asan_rtems.cpp [compiler-rt][asan] decommit shadow memory for unmaps in fuchsia. 2020-07-21 11:07:47 -07:00
asan_rtl.cpp Revert "[sanitizer] Simplify GetTls with dl_iterate_phdr on Linux" 2021-04-05 19:00:18 -04:00
asan_scariness_score.h [compiler-rt] Remove some cpplint filters 2019-09-12 02:20:36 +00:00
asan_shadow_setup.cpp [RISCV][ASAN] support code for architecture-specific parts of asan 2020-10-04 15:21:48 +03:00
asan_stack.cpp compiler-rt: Rename .cc file in lib/asan to .cpp 2019-08-01 13:43:28 +00:00
asan_stack.h [NFC][Asan] Remove unused macro 2020-10-11 22:29:51 -07:00
asan_stats.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
asan_stats.h Revert r369472 and r369441 2019-08-21 05:06:21 +00:00
asan_suppressions.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
asan_suppressions.h compiler-rt: Rename .cc file in lib/asan to .cpp 2019-08-01 13:43:28 +00:00
asan_thread.cpp Revert "[sanitizer] Simplify GetTls with dl_iterate_phdr on Linux" 2021-04-05 19:00:18 -04:00
asan_thread.h [ASan] Stop blocking child thread progress from parent thread in `pthread_create` interceptor. 2021-01-22 23:34:43 -08:00
asan_win.cpp [ASan] Fix broken Windows build due to 596d534ac3. 2021-01-23 09:09:06 -08:00
asan_win_dll_thunk.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
asan_win_dynamic_runtime_thunk.cpp Remove NOLINTs from compiler-rt 2019-09-11 23:19:48 +00:00
asan_win_weak_interception.cpp compiler-rt: Rename .cc file in lib/asan to .cpp 2019-08-01 13:43:28 +00:00
weak_symbols.txt

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