llvm-project/compiler-rt/test/hwasan/TestCases
Leonard Chan 21f72c05c4 [hwasan] Add __hwasan_add_frame_record to the hwasan interface
Hwasan includes instructions in the prologue that mix the PC and SP and store
it into the stack ring buffer stored at __hwasan_tls. This is a thread_local
global exposed from the hwasan runtime. However, if TLS-mechanisms or the
hwasan runtime haven't been setup yet, it will be invalid to access __hwasan_tls.
This is the case for Fuchsia where we instrument libc, so some functions that
are instrumented but can run before hwasan initialization will incorrectly
access this global. Additionally, libc cannot have any TLS variables, so we
cannot weakly define __hwasan_tls until the runtime is loaded.

A way we can work around this is by moving the instructions into a hwasan
function that does the store into the ring buffer and creating a weak definition
of that function locally in libc. This way __hwasan_tls will not actually be
referenced. This is not our long-term solution, but this will allow us to roll
out hwasan in the meantime.

This patch includes:

- A new llvm flag for choosing to emit a libcall rather than instructions in the
  prologue (off by default)
- The libcall for storing into the ringbuffer (__hwasan_add_frame_record)

Differential Revision: https://reviews.llvm.org/D128387
2022-07-13 15:15:15 -07:00
..
Linux [sanitizer] Switch StackStore to 8 MiB blocks 2021-11-26 14:00:10 -08:00
Posix [HWASan] Use page aliasing on x86_64. 2021-03-25 07:04:14 -07:00
abort-message-android.cpp
allocator_returns_null.cpp [HWASan] Use page aliasing on x86_64. 2021-03-25 07:04:14 -07:00
build-ids.c [sanitizers] include build ids in stacks on linux. 2021-12-10 14:24:03 -08:00
cfi.cpp
check-interface.cpp
custom-memmove.c [HWASan] Leave pointer tagged when calling memmove. 2022-01-28 06:15:38 -08:00
deep-recursion.c [hwasan] Add __hwasan_add_frame_record to the hwasan interface 2022-07-13 15:15:15 -07:00
double-free.c [hwasan] Fix test with TCO eliminating free frame. 2021-08-11 09:51:14 +01:00
exported-tagged-global.c [AArch64][NFC] require aarch64 support for hwasan test 2020-08-07 09:24:52 +05:30
global-with-reduction.c Add no_sanitize('hwaddress') (and 'memtag', but that's a no-op). 2022-06-24 12:04:11 -07:00
global.c Add no_sanitize('hwaddress') (and 'memtag', but that's a no-op). 2022-06-24 12:04:11 -07:00
globals-wrap-tag.c [HWASan] Apply TagMaskByte to every global tag. 2021-11-01 06:31:44 -07:00
halt-on-error.cpp
heap-buffer-overflow-into.c [hwasan] print exact mismatch offset for short granules. 2021-10-28 03:31:11 +01:00
heap-buffer-overflow.c [HWASan] Print short tags in tag mismatch description. 2021-11-02 08:00:33 -07:00
hwasan-print-shadow.cpp [HWASan] Print short tags in __hwasan_print_shadow. 2021-11-02 07:59:25 -07:00
hwasan_symbolize.cpp [HWASan] deflake hwasan_symbolize test 2022-05-09 14:11:52 -07:00
libc_thread_freeres.c [hwasan] Reset current thread pointer on thread exit. 2020-05-08 10:31:25 -07:00
longjmp-setjmp-interception.c [HWASan] Intercept setjmp/longjmp on x86_64. 2021-09-17 07:10:57 -07:00
longjmp.c Revert "[hwasan] More realistic setjmp test." 2021-07-12 22:16:25 -07:00
lto.c [HWASan] Disable LTO test on aarch64. 2021-11-29 08:08:17 -08:00
malloc-align.c [hwasan] Fix allocator alignment. 2020-05-11 15:45:42 -07:00
malloc-test.c
malloc_bisect.c
malloc_fill.cpp [HWASan] Use page aliasing on x86_64. 2021-03-25 07:04:14 -07:00
many-threads-uaf.c [HWASan] Use page aliasing on x86_64. 2021-03-25 07:04:14 -07:00
mem-intrinsics-zero-size.c
mem-intrinsics.c [hwasan] print exact mismatch offset for short granules. 2021-10-28 03:31:11 +01:00
musttail.cpp [HWASan] Properly handle musttail calls. 2022-02-01 11:23:43 -08:00
new-test.cpp [NFC][hwasan] Check __GLIBCXX__ before checking _GLIBCXX_RELEASE in test 2022-03-01 09:39:26 +01:00
override-new-delete.cpp
preinit_array.c [HWASan] Add __hwasan_init to .preinit_array. 2022-02-03 13:07:58 -08:00
print-memory-usage-android.c
print-memory-usage.c
print-module-map.c
pthread_create.c [HWASan] Ensure RNG is initialized in GenerateRandomTag 2021-11-09 07:01:55 -08:00
pthread_exit.c
realloc-after-free.c
realloc-test.cpp
register-dump-no-fp.cpp [HWASan] Disable stack, globals and force callbacks for x86_64. 2021-03-22 08:02:27 -07:00
register-dump-read.c [compiler-rt][hwasan] Update register-dump-read.c test 2021-07-21 12:43:07 +00:00
rich-stack.c [HWASan] Add basic stack tagging support for LAM. 2021-06-11 08:21:17 -07:00
sanitizer_malloc.cpp
set-error-report-callback.cpp [HWASan] Use page aliasing on x86_64. 2021-03-25 07:04:14 -07:00
short-granule-disabled.cpp [hwasan] Always untag short granule in shadow. 2021-08-24 14:10:04 -07:00
sizes.cpp [compiler-rt][sanitizer] Have all OOM-related error messages start with the same format 2022-06-07 16:46:01 -07:00
stack-history-length.c [hwasan] Add __hwasan_add_frame_record to the hwasan interface 2022-07-13 15:15:15 -07:00
stack-oob.c [hwasan] Fix incorrect candidate matching for stack OOB. 2021-07-06 12:24:07 +01:00
stack-uar-dynamic.c [HWASan] Add basic stack tagging support for LAM. 2021-06-11 08:21:17 -07:00
stack-uar-realign.c [HWASan] Add basic stack tagging support for LAM. 2021-06-11 08:21:17 -07:00
stack-uar.c [hwasan] Add __hwasan_add_frame_record to the hwasan interface 2022-07-13 15:15:15 -07:00
stack-uas.c [hwasan] Add __hwasan_add_frame_record to the hwasan interface 2022-07-13 15:15:15 -07:00
tag-mismatch-border-address.c [hwasan] Check for overflow when searching candidates. 2021-07-06 11:22:13 +01:00
tag_in_free.c
tail-magic.c [hwasan] Don't report short-granule shadow as overwritten. 2021-08-18 11:25:57 -07:00
thread-uaf.c [HWASan] Ensure RNG is initialized in GenerateRandomTag 2021-11-09 07:01:55 -08:00
try-catch.cpp
uaf_with_rb_distance.c
use-after-free-and-overflow.c [hwasan] Display causes in order of probability. 2021-06-29 13:00:05 +01:00
use-after-free.c [hwasan] Fix test on x86. 2021-08-10 13:06:12 +01:00
use-after-scope-capture.cpp [hwasan] Commit missed REQUIRES: stable-runtime. 2021-08-02 13:58:11 +01:00
use-after-scope-dtor-order.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-goto.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-if.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-inlined.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-loop-bug.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-loop-removed.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-loop.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-nobug.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-setjmp.cpp [hwasan] work around lifetime issue with setjmp. 2022-02-01 12:14:20 -08:00
use-after-scope-temp.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-temp2.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
use-after-scope-types.cpp [hwasan] Test use-after-scope with -fno-exceptions. 2021-09-06 10:10:09 +01:00
use-after-scope.cpp [hwasan] Detect use after scope within function. 2021-08-02 11:34:12 +01:00
wild-free-close.c [hwasan] Fix wild free tests on x86. 2021-08-13 11:56:02 +01:00
wild-free-realloc.c [hwasan] do not check if freed pointer belonged to allocator. 2021-08-25 09:31:01 +01:00
wild-free-shadow.c [hwasan] Fix wild free tests on x86. 2021-08-13 11:56:02 +01:00
wild-free.c [hwasan] do not check if freed pointer belonged to allocator. 2021-08-25 09:31:01 +01:00