Change the android_mallopt(M_SET_HEAP_TAGGING_LEVEL) API.

- Make it apply to every thread, and thus remove the restriction
  that it must be called while the program is single threaded.
- Make it change TCF0 itself (on all threads), instead of requiring
  callers to do it themselves, which can be error prone.

And update all of the call sites.

Change the implementation of
android_mallopt(M_DISABLE_MEMORY_MITIGATIONS) to call
android_mallopt(M_SET_HEAP_TAGGING_LEVEL) internally. This avoids
crashes during startup that were observed when the two mallopts
updated TCF0 unaware of each other.

I wouldn't expect there to be any out-of-tree callers at this point,
but it's worth noting that the new interface is backwards compatible
with the old one because it strictly expands the set of situations in
which the API can be used (i.e. situations where there are multiple
threads running or where TCF0 hadn't been updated beforehand).

Bug: 135772972
Change-Id: I7746707898ff31ef2e0af01c4f55ba90b72bef51
diff --git a/sanitizer-status/sanitizer-status.cpp b/sanitizer-status/sanitizer-status.cpp
index b286c62..48399b0 100644
--- a/sanitizer-status/sanitizer-status.cpp
+++ b/sanitizer-status/sanitizer-status.cpp
@@ -287,13 +287,7 @@
       printf("MTE: PR_GET_TAGGED_ADDR_CTRL failed\n");
     }
 
-#if defined(ANDROID_EXPERIMENTAL_MTE)
-    tagged_addr_ctrl = (tagged_addr_ctrl & ~PR_MTE_TCF_MASK) | PR_MTE_TCF_SYNC;
-    if (prctl(PR_SET_TAGGED_ADDR_CTRL, tagged_addr_ctrl, 0, 0, 0) != 0) {
-      mte_failures += 1;
-      printf("MTE: PR_SET_TAGGED_ADDR_CTRL failed\n");
-    }
-#else
+#if !defined(ANDROID_EXPERIMENTAL_MTE)
     mte_failures += 1;
     printf("MTE: ANDROID_EXPERIMENTAL_MTE disabled\n");
 #endif