[hwasan][fuchsia] Fix features bitmask checking
authorLeonard Chan <leonardchan@google.com>
Thu, 7 Jul 2022 21:42:08 +0000 (14:42 -0700)
committerLeonard Chan <leonardchan@google.com>
Thu, 7 Jul 2022 21:43:00 +0000 (14:43 -0700)
Update the address tagging bitmask check to just see if
ZX_ARM64_FEATURE_ADDRESS_TAGGING_TBI is enabled rather than checking
if it's the only thing that's enabled.

Differential Revision: https://reviews.llvm.org/D129318

compiler-rt/lib/hwasan/hwasan_fuchsia.cpp

index b066d4f..967c796 100644 (file)
@@ -190,11 +190,11 @@ void InitializeOsSupport() {
   uint32_t features = 0;
   CHECK_EQ(zx_system_get_features(ZX_FEATURE_KIND_ADDRESS_TAGGING, &features),
            ZX_OK);
-  if (features != ZX_ARM64_FEATURE_ADDRESS_TAGGING_TBI &&
+  if (!(features & ZX_ARM64_FEATURE_ADDRESS_TAGGING_TBI) &&
       flags()->fail_without_syscall_abi) {
     Printf(
-        "FATAL: HWAddressSanitizer requires a kernel with tagged address "
-        "ABI.\n");
+        "FATAL: HWAddressSanitizer requires "
+        "ZX_ARM64_FEATURE_ADDRESS_TAGGING_TBI.\n");
     Die();
   }
 #endif