diff options
author | Mitch Phillips <mitchp@google.com> | 2024-04-10 09:30:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-10 09:30:58 +0000 |
commit | 4435aff516386fad9694b38eedb55032e0027381 (patch) | |
tree | ae0ddbe58003535ad2ac074fd7acdd43b4cc3d16 | |
parent | 3db97c73a2fba114bef335c31bc1e5a08a850bac (diff) | |
parent | aa8c229e7dd4eeea509fae7fc80614053853119a (diff) | |
download | bionic-4435aff516386fad9694b38eedb55032e0027381.tar.gz |
Merge "[GWP-ASan] Use recoverable everywhere" into main
-rw-r--r-- | libc/bionic/gwp_asan_wrappers.cpp | 14 | ||||
-rw-r--r-- | libc/platform/bionic/malloc.h | 4 |
2 files changed, 11 insertions, 7 deletions
diff --git a/libc/bionic/gwp_asan_wrappers.cpp b/libc/bionic/gwp_asan_wrappers.cpp index 251633d78..11f7cedd2 100644 --- a/libc/bionic/gwp_asan_wrappers.cpp +++ b/libc/bionic/gwp_asan_wrappers.cpp @@ -258,14 +258,14 @@ void SetDefaultGwpAsanOptions(Options* options, unsigned* process_sample_rate, options->Backtrace = android_unsafe_frame_pointer_chase; options->SampleRate = kDefaultSampleRate; options->MaxSimultaneousAllocations = kDefaultMaxAllocs; + options->Recoverable = true; + GwpAsanRecoverable = true; - *process_sample_rate = 1; - if (mallopt_options.desire == Action::TURN_ON_WITH_SAMPLING) { + if (mallopt_options.desire == Action::TURN_ON_WITH_SAMPLING || + mallopt_options.desire == Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING) { *process_sample_rate = kDefaultProcessSampling; - } else if (mallopt_options.desire == Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING) { - *process_sample_rate = kDefaultProcessSampling; - options->Recoverable = true; - GwpAsanRecoverable = true; + } else { + *process_sample_rate = 1; } } @@ -403,7 +403,7 @@ bool GetGwpAsanOptions(Options* options, unsigned* process_sample_rate, /* default */ kDefaultMaxAllocs / frequency_multiplier; } - bool recoverable = false; + bool recoverable = true; if (GetGwpAsanBoolOption(&recoverable, mallopt_options, kRecoverableSystemSysprop, kRecoverableAppSysprop, kRecoverableTargetedSyspropPrefix, kRecoverableEnvVar, "recoverable")) { diff --git a/libc/platform/bionic/malloc.h b/libc/platform/bionic/malloc.h index a06b8ee30..ffc6d4a43 100644 --- a/libc/platform/bionic/malloc.h +++ b/libc/platform/bionic/malloc.h @@ -152,6 +152,10 @@ typedef struct { // mode, and bug reports will be created by debuggerd, however the process // will recover and continue to function as if the memory safety bug wasn't // detected. + // + // In Android 15, this is the same as TURN_ON_WITH_SAMPLING, as GWP-ASan is + // only ever used in non-crashing mode (even for platform executables and + // system apps). TURN_ON_FOR_APP_SAMPLED_NON_CRASHING, }; |