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(__pthread_cleanup_pop);
21 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__pthread_cleanup_push);
22 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_properties_init);
23 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_add);
24 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_area_init);
25 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_area_serial);
26 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_find);
27 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_find_nth);
28 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_foreach);
29 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_get);
30 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_read);
31 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_read_callback);
32 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_serial);
33 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_set);
34 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_set_filename);
35 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_update);
36 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_wait);
37 DEFINE_INTERCEPTABLE_STUB_FUNCTION(__system_property_wait_any);
38 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_longjmp);
39 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_setjmp);
40 DEFINE_INTERCEPTABLE_STUB_FUNCTION(android_getaddrinfofornet);
41 DEFINE_INTERCEPTABLE_STUB_FUNCTION(android_getaddrinfofornetcontext);
42 DEFINE_INTERCEPTABLE_STUB_FUNCTION(android_mallopt);
43 DEFINE_INTERCEPTABLE_STUB_FUNCTION(android_set_abort_message);
44 DEFINE_INTERCEPTABLE_STUB_FUNCTION(clone);
45 DEFINE_INTERCEPTABLE_STUB_FUNCTION(freeaddrinfo);
46 DEFINE_INTERCEPTABLE_STUB_FUNCTION(gai_strerror);
47 DEFINE_INTERCEPTABLE_STUB_FUNCTION(getaddrinfo);
48 DEFINE_INTERCEPTABLE_STUB_FUNCTION(longjmp);
49 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_destroy);
50 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getdetachstate);
51 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getguardsize);
52 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getinheritsched);
53 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getschedparam);
54 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getschedpolicy);
55 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getscope);
56 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getstack);
57 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_getstacksize);
58 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_init);
59 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setdetachstate);
60 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setguardsize);
61 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setinheritsched);
62 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setschedparam);
63 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setschedpolicy);
64 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setscope);
65 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setstack);
66 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_attr_setstacksize);
67 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_create);
68 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_detach);
69 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_exit);
70 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getattr_np);
71 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getcpuclockid);
72 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getname_np);
73 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getschedparam);
74 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_getspecific);
75 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_gettid_np);
76 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_join);
77 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_key_create);
78 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_key_delete);
79 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_kill);
80 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_setname_np);
81 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_setschedparam);
82 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_setschedprio);
83 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_setspecific);
84 DEFINE_INTERCEPTABLE_STUB_FUNCTION(pthread_sigqueue);
85 DEFINE_INTERCEPTABLE_STUB_FUNCTION(setjmp);
86 DEFINE_INTERCEPTABLE_STUB_FUNCTION(siglongjmp);
87 DEFINE_INTERCEPTABLE_STUB_FUNCTION(sigsetjmp);
88 DEFINE_INTERCEPTABLE_STUB_VARIABLE(environ);
89 
init_stub_library()90 static void __attribute__((constructor(0))) init_stub_library() {
91   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __pthread_cleanup_pop);
92   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __pthread_cleanup_push);
93   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_properties_init);
94   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_add);
95   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_area_init);
96   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_area_serial);
97   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_find);
98   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_find_nth);
99   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_foreach);
100   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_get);
101   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_read);
102   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_read_callback);
103   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_serial);
104   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_set);
105   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_set_filename);
106   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_update);
107   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_wait);
108   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", __system_property_wait_any);
109   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", _longjmp);
110   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", _setjmp);
111   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", android_getaddrinfofornet);
112   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", android_getaddrinfofornetcontext);
113   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", android_mallopt);
114   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", android_set_abort_message);
115   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", clone);
116   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", freeaddrinfo);
117   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", gai_strerror);
118   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", getaddrinfo);
119   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", longjmp);
120   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_destroy);
121   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getdetachstate);
122   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getguardsize);
123   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getinheritsched);
124   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getschedparam);
125   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getschedpolicy);
126   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getscope);
127   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getstack);
128   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_getstacksize);
129   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_init);
130   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setdetachstate);
131   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setguardsize);
132   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setinheritsched);
133   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setschedparam);
134   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setschedpolicy);
135   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setscope);
136   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setstack);
137   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_attr_setstacksize);
138   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_create);
139   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_detach);
140   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_exit);
141   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getattr_np);
142   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getcpuclockid);
143   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getname_np);
144   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getschedparam);
145   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_getspecific);
146   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_gettid_np);
147   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_join);
148   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_key_create);
149   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_key_delete);
150   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_kill);
151   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_setname_np);
152   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_setschedparam);
153   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_setschedprio);
154   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_setspecific);
155   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", pthread_sigqueue);
156   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", setjmp);
157   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", siglongjmp);
158   INIT_INTERCEPTABLE_STUB_FUNCTION("libc.so", sigsetjmp);
159   INIT_INTERCEPTABLE_STUB_VARIABLE("libc.so", environ);
160 }
161 // clang-format on
162