Merge "[MTE] add sysprop to set mte state globally" am: 2be3e92943 am: 3e3a2ffa68 am: d914acc3cc

Original change: https://android-review.googlesource.com/c/platform/bionic/+/1959650

Change-Id: Ib494ff5454e2ba5e0e2c7bba63d7b43d554d406e
This commit is contained in:
Treehugger Robot 2022-02-08 19:24:21 +00:00 committed by Automerger Merge Worker
commit 1066ef123b

View file

@ -237,6 +237,7 @@ static unsigned __get_memtag_note(const ElfW(Phdr)* phdr_start, size_t phdr_ct,
// 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 @@ static bool get_environment_memtag_setting(HeapTaggingLevel* level) {
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;
}