summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2020-07-31 00:18:38 +0000
committerSteven Moreland <smoreland@google.com>2020-07-31 17:45:44 +0000
commitfb65ee4c47f374fd75e6e994f32edc4224c6442a (patch)
treefee60e9b2b6e0478fd208e1556ddd8d12d023a05
parent9c6d60d073db079a87fbeb5de3e72ac12838a480 (diff)
SCUDO fill options only when USE_SCUDO
For vanity reasons, this CL should be reverted after b/158870657, since we want to make sure zero/pattern fill always happen when they are requested. Bug: 131355925 Bug: 158870657 Test: check build on normal devices hits USE_SCUDO branch with #error Change-Id: I22d19dbc75004c8f7437e1247226bc3275cd4df5
-rw-r--r--libc/Android.bp3
-rw-r--r--libc/bionic/libc_init_common.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/libc/Android.bp b/libc/Android.bp
index 48c9dd044..80e3b629f 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -100,6 +100,9 @@ cc_defaults {
malloc_pattern_fill_contents: {
cflags: ["-DSCUDO_PATTERN_FILL_CONTENTS"],
},
+ malloc_not_svelte: {
+ cflags: ["-DUSE_SCUDO"],
+ },
},
}
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
index f1350d5f9..01b6a42f0 100644
--- a/libc/bionic/libc_init_common.cpp
+++ b/libc/bionic/libc_init_common.cpp
@@ -86,11 +86,14 @@ static void arc4random_fork_handler() {
}
static void __libc_init_malloc_fill_contents() {
+// TODO(b/158870657) make this unconditional when all devices support SCUDO.
+#if defined(USE_SCUDO)
#if defined(SCUDO_PATTERN_FILL_CONTENTS)
scudo_malloc_set_pattern_fill_contents(1);
#elif defined(SCUDO_ZERO_CONTENTS)
scudo_malloc_set_zero_contents(1);
#endif
+#endif
}
__BIONIC_WEAK_FOR_NATIVE_BRIDGE