[clang] [compiler-rt] [compiler-rt] Realtime Sanitizer: Introduce RADSan backend (PR #92460)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 20:10:28 PDT 2024


================
@@ -0,0 +1,413 @@
+//===--- radsan_interceptors.cpp - Realtime Sanitizer --------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+//===----------------------------------------------------------------------===//
+
+#include "radsan/radsan_interceptors.h"
+
+#include "sanitizer_common/sanitizer_platform.h"
+#include "sanitizer_common/sanitizer_platform_interceptors.h"
+
+#include "interception/interception.h"
+#include "radsan/radsan_context.h"
+
+#if !SANITIZER_LINUX && !SANITIZER_APPLE
+#error Sorry, radsan does not yet support this platform
+#endif
+
+#if SANITIZER_APPLE
+#include <libkern/OSAtomic.h>
+#include <os/lock.h>
+#endif
+
+#if SANITIZER_INTERCEPT_MEMALIGN || SANITIZER_INTERCEPT_PVALLOC
+#include <malloc.h>
+#endif
+
+#include <fcntl.h>
+#include <pthread.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/socket.h>
+#include <time.h>
+#include <unistd.h>
+
+using namespace __sanitizer;
+
+namespace radsan {
+void ExpectNotRealtime(const char *InterceptedFunctionName) {
+  GetContextForThisThread().ExpectNotRealtime(InterceptedFunctionName);
+}
+} // namespace radsan
+
+/*
----------------
MaskRay wrote:

Avoid `/*` in C++ files

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


More information about the llvm-commits mailing list