blob: e0d9d15377d8dfc1797dc2c9eb09cf33927745bb [file] [log] [blame]
Bob Badour07562132020-05-20 13:18:00 +00001//
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
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020020DEFINE_INTERCEPTABLE_STUB_FUNCTION(AFileDescriptor_create);
Orion Hodson3ae12852021-04-30 17:36:35 +010021DEFINE_INTERCEPTABLE_STUB_FUNCTION(AFileDescriptor_getFd);
Orion Hodson3ae12852021-04-30 17:36:35 +010022DEFINE_INTERCEPTABLE_STUB_FUNCTION(AFileDescriptor_setFd);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020023DEFINE_INTERCEPTABLE_STUB_FUNCTION(DlCloseLibrary);
24DEFINE_INTERCEPTABLE_STUB_FUNCTION(DlGetError);
25DEFINE_INTERCEPTABLE_STUB_FUNCTION(DlGetSymbol);
26DEFINE_INTERCEPTABLE_STUB_FUNCTION(DlOpenLibrary);
27DEFINE_INTERCEPTABLE_STUB_FUNCTION(EnsureInitialized);
28DEFINE_INTERCEPTABLE_STUB_FUNCTION(ExpandableStringAppend);
29DEFINE_INTERCEPTABLE_STUB_FUNCTION(ExpandableStringAssign);
30DEFINE_INTERCEPTABLE_STUB_FUNCTION(ExpandableStringInitialize);
31DEFINE_INTERCEPTABLE_STUB_FUNCTION(ExpandableStringRelease);
Bob Badour07562132020-05-20 13:18:00 +000032DEFINE_INTERCEPTABLE_STUB_FUNCTION(JNI_CreateJavaVM);
33DEFINE_INTERCEPTABLE_STUB_FUNCTION(JNI_GetCreatedJavaVMs);
34DEFINE_INTERCEPTABLE_STUB_FUNCTION(JNI_GetDefaultJavaVMInitArgs);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020035DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_FileDescriptorClass);
36DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_FileDescriptor_descriptor);
37DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_FileDescriptor_init);
38DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NIOAccessClass);
39DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NIOAccess_getBaseArray);
40DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NIOAccess_getBaseArrayOffset);
41DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBufferClass);
42DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer__elementSizeShift);
43DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_address);
44DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_array);
45DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_arrayOffset);
46DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_limit);
47DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniConstants_NioBuffer_position);
Bob Badour07562132020-05-20 13:18:00 +000048DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationCreate);
49DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationDestroy);
50DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationGetLibrary);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020051DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationGetLibraryWith);
Bob Badour07562132020-05-20 13:18:00 +000052DEFINE_INTERCEPTABLE_STUB_FUNCTION(JniInvocationInit);
Bob Badour07562132020-05-20 13:18:00 +000053DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniCreateString);
Bob Badour07562132020-05-20 13:18:00 +000054DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniGetNioBufferBaseArray);
55DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniGetNioBufferBaseArrayOffset);
56DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniGetNioBufferFields);
57DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniGetNioBufferPointer);
Bob Badour07562132020-05-20 13:18:00 +000058DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniLogException);
59DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniRegisterNativeMethods);
Orion Hodson5ab419c2021-05-20 09:54:00 +010060DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowErrnoException);
Bob Badour07562132020-05-20 13:18:00 +000061DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowException);
62DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowExceptionFmt);
63DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowIOException);
64DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowNullPointerException);
65DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniThrowRuntimeException);
66DEFINE_INTERCEPTABLE_STUB_FUNCTION(jniUninitializeConstants);
Bob Badour07562132020-05-20 13:18:00 +000067
68static void __attribute__((constructor(0))) init_stub_library() {
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020069 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", AFileDescriptor_create);
Orion Hodson3ae12852021-04-30 17:36:35 +010070 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", AFileDescriptor_getFd);
Orion Hodson3ae12852021-04-30 17:36:35 +010071 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", AFileDescriptor_setFd);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020072 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);
Bob Badour07562132020-05-20 13:18:00 +000081 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);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020084 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);
Bob Badour07562132020-05-20 13:18:00 +000097 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationCreate);
98 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationDestroy);
99 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationGetLibrary);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +0200100 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationGetLibraryWith);
Bob Badour07562132020-05-20 13:18:00 +0000101 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", JniInvocationInit);
Bob Badour07562132020-05-20 13:18:00 +0000102 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniCreateString);
Bob Badour07562132020-05-20 13:18:00 +0000103 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);
Bob Badour07562132020-05-20 13:18:00 +0000107 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniLogException);
108 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniRegisterNativeMethods);
Orion Hodson5ab419c2021-05-20 09:54:00 +0100109 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativehelper.so", jniThrowErrnoException);
Bob Badour07562132020-05-20 13:18:00 +0000110 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);
Bob Badour07562132020-05-20 13:18:00 +0000116}
117// clang-format on