From 60c900a898d0d37d292b0bc102aa2846d1a73825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E9=87=91=E6=88=90?= Date: Mon, 26 Aug 2024 16:26:17 +0800 Subject: [PATCH] [UBSan][DFX] Synchronize ubsan log to faultlog Add a mark for DFX to identify ubsan log and synchronize the log file to Faultlog folder Issue: https://gitee.com/openharmony/third_party_llvm-project/issues/IAMK0Y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡金成 Change-Id: Id4d93ce92b82ed3caf3861e2de57db5484f9994d --- compiler-rt/lib/ubsan/ubsan_diag.cpp | 5 +++++ compiler-rt/lib/ubsan/ubsan_handlers.cpp | 1 - compiler-rt/lib/ubsan/ubsan_init.cpp | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cpp b/compiler-rt/lib/ubsan/ubsan_diag.cpp index 51bb3dca0a0f..15661fc3f894 100644 --- a/compiler-rt/lib/ubsan/ubsan_diag.cpp +++ b/compiler-rt/lib/ubsan/ubsan_diag.cpp @@ -402,6 +402,11 @@ ScopedReport::~ScopedReport() { if (flags()->halt_on_error) Die(); + + // OHOS_LOCAL + // a mark for DFX to identify ubsan log and synchronize the log file to faultlog folder + if (!Opts.FromUnrecoverableHandler) + Report("End Ubsan report\n"); } ALIGNED(64) static char suppression_placeholder[sizeof(SuppressionContext)]; diff --git a/compiler-rt/lib/ubsan/ubsan_handlers.cpp b/compiler-rt/lib/ubsan/ubsan_handlers.cpp index faafa92423bd..e201e6bba220 100644 --- a/compiler-rt/lib/ubsan/ubsan_handlers.cpp +++ b/compiler-rt/lib/ubsan/ubsan_handlers.cpp @@ -902,7 +902,6 @@ void __ubsan::__ubsan_handle_cfi_check_fail(CFICheckFailData *Data, handleCFIBadIcall(Data, Value, Opts); else __ubsan_handle_cfi_bad_type(Data, Value, ValidVtable, Opts); - Report("End CFI report\n"); // OHOS_LOCAL } void __ubsan::__ubsan_handle_cfi_check_fail_abort(CFICheckFailData *Data, diff --git a/compiler-rt/lib/ubsan/ubsan_init.cpp b/compiler-rt/lib/ubsan/ubsan_init.cpp index 54ff2b450519..ba7ff79f7308 100644 --- a/compiler-rt/lib/ubsan/ubsan_init.cpp +++ b/compiler-rt/lib/ubsan/ubsan_init.cpp @@ -37,7 +37,10 @@ static void CommonInit() { static void UbsanDie() { if (common_flags()->print_module_map >= 1) DumpProcessMap(); - Report("End CFI report (UbsanDie)\n"); // OHOS_LOCAL + + // OHOS_LOCAL + // a mark for DFX to identify ubsan log and synchronize the log file to faultlog folder + Report("End Ubsan report (UbsanDie)\n"); } static void CommonStandaloneInit() { -- Gitee