111
|
1 //===-- interception_linux.h ------------------------------------*- C++ -*-===//
|
|
2 //
|
145
|
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
|
111
|
6 //
|
|
7 //===----------------------------------------------------------------------===//
|
|
8 //
|
|
9 // This file is a part of AddressSanitizer, an address sanity checker.
|
|
10 //
|
|
11 // Linux-specific interception methods.
|
|
12 //===----------------------------------------------------------------------===//
|
|
13
|
145
|
14 #if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD || \
|
|
15 SANITIZER_OPENBSD || SANITIZER_SOLARIS
|
111
|
16
|
|
17 #if !defined(INCLUDED_FROM_INTERCEPTION_LIB)
|
|
18 # error "interception_linux.h should be included from interception library only"
|
|
19 #endif
|
|
20
|
|
21 #ifndef INTERCEPTION_LINUX_H
|
|
22 #define INTERCEPTION_LINUX_H
|
|
23
|
|
24 namespace __interception {
|
145
|
25 bool InterceptFunction(const char *name, uptr *ptr_to_real, uptr func,
|
|
26 uptr wrapper);
|
|
27 bool InterceptFunction(const char *name, const char *ver, uptr *ptr_to_real,
|
|
28 uptr func, uptr wrapper);
|
111
|
29 } // namespace __interception
|
|
30
|
145
|
31 #define INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func) \
|
|
32 ::__interception::InterceptFunction( \
|
|
33 #func, \
|
|
34 (::__interception::uptr *) & REAL(func), \
|
|
35 (::__interception::uptr) & (func), \
|
111
|
36 (::__interception::uptr) & WRAP(func))
|
|
37
|
145
|
38 // Android, Solaris and OpenBSD do not have dlvsym
|
|
39 #if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_OPENBSD
|
111
|
40 #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
|
145
|
41 ::__interception::InterceptFunction( \
|
|
42 #func, symver, \
|
|
43 (::__interception::uptr *) & REAL(func), \
|
|
44 (::__interception::uptr) & (func), \
|
|
45 (::__interception::uptr) & WRAP(func))
|
111
|
46 #else
|
|
47 #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
|
|
48 INTERCEPT_FUNCTION_LINUX_OR_FREEBSD(func)
|
145
|
49 #endif // !SANITIZER_ANDROID && !SANITIZER_SOLARIS
|
111
|
50
|
|
51 #endif // INTERCEPTION_LINUX_H
|
145
|
52 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_NETBSD ||
|
|
53 // SANITIZER_OPENBSD || SANITIZER_SOLARIS
|