[compiler-rt] [compiler-rt][hwasan] Add fiber switch for HwASan (PR #153822)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 15 21:54:32 PDT 2025


================
@@ -226,3 +280,34 @@ void PrintThreads() {
 }
 
 }  // namespace __lsan
+
+// ---------------------- Interface ---------------- {{{1
+using namespace __hwasan;
+
+extern "C" {
+SANITIZER_INTERFACE_ATTRIBUTE
+void __sanitizer_start_switch_fiber(void **unused, const void *bottom,
+                                    uptr size) {
+  // this is just a placeholder which make the interface same as ASan
+  (void)unused;
+  auto *t = GetCurrentThread();
+  if (!t) {
+    VReport(1, "__hwasan_start_switch_fiber called from unknown thread\n");
+    return;
+  }
+  t->StartSwitchFiber((uptr)bottom, size);
+}
+
+SANITIZER_INTERFACE_ATTRIBUTE
+void __sanitizer_finish_switch_fiber(void *unused, const void **bottom_old,
+                                     uptr *size_old) {
+  // this is just a placeholder which make the interface same as ASan
+  (void)unused;
----------------
Tomahawkd wrote:

Fixed

https://github.com/llvm/llvm-project/pull/153822


More information about the llvm-commits mailing list