Skip to content

Commit 7cd32ee

Browse files
zenoalbisserbbandix
authored andcommitted
<chromium> Do not directly override libc symbols from the library.
Instead we export _override symbols and add the symbol renaming directly into the QtWebEngineProcess source. Reviewed-by: Andras Becsi <[email protected]> Change-Id: I15049609dd77be6de2a2398f25a37fff1b6f5519 Reviewed-by: Zeno Albisser <[email protected]>
1 parent 4cc2665 commit 7cd32ee

File tree

2 files changed

+1
-35
lines changed

2 files changed

+1
-35
lines changed

chromium/content/zygote/zygote_main_linux.cc

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,6 @@ static void InitLibcLocaltimeFunctions() {
181181
// references to localtime() will resolve to this function. Notice that we need
182182
// to set visibility attribute to "default" to export the symbol, as it is set
183183
// to "hidden" by default in chrome per build/common.gypi.
184-
__attribute__ ((__visibility__("default")))
185-
struct tm* localtime_override(const time_t* timep) __asm__ ("localtime");
186184

187185
__attribute__ ((__visibility__("default")))
188186
struct tm* localtime_override(const time_t* timep) {
@@ -199,10 +197,6 @@ struct tm* localtime_override(const time_t* timep) {
199197
}
200198
}
201199

202-
// Use same trick to override localtime64(), localtime_r() and localtime64_r().
203-
__attribute__ ((__visibility__("default")))
204-
struct tm* localtime64_override(const time_t* timep) __asm__ ("localtime64");
205-
206200
__attribute__ ((__visibility__("default")))
207201
struct tm* localtime64_override(const time_t* timep) {
208202
if (g_am_zygote_or_renderer) {
@@ -218,10 +212,6 @@ struct tm* localtime64_override(const time_t* timep) {
218212
}
219213
}
220214

221-
__attribute__ ((__visibility__("default")))
222-
struct tm* localtime_r_override(const time_t* timep,
223-
struct tm* result) __asm__ ("localtime_r");
224-
225215
__attribute__ ((__visibility__("default")))
226216
struct tm* localtime_r_override(const time_t* timep, struct tm* result) {
227217
if (g_am_zygote_or_renderer) {
@@ -234,10 +224,6 @@ struct tm* localtime_r_override(const time_t* timep, struct tm* result) {
234224
}
235225
}
236226

237-
__attribute__ ((__visibility__("default")))
238-
struct tm* localtime64_r_override(const time_t* timep,
239-
struct tm* result) __asm__ ("localtime64_r");
240-
241227
__attribute__ ((__visibility__("default")))
242228
struct tm* localtime64_r_override(const time_t* timep, struct tm* result) {
243229
if (g_am_zygote_or_renderer) {

chromium/sandbox/linux/services/libc_urandom_override.cc

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ static void InitLibcFileIOFunctions() {
121121
// the code below defines fopen_override() function with asm name
122122
// "fopen", so that all references to fopen() will resolve to this
123123
// function.
124-
__attribute__ ((__visibility__("default")))
125-
FILE* fopen_override(const char* path, const char* mode) __asm__ ("fopen");
126124

127125
__attribute__ ((__visibility__("default")))
128126
FILE* fopen_override(const char* path, const char* mode) {
@@ -141,7 +139,7 @@ FILE* fopen_override(const char* path, const char* mode) {
141139
}
142140

143141
__attribute__ ((__visibility__("default")))
144-
FILE* fopen64(const char* path, const char* mode) {
142+
FILE* fopen64_override(const char* path, const char* mode) {
145143
if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
146144
int fd = HANDLE_EINTR(dup(base::GetUrandomFD()));
147145
if (fd < 0) {
@@ -161,11 +159,6 @@ FILE* fopen64(const char* path, const char* mode) {
161159

162160
#if HAVE_XSTAT
163161

164-
__attribute__ ((__visibility__("default")))
165-
int xstat_override(int version,
166-
const char *path,
167-
struct stat *buf) __asm__ ("__xstat");
168-
169162
__attribute__ ((__visibility__("default")))
170163
int xstat_override(int version, const char *path, struct stat *buf) {
171164
if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
@@ -178,11 +171,6 @@ int xstat_override(int version, const char *path, struct stat *buf) {
178171
}
179172
}
180173

181-
__attribute__ ((__visibility__("default")))
182-
int xstat64_override(int version,
183-
const char *path,
184-
struct stat64 *buf) __asm__ ("__xstat64");
185-
186174
__attribute__ ((__visibility__("default")))
187175
int xstat64_override(int version, const char *path, struct stat64 *buf) {
188176
if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
@@ -197,10 +185,6 @@ int xstat64_override(int version, const char *path, struct stat64 *buf) {
197185

198186
#else
199187

200-
__attribute__ ((__visibility__("default")))
201-
int stat_override(const char *path,
202-
struct stat *buf) __asm__ ("stat");
203-
204188
__attribute__ ((__visibility__("default")))
205189
int stat_override(const char *path, struct stat *buf) {
206190
if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
@@ -213,10 +197,6 @@ int stat_override(const char *path, struct stat *buf) {
213197
}
214198
}
215199

216-
__attribute__ ((__visibility__("default")))
217-
int stat64_override(const char *path,
218-
struct stat64 *buf) __asm__ ("stat64");
219-
220200
__attribute__ ((__visibility__("default")))
221201
int stat64_override(const char *path, struct stat64 *buf) {
222202
if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {

0 commit comments

Comments
 (0)