diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-01-27 21:09:27 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-01-27 21:09:27 +0000 |
commit | cdebaffea49d88a1416c839f81d492b30f1539e6 (patch) | |
tree | e67dfdad097f8d00909ad36fb1e6ff578b26142b /libc | |
parent | e91aebd4fea8d8a0e8a36c61b124be72a08d50ad (diff) | |
parent | 347b01b58324516941b338614dec33cc59c6e018 (diff) |
Merge "[MTE] Change scudo init order to get correct PROT_MTE pages."
Diffstat (limited to 'libc')
-rw-r--r-- | libc/bionic/libc_init_common.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp index f2c3f1c68..01cd2e591 100644 --- a/libc/bionic/libc_init_common.cpp +++ b/libc/bionic/libc_init_common.cpp @@ -87,6 +87,11 @@ static void arc4random_fork_handler() { } void __libc_init_scudo() { + // Heap tagging level *must* be set before interacting with Scudo, otherwise + // the primary will be mapped with PROT_MTE even if MTE is is not enabled in + // this process. + SetDefaultHeapTaggingLevel(); + // TODO(b/158870657) make this unconditional when all devices support SCUDO. #if defined(USE_SCUDO) #if defined(SCUDO_PATTERN_FILL_CONTENTS) @@ -95,7 +100,6 @@ void __libc_init_scudo() { scudo_malloc_set_zero_contents(1); #endif #endif - SetDefaultHeapTaggingLevel(); } __BIONIC_WEAK_FOR_NATIVE_BRIDGE |