• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2020 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 // clang-format off
18 #include "native_bridge_support/vdso/interceptable_functions.h"
19 
20 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AFileDescriptor_create);
21 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AFileDescriptor_getFd);
22 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AFileDescriptor_setFd);
23 DEFINE_INTERCEPTABLE_STUB_FUNCTION(DlCloseLibrary);
24 DEFINE_INTERCEPTABLE_STUB_FUNCTION(DlGetError);
25 DEFINE_INTERCEPTABLE_STUB_FUNCTION(DlGetSymbol);
26 DEFINE_INTERCEPTABLE_STUB_FUNCTION(DlOpenLibrary);
27 DEFINE_INTERCEPTABLE_STUB_FUNCTION(EnsureInitialized);
28 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ExpandableStringAppend);
29 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ExpandableStringAssign);
30 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ExpandableStringInitialize);
31 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ExpandableStringRelease);
32 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JNI_CreateJavaVM);
33 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JNI_GetCreatedJavaVMs);
34 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JNI_GetDefaultJavaVMInitArgs);
35 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_FileDescriptorClass);
36 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_FileDescriptor_descriptor);
37 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_FileDescriptor_init);
38 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NIOAccessClass);
39 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NIOAccess_getBaseArray);
40 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NIOAccess_getBaseArrayOffset);
41 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBufferClass);
42 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer__elementSizeShift);
43 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_address);
44 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_array);
45 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_arrayOffset);
46 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_limit);
47 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_position);
48 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationCreate);
49 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationDestroy);
50 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationGetLibrary);
51 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationGetLibraryWith);
52 DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationInit);
53 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniCreateString);
54 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniGetNioBufferBaseArray);
55 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniGetNioBufferBaseArrayOffset);
56 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniGetNioBufferFields);
57 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniGetNioBufferPointer);
58 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniLogException);
59 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniRegisterNativeMethods);
60 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowErrnoException);
61 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowException);
62 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowExceptionFmt);
63 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowIOException);
64 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowNullPointerException);
65 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowRuntimeException);
66 DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniUninitializeConstants);
67 
init_stub_library()68 static void __attribute__((constructor(0))) init_stub_library() {
69   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", AFileDescriptor_create);
70   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", AFileDescriptor_getFd);
71   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", AFileDescriptor_setFd);
72   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", DlCloseLibrary);
73   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", DlGetError);
74   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", DlGetSymbol);
75   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", DlOpenLibrary);
76   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", EnsureInitialized);
77   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", ExpandableStringAppend);
78   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", ExpandableStringAssign);
79   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", ExpandableStringInitialize);
80   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", ExpandableStringRelease);
81   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JNI_CreateJavaVM);
82   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JNI_GetCreatedJavaVMs);
83   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JNI_GetDefaultJavaVMInitArgs);
84   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_FileDescriptorClass);
85   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_FileDescriptor_descriptor);
86   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_FileDescriptor_init);
87   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NIOAccessClass);
88   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NIOAccess_getBaseArray);
89   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NIOAccess_getBaseArrayOffset);
90   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NioBufferClass);
91   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NioBuffer__elementSizeShift);
92   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NioBuffer_address);
93   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NioBuffer_array);
94   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NioBuffer_arrayOffset);
95   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NioBuffer_limit);
96   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniConstants_NioBuffer_position);
97   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationCreate);
98   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationDestroy);
99   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationGetLibrary);
100   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationGetLibraryWith);
101   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationInit);
102   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniCreateString);
103   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniGetNioBufferBaseArray);
104   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniGetNioBufferBaseArrayOffset);
105   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniGetNioBufferFields);
106   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniGetNioBufferPointer);
107   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniLogException);
108   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniRegisterNativeMethods);
109   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniThrowErrnoException);
110   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniThrowException);
111   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniThrowExceptionFmt);
112   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniThrowIOException);
113   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniThrowNullPointerException);
114   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniThrowRuntimeException);
115   INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniUninitializeConstants);
116 }
117 // clang-format on
118