From 4efce7ef649e5696156263aa47fae7d4aff43020 Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 25 Mar 2025 12:05:07 +0800 Subject: [PATCH] [Compier-RT][HWASAN] Fix default minimum hwasan configuration. Signed-off-by: Eric --- compiler-rt/lib/hwasan/hwasan.cpp | 6 ++++++ compiler-rt/lib/hwasan/hwasan_flags.inc | 14 -------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/compiler-rt/lib/hwasan/hwasan.cpp b/compiler-rt/lib/hwasan/hwasan.cpp index aa841067eb7f..1075785be64a 100644 --- a/compiler-rt/lib/hwasan/hwasan.cpp +++ b/compiler-rt/lib/hwasan/hwasan.cpp @@ -98,10 +98,16 @@ static void InitializeFlags() { #endif // OHOS_LOCAL begin +// Default minimum hwasan configuration #if SANITIZER_OHOS cf.handle_segv = kHandleSignalNo; cf.handle_sigbus = kHandleSignalNo; cf.handle_abort = kHandleSignalNo; + cf.allocator_may_return_null = true; + cf.log_exe_name = true; + cf.detect_leaks = false; + cf.print_module_map = 2; + cf.intercept_send = false; #endif // OHOS_LOCAL end OverrideCommonFlags(cf); diff --git a/compiler-rt/lib/hwasan/hwasan_flags.inc b/compiler-rt/lib/hwasan/hwasan_flags.inc index e5be23f218b6..2dd11b455b9e 100644 --- a/compiler-rt/lib/hwasan/hwasan_flags.inc +++ b/compiler-rt/lib/hwasan/hwasan_flags.inc @@ -136,14 +136,10 @@ HWASAN_FLAG(int, detect_odr_violation, 0, "Default does not detect single defined rule (ODR) violations.") HWASAN_FLAG(bool, alloc_dealloc_mismatch, false, "Report errors on malloc/delete, new/free, new/delete[], etc.") -HWASAN_FLAG(bool, allocator_may_return_null, true, - "If true, the allocator does not crash and returns nullptr when " - "out of memory.") HWASAN_FLAG(bool, detect_container_overflow, false, "If false, disabling out-of-bounds detection. See " "https://github.com/google/sanitizers/wiki/" "AddressSanitizerContainerOverflow") -HWASAN_FLAG(bool, detect_leaks, false, "Disable memory leak detection.") HWASAN_FLAG( int, report_globals, 0, "Controls the way to handle globals (0 - don't detect buffer overflow on " @@ -152,16 +148,6 @@ HWASAN_FLAG( HWASAN_FLAG(bool, allow_user_poisoning, true, "If set, user may manually mark memory regions as poisoned or " "unpoisoned.") -HWASAN_FLAG(bool, log_exe_name, true, - "If set true, mention name of executable when reporting error and " - "append executable name to logs (as in \"log_path.exe_name.pid\").") HWASAN_FLAG(bool, detect_stack_use_after_return, false, "Disables stack-use-after-return checking at run-time.") -HWASAN_FLAG(int, print_module_map, 2, - "Print the process module map where supported (0 - don't print, " - "1 - print only once before process exits, 2 - print after each " - "report).") -HWASAN_FLAG(bool, intercept_send, false, - "If set true, uses custom wrappers for send* functions " - "to find more errors.") // OHOS_LOCAL end \ No newline at end of file -- Gitee