Merge "Remove unnecessary static variable." am: 55d286e98a am: 122ac31625

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

Change-Id: I4486d488cdab68f025db36f31e5a8c7993992385
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Florian Mayer 2022-05-11 02:24:48 +00:00 committed by Automerger Merge Worker
commit 8a1c9db8fe

View file

@ -72,23 +72,21 @@ void SetDefaultHeapTaggingLevel() {
}
static bool set_tcf_on_all_threads(int tcf) {
static int g_tcf;
g_tcf = tcf;
return android_run_on_all_threads(
[](void*) {
[](void* arg) {
int tcf = *reinterpret_cast<int*>(arg);
int tagged_addr_ctrl = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
if (tagged_addr_ctrl < 0) {
return false;
}
tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | g_tcf;
tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | tcf;
if (prctl(PR_SET_TAGGED_ADDR_CTRL, tagged_addr_ctrl, 0, 0, 0) < 0) {
return false;
}
return true;
},
nullptr);
&tcf);
}
pthread_mutex_t g_heap_tagging_lock = PTHREAD_MUTEX_INITIALIZER;