diff options
author | Martin Liska <mliska@suse.cz> | 2022-08-30 11:45:34 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-08-30 12:53:50 +0200 |
commit | 600413c4f3d70392285192fb99634bcbeb97f83f (patch) | |
tree | 0586f1cc2feaa4f5a3d632926b08bde261c39786 /libsanitizer/hwasan/hwasan.cpp | |
parent | bdd3547ae4279c14a9db883719c9648ed09dc18a (diff) | |
download | gcc-600413c4f3d70392285192fb99634bcbeb97f83f.zip gcc-600413c4f3d70392285192fb99634bcbeb97f83f.tar.gz gcc-600413c4f3d70392285192fb99634bcbeb97f83f.tar.bz2 |
libsanitizer: merge from master (84a71d5259c2682403cdbd8710592410a2f128ab)
Diffstat (limited to 'libsanitizer/hwasan/hwasan.cpp')
-rw-r--r-- | libsanitizer/hwasan/hwasan.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libsanitizer/hwasan/hwasan.cpp b/libsanitizer/hwasan/hwasan.cpp index f8725a1..bb946c2 100644 --- a/libsanitizer/hwasan/hwasan.cpp +++ b/libsanitizer/hwasan/hwasan.cpp @@ -218,8 +218,8 @@ void HandleTagMismatch(AccessInfo ai, uptr pc, uptr frame, void *uc, registers_frame); } -void HwasanTagMismatch(uptr addr, uptr access_info, uptr *registers_frame, - size_t outsize) { +void HwasanTagMismatch(uptr addr, uptr pc, uptr frame, uptr access_info, + uptr *registers_frame, size_t outsize) { __hwasan::AccessInfo ai; ai.is_store = access_info & 0x10; ai.is_load = !ai.is_store; @@ -230,9 +230,7 @@ void HwasanTagMismatch(uptr addr, uptr access_info, uptr *registers_frame, else ai.size = 1 << (access_info & 0xf); - HandleTagMismatch(ai, (uptr)__builtin_return_address(0), - (uptr)__builtin_frame_address(0), nullptr, registers_frame); - __builtin_unreachable(); + HandleTagMismatch(ai, pc, frame, nullptr, registers_frame); } Thread *GetCurrentThread() { @@ -576,6 +574,12 @@ u8 __hwasan_generate_tag() { return t->GenerateRandomTag(); } +void __hwasan_add_frame_record(u64 frame_record_info) { + Thread *t = GetCurrentThread(); + if (t) + t->stack_allocations()->push(frame_record_info); +} + #if !SANITIZER_SUPPORTS_WEAK_HOOKS extern "C" { SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE @@ -594,7 +598,9 @@ void __sanitizer_print_stack_trace() { // rest of the mismatch handling code (C++). void __hwasan_tag_mismatch4(uptr addr, uptr access_info, uptr *registers_frame, size_t outsize) { - __hwasan::HwasanTagMismatch(addr, access_info, registers_frame, outsize); + __hwasan::HwasanTagMismatch(addr, (uptr)__builtin_return_address(0), + (uptr)__builtin_frame_address(0), access_info, + registers_frame, outsize); } } // extern "C" |