From 7a6079000c1432571bd4e2c3271f45b63342e14c Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Fri, 16 Sep 2022 13:05:49 -0700 Subject: [PATCH] [MTE] add device config for permissive mode Change-Id: Ifb16c0f29f07870f59ab50522d010689ee232de8 --- debuggerd/handler/debuggerd_handler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp index 55770f13d..c64de0e9e 100644 --- a/debuggerd/handler/debuggerd_handler.cpp +++ b/debuggerd/handler/debuggerd_handler.cpp @@ -103,9 +103,15 @@ static bool property_parse_bool(const char* name) { static bool is_permissive_mte() { // Environment variable for testing or local use from shell. char* permissive_env = getenv("MTE_PERMISSIVE"); + char process_sysprop_name[512]; + async_safe_format_buffer(process_sysprop_name, sizeof(process_sysprop_name), + "persist.device_config.memory_safety_native.permissive.process.%s", + getprogname()); // DO NOT REPLACE this with GetBoolProperty. That uses std::string which allocates, so it is // not async-safe (and this functiong gets used in a signal handler). return property_parse_bool("persist.sys.mte.permissive") || + property_parse_bool("persist.device_config.memory_safety_native.permissive.default") || + property_parse_bool(process_sysprop_name) || (permissive_env && ParseBool(permissive_env) == ParseBoolResult::kTrue); }