xref: /llvm-project/compiler-rt/lib/rtsan/rtsan.h (revision 1b6019388c17657c1c07f1e3123a7b4000f94490)
1 //===--- rtsan.h - Realtime Sanitizer ---------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #pragma once
12 
13 #include "sanitizer_common/sanitizer_internal_defs.h"
14 
15 extern "C" {
16 
17 // Initialise rtsan interceptors.
18 // A call to this method is added to the preinit array on Linux systems.
19 SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_init();
20 
21 // Initializes rtsan if it has not been initialized yet.
22 // Used by the RTSan runtime to ensure that rtsan is initialized before any
23 // other rtsan functions are called.
24 SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_ensure_initialized();
25 
26 SANITIZER_INTERFACE_ATTRIBUTE bool __rtsan_is_initialized();
27 
28 // Enter real-time context.
29 // When in a real-time context, RTSan interceptors will error if realtime
30 // violations are detected. Calls to this method are injected at the code
31 // generation stage when RTSan is enabled.
32 SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_realtime_enter();
33 
34 // Exit the real-time context.
35 // When not in a real-time context, RTSan interceptors will simply forward
36 // intercepted method calls to the real methods.
37 SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_realtime_exit();
38 
39 // See documentation in rtsan_interface.h.
40 SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_disable();
41 
42 // See documentation in rtsan_interface.h.
43 SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_enable();
44 
45 SANITIZER_INTERFACE_ATTRIBUTE void
46 __rtsan_notify_intercepted_call(const char *intercepted_function_name);
47 
48 SANITIZER_INTERFACE_ATTRIBUTE void
49 __rtsan_notify_blocking_call(const char *blocking_function_name);
50 } // extern "C"
51