From 482024119179edf2f6e2aadd1efdbb69c7dada34 Mon Sep 17 00:00:00 2001 From: liuyingying19 Date: Fri, 28 Feb 2025 06:28:50 +0000 Subject: [PATCH] [Compiler-RT][HWASAN]Support do not abort after report print Signed-off-by: liuyingying19 --- compiler-rt/lib/hwasan/hwasan.cpp | 7 ++++++- .../lib/hwasan/hwasan_tag_mismatch_aarch64.S | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/hwasan/hwasan.cpp b/compiler-rt/lib/hwasan/hwasan.cpp index 41c0c8b51fdf..79e9a1b2c23b 100644 --- a/compiler-rt/lib/hwasan/hwasan.cpp +++ b/compiler-rt/lib/hwasan/hwasan.cpp @@ -232,7 +232,12 @@ void HwasanTagMismatch(uptr addr, uptr access_info, uptr *registers_frame, HandleTagMismatch(ai, (uptr)__builtin_return_address(0), (uptr)__builtin_frame_address(0), nullptr, registers_frame); - __builtin_unreachable(); + // OHOS_LOCAL begin + bool fatal = flags()->halt_on_error || !ai.recover; + if (fatal) { + // OHOS_LOCAL end + __builtin_unreachable(); + } } Thread *GetCurrentThread() { diff --git a/compiler-rt/lib/hwasan/hwasan_tag_mismatch_aarch64.S b/compiler-rt/lib/hwasan/hwasan_tag_mismatch_aarch64.S index bcb0df420190..c5df776c6e7b 100644 --- a/compiler-rt/lib/hwasan/hwasan_tag_mismatch_aarch64.S +++ b/compiler-rt/lib/hwasan/hwasan_tag_mismatch_aarch64.S @@ -145,6 +145,25 @@ __hwasan_tag_mismatch_v2: mov x2, sp bl __hwasan_tag_mismatch4 + // OHOS_LOCAL begin + ldp x2, x3, [sp, #16] + ldp x4, x5, [sp, #32] + ldp x6, x7, [sp, #48] + ldp x8, x9, [sp, #64] + ldp x10, x11, [sp, #80] + ldp x12, x13, [sp, #96] + ldp x14, x15, [sp, #112] + ldp x16, x17, [sp, #128] + ldp x18, x19, [sp, #144] + ldp x20, x21, [sp, #160] + ldp x22, x23, [sp, #176] + ldp x24, x25, [sp, #192] + ldp x26, x27, [sp, #208] + ldr x28, [sp, #224] + ldp x29, x30, [sp, #232] + ldp x0, x1, [sp], #256 + ret + // OHOS_LOCAL end CFI_ENDPROC .Lfunc_end0: -- Gitee