[compiler-rt] 033af5a - [compiler-rt][hwasan] Check address tagging mode in InitializeOsSupport on Fuchsia
Leonard Chan via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 8 11:35:01 PDT 2022
Author: Leonard Chan
Date: 2022-06-08T11:34:50-07:00
New Revision: 033af5a537e6f551827cda20fff03162c8f5b705
URL: https://github.com/llvm/llvm-project/commit/033af5a537e6f551827cda20fff03162c8f5b705
DIFF: https://github.com/llvm/llvm-project/commit/033af5a537e6f551827cda20fff03162c8f5b705.diff
LOG: [compiler-rt][hwasan] Check address tagging mode in InitializeOsSupport on Fuchsia
Differential Revision: https://reviews.llvm.org/D127262
Added:
Modified:
compiler-rt/lib/hwasan/hwasan_fuchsia.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp b/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp
index 94e5c5fb69c78..b066d4fdd1142 100644
--- a/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp
@@ -15,6 +15,9 @@
#include "sanitizer_common/sanitizer_fuchsia.h"
#if SANITIZER_FUCHSIA
+#include <zircon/features.h>
+#include <zircon/syscalls.h>
+
#include "hwasan.h"
#include "hwasan_interface_internal.h"
#include "hwasan_report.h"
@@ -182,9 +185,20 @@ void InstallAtExitHandler() {}
void HwasanInstallAtForkHandler() {}
-// TODO(fxbug.dev/81499): Once we finalize the tagged pointer ABI in zircon, we should come back
-// here and implement the appropriate check that TBI is enabled.
-void InitializeOsSupport() {}
+void InitializeOsSupport() {
+#ifdef __aarch64__
+ 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 &&
+ flags()->fail_without_syscall_abi) {
+ Printf(
+ "FATAL: HWAddressSanitizer requires a kernel with tagged address "
+ "ABI.\n");
+ Die();
+ }
+#endif
+}
} // namespace __hwasan
More information about the llvm-commits
mailing list