Decrease logspam of stack MTE remapping.
Currently the log is called for each library that's loaded with MTE
stack. For apps that are a launched with stack MTE (e.g. the CTS test
apps), this causes ~40 or so loglines telling us that the stack is being
remapped.
Instead, make it log only once, the first time it's remapped.
Bug: N/A
Test: blatant visual code inspection
Change-Id: If2883bc2355318b1db83f0c5ccb67050a457b52e
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
index 2dde2f1..541e71c 100644
--- a/libc/bionic/libc_init_dynamic.cpp
+++ b/libc/bionic/libc_init_dynamic.cpp
@@ -61,8 +61,9 @@
};
void memtag_stack_dlopen_callback() {
- async_safe_format_log(ANDROID_LOG_DEBUG, "libc", "remapping stacks as PROT_MTE");
- __pthread_internal_remap_stack_with_mte();
+ if (__pthread_internal_remap_stack_with_mte()) {
+ async_safe_format_log(ANDROID_LOG_DEBUG, "libc", "remapped stacks as PROT_MTE");
+ }
}
// Use an initializer so __libc_sysinfo will have a fallback implementation