am a58d2498: Merge "Fix potential race condition on dlopen"
* commit 'a58d24984045b474883ad14500a465ab331db47d': Fix potential race condition on dlopen
This commit is contained in:
commit
c6a87cc8cb
@ -68,8 +68,9 @@ void android_update_LD_LIBRARY_PATH(const char* ld_library_path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void* dlopen_ext(const char* filename, int flags,
|
static void* dlopen_ext(const char* filename, int flags,
|
||||||
const android_dlextinfo* extinfo, soinfo* caller) {
|
const android_dlextinfo* extinfo, void* caller_addr) {
|
||||||
ScopedPthreadMutexLocker locker(&g_dl_mutex);
|
ScopedPthreadMutexLocker locker(&g_dl_mutex);
|
||||||
|
soinfo* caller = find_containing_library(caller_addr);
|
||||||
soinfo* result = do_dlopen(filename, flags, extinfo, caller);
|
soinfo* result = do_dlopen(filename, flags, extinfo, caller);
|
||||||
if (result == nullptr) {
|
if (result == nullptr) {
|
||||||
__bionic_format_dlerror("dlopen failed", linker_get_error_buffer());
|
__bionic_format_dlerror("dlopen failed", linker_get_error_buffer());
|
||||||
@ -80,14 +81,12 @@ static void* dlopen_ext(const char* filename, int flags,
|
|||||||
|
|
||||||
void* android_dlopen_ext(const char* filename, int flags, const android_dlextinfo* extinfo) {
|
void* android_dlopen_ext(const char* filename, int flags, const android_dlextinfo* extinfo) {
|
||||||
void* caller_addr = __builtin_return_address(0);
|
void* caller_addr = __builtin_return_address(0);
|
||||||
soinfo* caller = find_containing_library(caller_addr);
|
return dlopen_ext(filename, flags, extinfo, caller_addr);
|
||||||
return dlopen_ext(filename, flags, extinfo, caller);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* dlopen(const char* filename, int flags) {
|
void* dlopen(const char* filename, int flags) {
|
||||||
void* caller_addr = __builtin_return_address(0);
|
void* caller_addr = __builtin_return_address(0);
|
||||||
soinfo* caller = find_containing_library(caller_addr);
|
return dlopen_ext(filename, flags, nullptr, caller_addr);
|
||||||
return dlopen_ext(filename, flags, nullptr, caller);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void* dlsym(void* handle, const char* symbol) {
|
void* dlsym(void* handle, const char* symbol) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user