diff options
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 |