aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Phillips <mitchp@google.com>2024-04-10 09:30:58 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-04-10 09:30:58 +0000
commit4435aff516386fad9694b38eedb55032e0027381 (patch)
treeae0ddbe58003535ad2ac074fd7acdd43b4cc3d16
parent3db97c73a2fba114bef335c31bc1e5a08a850bac (diff)
parentaa8c229e7dd4eeea509fae7fc80614053853119a (diff)
downloadbionic-4435aff516386fad9694b38eedb55032e0027381.tar.gz
Merge "[GWP-ASan] Use recoverable everywhere" into main
-rw-r--r--libc/bionic/gwp_asan_wrappers.cpp14
-rw-r--r--libc/platform/bionic/malloc.h4
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,
};