diff options
author | Tamar Christina <tamar.christina@arm.com> | 2024-01-31 14:44:35 +0000 |
---|---|---|
committer | Tamar Christina <tamar.christina@arm.com> | 2024-01-31 14:49:21 +0000 |
commit | a73421bcf301911f2cbdb1c58316ddf3473ea6d5 (patch) | |
tree | 08ff4a8c1e353e52135e036a583e59c519913729 | |
parent | 22dbfbe8767ff4c1d93e39f68ec7c2d5b1358beb (diff) | |
download | gcc-a73421bcf301911f2cbdb1c58316ddf3473ea6d5.zip gcc-a73421bcf301911f2cbdb1c58316ddf3473ea6d5.tar.gz gcc-a73421bcf301911f2cbdb1c58316ddf3473ea6d5.tar.bz2 |
libsanitizer: Sync fixes for asan interceptors from upstream
This cherry-picks and squashes the differences between commits
d3e5c20ab846303874a2a25e5877c72271fc798b..76e1e45922e6709392fb82aac44bebe3dbc2ea63
from LLVM upstream from compiler-rt/lib/hwasan/ to GCC on the changes relevant
for GCC.
This is required to fix the linked PR.
As mentioned in the PR the last sync brought in a bug from upstream[1] where
operations became non-recoverable and as such the tests in AArch64 started
failing. This cherry picks the fix and there are minor updates needed to GCC
after this to fix the cases.
[1] https://github.com/llvm/llvm-project/pull/74000
PR sanitizer/112644
Cherry-pick llvm-project revision
672b71cc1003533460a82f06b7d24fbdc02ffd58,
5fcf3bbb1acfe226572474636714ede86fffcce8,
3bded112d02632209bd55fb28c6c5c234c23dec3 and
76e1e45922e6709392fb82aac44bebe3dbc2ea63.
-rw-r--r-- | libsanitizer/hwasan/hwasan_interceptors.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/libsanitizer/hwasan/hwasan_interceptors.cpp b/libsanitizer/hwasan/hwasan_interceptors.cpp index d9237cf..96df4dd 100644 --- a/libsanitizer/hwasan/hwasan_interceptors.cpp +++ b/libsanitizer/hwasan/hwasan_interceptors.cpp @@ -36,16 +36,16 @@ struct HWAsanInterceptorContext { const char *interceptor_name; }; -# define ACCESS_MEMORY_RANGE(ctx, offset, size, access) \ - do { \ - __hwasan::CheckAddressSized<ErrorAction::Abort, access>((uptr)offset, \ - size); \ +# define ACCESS_MEMORY_RANGE(offset, size, access) \ + do { \ + __hwasan::CheckAddressSized<ErrorAction::Recover, access>((uptr)offset, \ + size); \ } while (0) -# define HWASAN_READ_RANGE(ctx, offset, size) \ - ACCESS_MEMORY_RANGE(ctx, offset, size, AccessType::Load) -# define HWASAN_WRITE_RANGE(ctx, offset, size) \ - ACCESS_MEMORY_RANGE(ctx, offset, size, AccessType::Store) +# define HWASAN_READ_RANGE(offset, size) \ + ACCESS_MEMORY_RANGE(offset, size, AccessType::Load) +# define HWASAN_WRITE_RANGE(offset, size) \ + ACCESS_MEMORY_RANGE(offset, size, AccessType::Store) # if !SANITIZER_APPLE # define HWASAN_INTERCEPT_FUNC(name) \ @@ -74,9 +74,8 @@ struct HWAsanInterceptorContext { # if HWASAN_WITH_INTERCEPTORS -# define COMMON_SYSCALL_PRE_READ_RANGE(p, s) __hwasan_loadN((uptr)p, (uptr)s) -# define COMMON_SYSCALL_PRE_WRITE_RANGE(p, s) \ - __hwasan_storeN((uptr)p, (uptr)s) +# define COMMON_SYSCALL_PRE_READ_RANGE(p, s) HWASAN_READ_RANGE(p, s) +# define COMMON_SYSCALL_PRE_WRITE_RANGE(p, s) HWASAN_WRITE_RANGE(p, s) # define COMMON_SYSCALL_POST_READ_RANGE(p, s) \ do { \ (void)(p); \ @@ -91,10 +90,10 @@ struct HWAsanInterceptorContext { # include "sanitizer_common/sanitizer_syscalls_netbsd.inc" # define COMMON_INTERCEPTOR_WRITE_RANGE(ctx, ptr, size) \ - HWASAN_WRITE_RANGE(ctx, ptr, size) + HWASAN_WRITE_RANGE(ptr, size) # define COMMON_INTERCEPTOR_READ_RANGE(ctx, ptr, size) \ - HWASAN_READ_RANGE(ctx, ptr, size) + HWASAN_READ_RANGE(ptr, size) # define COMMON_INTERCEPTOR_ENTER(ctx, func, ...) \ HWAsanInterceptorContext _ctx = {#func}; \ |