Merge "Fix possible issue with cfi_basic test." into rvc-dev
diff --git a/libc/Android.bp b/libc/Android.bp
index 2b1c7ca..b90908e 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -1780,6 +1780,18 @@
     ramdisk_available: true,
     recovery_available: true,
     native_bridge_supported: true,
+    apex_available: [
+        "//apex_available:platform",
+        "//apex_available:anyapex",
+    ],
+    visibility: [
+        ":__subpackages__", // visible to bionic
+        // ... and only to these places (b/152668052)
+        "//external/gwp_asan",
+        "//external/libunwind_llvm",
+        "//system/core/property_service/libpropertyinfoparser",
+        "//system/extras/toolchain-extras",
+    ],
 
     no_libcrt: true,
     stl: "none",
@@ -1911,6 +1923,10 @@
     ramdisk_available: true,
     recovery_available: true,
     native_bridge_supported: true,
+    apex_available: [
+        "//apex_available:platform",
+        "//apex_available:anyapex",
+    ],
 
     cflags: [
         "-Wno-gcc-compat",
diff --git a/libc/async_safe/Android.bp b/libc/async_safe/Android.bp
index 7df6ab9..98da2cc 100644
--- a/libc/async_safe/Android.bp
+++ b/libc/async_safe/Android.bp
@@ -18,6 +18,15 @@
     export_include_dirs: ["include"],
     export_header_lib_headers: ["liblog_headers"],
     stl: "none",
+
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.runtime",
+        "com.android.art.debug",
+        "com.android.art.release",
+        "com.android.media",
+        "com.android.media.swcodec",
+    ],
 }
 
 cc_library_headers {
@@ -31,4 +40,9 @@
 
     system_shared_libs: [],
     stl: "none",
+
+    apex_available: [
+        "//apex_available:platform",
+        "com.android.runtime",
+    ],
 }
diff --git a/libc/bionic/malloc_tagged_pointers.h b/libc/bionic/malloc_tagged_pointers.h
index 212459b..de3cc2e 100644
--- a/libc/bionic/malloc_tagged_pointers.h
+++ b/libc/bionic/malloc_tagged_pointers.h
@@ -43,10 +43,11 @@
 // is also deliberately different from the standard pattern-init tag (0xAA), as
 // to be distinguishable from an uninitialized-pointer access. The first and
 // second nibbles are also deliberately designed to be the bitset-mirror of each
-// other (0b1100, 0b0011) in order to reduce incidental matches. Users must not
-// rely on the implementation-defined value of this pointer tag, as it may
-// change.
-static constexpr uintptr_t POINTER_TAG = 0x3C;
+// other (0b1011, 0b0100) in order to reduce incidental matches. We also ensure
+// that the top bit is set, as this catches incorrect code that assumes that a
+// "negative" pointer indicates error. Users must not rely on the
+// implementation-defined value of this pointer tag, as it may change.
+static constexpr uintptr_t POINTER_TAG = 0xB4;
 static constexpr unsigned UNTAG_SHIFT = 40;
 static constexpr unsigned CHECK_SHIFT = 48;
 static constexpr unsigned TAG_SHIFT = 56;