llvm-project
37 строк · 1.1 Кб
1//===--- rtsan.cpp - 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#include <rtsan/rtsan.h>
12#include <rtsan/rtsan_context.h>
13#include <rtsan/rtsan_interceptors.h>
14
15extern "C" {
16
17SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_init() {
18__rtsan::InitializeInterceptors();
19}
20
21SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_realtime_enter() {
22__rtsan::GetContextForThisThread().RealtimePush();
23}
24
25SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_realtime_exit() {
26__rtsan::GetContextForThisThread().RealtimePop();
27}
28
29SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_off() {
30__rtsan::GetContextForThisThread().BypassPush();
31}
32
33SANITIZER_INTERFACE_ATTRIBUTE void __rtsan_on() {
34__rtsan::GetContextForThisThread().BypassPop();
35}
36
37} // extern "C"
38