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(ABinderProcess_joinThreadPool);
21 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ABinderProcess_setThreadPoolMaxThreadCount);
22 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ABinderProcess_startThreadPool);
23 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_Class_define);
24 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_Class_setOnDump);
25 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_DeathRecipient_delete);
26 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_DeathRecipient_new);
27 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_Weak_delete);
28 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_Weak_new);
29 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_Weak_promote);
30 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_associateClass);
31 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_debugGetRefCount);
32 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_decStrong);
33 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_dump);
34 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_fromJavaBinder);
35 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_getCallingPid);
36 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_getCallingUid);
37 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_getClass);
38 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_getExtension);
39 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_getUserData);
40 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_incStrong);
41 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_isAlive);
42 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_isRemote);
43 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_linkToDeath);
44 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_markSystemStability);
45 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_markVendorStability);
46 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_markVintfStability);
47 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_new);
48 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_ping);
49 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_prepareTransaction);
50 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_setExtension);
51 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_toJavaBinder);
52 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_transact);
53 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AIBinder_unlinkToDeath);
54 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_delete);
55 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_fromJavaParcel);
56 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_getDataPosition);
57 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readBool);
58 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readBoolArray);
59 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readByte);
60 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readByteArray);
61 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readChar);
62 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readCharArray);
63 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readDouble);
64 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readDoubleArray);
65 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readFloat);
66 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readFloatArray);
67 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readInt32);
68 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readInt32Array);
69 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readInt64);
70 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readInt64Array);
71 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readParcelFileDescriptor);
72 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readParcelableArray);
73 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readStatusHeader);
74 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readString);
75 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readStringArray);
76 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readStrongBinder);
77 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readUint32);
78 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readUint32Array);
79 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readUint64);
80 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_readUint64Array);
81 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_setDataPosition);
82 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeBool);
83 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeBoolArray);
84 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeByte);
85 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeByteArray);
86 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeChar);
87 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeCharArray);
88 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeDouble);
89 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeDoubleArray);
90 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeFloat);
91 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeFloatArray);
92 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeInt32);
93 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeInt32Array);
94 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeInt64);
95 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeInt64Array);
96 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeParcelFileDescriptor);
97 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeParcelableArray);
98 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeStatusHeader);
99 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeString);
100 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeStringArray);
101 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeStrongBinder);
102 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeUint32);
103 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeUint32Array);
104 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeUint64);
105 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AParcel_writeUint64Array);
106 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AServiceManager_addService);
107 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AServiceManager_checkService);
108 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AServiceManager_getService);
109 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_delete);
110 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_deleteDescription);
111 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_fromExceptionCode);
112 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_fromExceptionCodeWithMessage);
113 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_fromServiceSpecificError);
114 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_fromServiceSpecificErrorWithMessage);
115 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_fromStatus);
116 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_getDescription);
117 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_getExceptionCode);
118 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_getMessage);
119 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_getServiceSpecificError);
120 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_getStatus);
121 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_isOk);
122 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AStatus_newOk);
123
init_stub_library()124 static void __attribute__((constructor(0))) init_stub_library() {
125 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", ABinderProcess_joinThreadPool);
126 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", ABinderProcess_setThreadPoolMaxThreadCount);
127 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", ABinderProcess_startThreadPool);
128 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_Class_define);
129 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_Class_setOnDump);
130 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_DeathRecipient_delete);
131 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_DeathRecipient_new);
132 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_Weak_delete);
133 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_Weak_new);
134 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_Weak_promote);
135 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_associateClass);
136 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_debugGetRefCount);
137 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_decStrong);
138 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_dump);
139 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_fromJavaBinder);
140 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_getCallingPid);
141 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_getCallingUid);
142 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_getClass);
143 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_getExtension);
144 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_getUserData);
145 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_incStrong);
146 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_isAlive);
147 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_isRemote);
148 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_linkToDeath);
149 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_markSystemStability);
150 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_markVendorStability);
151 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_markVintfStability);
152 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_new);
153 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_ping);
154 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_prepareTransaction);
155 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_setExtension);
156 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_toJavaBinder);
157 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_transact);
158 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AIBinder_unlinkToDeath);
159 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_delete);
160 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_fromJavaParcel);
161 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_getDataPosition);
162 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readBool);
163 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readBoolArray);
164 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readByte);
165 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readByteArray);
166 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readChar);
167 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readCharArray);
168 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readDouble);
169 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readDoubleArray);
170 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readFloat);
171 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readFloatArray);
172 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readInt32);
173 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readInt32Array);
174 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readInt64);
175 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readInt64Array);
176 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readParcelFileDescriptor);
177 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readParcelableArray);
178 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readStatusHeader);
179 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readString);
180 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readStringArray);
181 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readStrongBinder);
182 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readUint32);
183 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readUint32Array);
184 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readUint64);
185 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_readUint64Array);
186 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_setDataPosition);
187 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeBool);
188 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeBoolArray);
189 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeByte);
190 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeByteArray);
191 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeChar);
192 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeCharArray);
193 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeDouble);
194 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeDoubleArray);
195 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeFloat);
196 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeFloatArray);
197 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeInt32);
198 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeInt32Array);
199 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeInt64);
200 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeInt64Array);
201 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeParcelFileDescriptor);
202 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeParcelableArray);
203 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeStatusHeader);
204 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeString);
205 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeStringArray);
206 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeStrongBinder);
207 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeUint32);
208 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeUint32Array);
209 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeUint64);
210 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AParcel_writeUint64Array);
211 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AServiceManager_addService);
212 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AServiceManager_checkService);
213 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AServiceManager_getService);
214 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_delete);
215 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_deleteDescription);
216 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_fromExceptionCode);
217 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_fromExceptionCodeWithMessage);
218 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_fromServiceSpecificError);
219 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_fromServiceSpecificErrorWithMessage);
220 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_fromStatus);
221 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_getDescription);
222 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_getExceptionCode);
223 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_getMessage);
224 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_getServiceSpecificError);
225 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_getStatus);
226 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_isOk);
227 INIT_INTERCEPTABLE_STUB_FUNCTION("libbinder_ndk.so", AStatus_newOk);
228 }
229 // clang-format on
230