blob: 98c9157e0c5e414c9b02d5837ce13cb404957339 [file] [log] [blame]
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -07001//
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 Eltsindf8c79b2020-07-31 15:03:27 +020020DEFINE_INTERCEPTABLE_STUB_FUNCTION(__clone_for_fork);
Evgeny Eltsin9c4e6de2020-08-01 10:59:27 +020021DEFINE_INTERCEPTABLE_STUB_FUNCTION(__get_thread_stack_top);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -070022DEFINE_INTERCEPTABLE_STUB_FUNCTION(__pthread_cleanup_pop);
23DEFINE_INTERCEPTABLE_STUB_FUNCTION(__pthread_cleanup_push);
24DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_properties_init);
25DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_add);
26DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_area_init);
27DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_area_serial);
28DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_find);
29DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_find_nth);
30DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_foreach);
31DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_get);
32DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_read);
33DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_read_callback);
34DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_serial);
35DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_set);
36DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_set_filename);
37DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_update);
38DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_wait);
39DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_wait_any);
40DEFINE_INTERCEPTABLE_STUB_FUNCTION(_longjmp);
41DEFINE_INTERCEPTABLE_STUB_FUNCTION(_setjmp);
42DEFINE_INTERCEPTABLE_STUB_FUNCTION(android_getaddrinfofornet);
43DEFINE_INTERCEPTABLE_STUB_FUNCTION(android_getaddrinfofornetcontext);
44DEFINE_INTERCEPTABLE_STUB_FUNCTION(android_mallopt);
45DEFINE_INTERCEPTABLE_STUB_FUNCTION(android_set_abort_message);
dimitryb97e59e2021-12-08 20:41:55 +000046DEFINE_INTERCEPTABLE_STUB_FUNCTION(clock_getres);
47DEFINE_INTERCEPTABLE_STUB_FUNCTION(clock_gettime);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -070048DEFINE_INTERCEPTABLE_STUB_FUNCTION(freeaddrinfo);
49DEFINE_INTERCEPTABLE_STUB_FUNCTION(gai_strerror);
50DEFINE_INTERCEPTABLE_STUB_FUNCTION(getaddrinfo);
Lev Rumyantsevf217cee2020-10-12 17:49:02 -070051DEFINE_INTERCEPTABLE_STUB_FUNCTION(gethostbyaddr);
52DEFINE_INTERCEPTABLE_STUB_FUNCTION(gethostbyname);
53DEFINE_INTERCEPTABLE_STUB_FUNCTION(getnameinfo);
dimitryb97e59e2021-12-08 20:41:55 +000054DEFINE_INTERCEPTABLE_STUB_FUNCTION(gettimeofday);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -070055DEFINE_INTERCEPTABLE_STUB_FUNCTION(longjmp);
Evgeny Eltsin4ffcfe22020-07-31 17:56:24 +020056DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge___cxa_thread_atexit_impl);
Evgeny Eltsin3fbd9d22020-07-31 18:28:34 +020057DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_aligned_alloc);
58DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_calloc);
Evgeny Eltsine9f21962020-07-31 14:39:16 +020059DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_exit);
Evgeny Eltsin3fbd9d22020-07-31 18:28:34 +020060DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_free);
61DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_mallinfo);
62DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_malloc);
63DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_malloc_disable);
64DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_malloc_enable);
65DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_malloc_info_helper);
66DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_malloc_iterate);
67DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_malloc_usable_size);
68DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_mallopt);
69DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_memalign);
70DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_posix_memalign);
71DEFINE_INTERCEPTABLE_STUB_FUNCTION(native_bridge_realloc);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -070072DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_destroy);
73DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getdetachstate);
74DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getguardsize);
75DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getinheritsched);
76DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getschedparam);
77DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getschedpolicy);
78DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getscope);
79DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getstack);
80DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getstacksize);
81DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_init);
82DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setdetachstate);
83DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setguardsize);
84DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setinheritsched);
85DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setschedparam);
86DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setschedpolicy);
87DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setscope);
88DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setstack);
89DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setstacksize);
90DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_create);
91DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_detach);
92DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_exit);
93DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getattr_np);
94DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getcpuclockid);
95DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getname_np);
96DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getschedparam);
97DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getspecific);
98DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_gettid_np);
99DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_join);
100DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_key_create);
101DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_key_delete);
102DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_kill);
103DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_setname_np);
104DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_setschedparam);
105DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_setschedprio);
106DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_setspecific);
107DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_sigqueue);
108DEFINE_INTERCEPTABLE_STUB_FUNCTION(setjmp);
109DEFINE_INTERCEPTABLE_STUB_FUNCTION(siglongjmp);
110DEFINE_INTERCEPTABLE_STUB_FUNCTION(sigsetjmp);
dimitryb97e59e2021-12-08 20:41:55 +0000111DEFINE_INTERCEPTABLE_STUB_FUNCTION(time);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -0700112DEFINE_INTERCEPTABLE_STUB_VARIABLE(environ);
113
114static void __attribute__((constructor(0))) init_stub_library() {
Evgeny Eltsindf8c79b2020-07-31 15:03:27 +0200115 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __clone_for_fork);
Evgeny Eltsin9c4e6de2020-08-01 10:59:27 +0200116 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __get_thread_stack_top);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -0700117 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __pthread_cleanup_pop);
118 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __pthread_cleanup_push);
119 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_properties_init);
120 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_add);
121 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_area_init);
122 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_area_serial);
123 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_find);
124 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_find_nth);
125 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_foreach);
126 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_get);
127 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_read);
128 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_read_callback);
129 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_serial);
130 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_set);
131 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_set_filename);
132 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_update);
133 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_wait);
134 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_wait_any);
135 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", _longjmp);
136 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", _setjmp);
137 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", android_getaddrinfofornet);
138 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", android_getaddrinfofornetcontext);
139 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", android_mallopt);
140 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", android_set_abort_message);
dimitryb97e59e2021-12-08 20:41:55 +0000141 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", clock_getres);
142 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", clock_gettime);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -0700143 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", freeaddrinfo);
144 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", gai_strerror);
145 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", getaddrinfo);
Lev Rumyantsevf217cee2020-10-12 17:49:02 -0700146 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", gethostbyaddr);
147 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", gethostbyname);
148 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", getnameinfo);
dimitryb97e59e2021-12-08 20:41:55 +0000149 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", gettimeofday);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -0700150 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", longjmp);
Evgeny Eltsin4ffcfe22020-07-31 17:56:24 +0200151 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge___cxa_thread_atexit_impl);
Evgeny Eltsin3fbd9d22020-07-31 18:28:34 +0200152 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_aligned_alloc);
153 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_calloc);
Evgeny Eltsine9f21962020-07-31 14:39:16 +0200154 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_exit);
Evgeny Eltsin3fbd9d22020-07-31 18:28:34 +0200155 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_free);
156 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_mallinfo);
157 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_malloc);
158 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_malloc_disable);
159 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_malloc_enable);
160 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_malloc_info_helper);
161 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_malloc_iterate);
162 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_malloc_usable_size);
163 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_mallopt);
164 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_memalign);
165 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_posix_memalign);
166 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", native_bridge_realloc);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -0700167 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_destroy);
168 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getdetachstate);
169 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getguardsize);
170 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getinheritsched);
171 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getschedparam);
172 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getschedpolicy);
173 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getscope);
174 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getstack);
175 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getstacksize);
176 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_init);
177 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setdetachstate);
178 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setguardsize);
179 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setinheritsched);
180 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setschedparam);
181 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setschedpolicy);
182 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setscope);
183 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setstack);
184 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setstacksize);
185 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_create);
186 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_detach);
187 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_exit);
188 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getattr_np);
189 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getcpuclockid);
190 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getname_np);
191 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getschedparam);
192 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getspecific);
193 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_gettid_np);
194 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_join);
195 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_key_create);
196 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_key_delete);
197 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_kill);
198 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_setname_np);
199 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_setschedparam);
200 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_setschedprio);
201 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_setspecific);
202 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_sigqueue);
203 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", setjmp);
204 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", siglongjmp);
205 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", sigsetjmp);
dimitryb97e59e2021-12-08 20:41:55 +0000206 INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", time);
Lev Rumyantsevc6f684a2020-06-19 16:53:08 -0700207 INIT_INTERCEPTABLE_STUB_VARIABLE("libc.so", environ);
208}
209// clang-format on