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 namespace __rtsan { 18 19 extern bool rtsan_initialized; 20 extern bool rtsan_init_is_running; 21 22 } // namespace __rtsan 23 24 // Initialise rtsan interceptors. 25 // A call to this method is added to the preinit array on Linux systems. 26 SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_init(); 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 // Disable all RTSan error reporting. 40 // Injected into the code if "nosanitize(realtime)" is on a function. 41 SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_off(); 42 43 // Re-enable all RTSan error reporting. 44 // The counterpart to `__rtsan_off`. 45 SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_on(); 46 47 } // extern "C" 48