[MTE] add sysprop to set mte state globally
this can be used to run CTS w/ maximum MTE coverage on normal builds.
Change-Id: I527b8549f30fd4bd9511d94ca142ea08b72d1a78
diff --git a/libc/bionic/libc_init_static.cpp b/libc/bionic/libc_init_static.cpp
index 67e692c..f3caf45 100644
--- a/libc/bionic/libc_init_static.cpp
+++ b/libc/bionic/libc_init_static.cpp
@@ -237,6 +237,7 @@
// level into *level.
static bool get_environment_memtag_setting(HeapTaggingLevel* level) {
static const char kMemtagPrognameSyspropPrefix[] = "arm64.memtag.process.";
+ static const char kMemtagGlobalSysprop[] = "persist.arm64.memtag.default";
const char* progname = __libc_shared_globals()->init_progname;
if (progname == nullptr) return false;
@@ -250,9 +251,10 @@
async_safe_format_buffer(sysprop_name, sysprop_size, "%s%s", kMemtagPrognameSyspropPrefix,
basename);
+ const char* sys_prop_names[] = {sysprop_name, kMemtagGlobalSysprop};
- if (!get_config_from_env_or_sysprops("MEMTAG_OPTIONS", &sysprop_name,
- /* sys_prop_names_size */ 1, options_str, kOptionsSize)) {
+ if (!get_config_from_env_or_sysprops("MEMTAG_OPTIONS", sys_prop_names, arraysize(sys_prop_names),
+ options_str, kOptionsSize)) {
return false;
}