Lock on dl_interate_phdr
There is possibility of someone dlclosing a library
while dl_iterate_phdr in progress which can lead to
dl_iterate_phdr calling callback with invalid address
if it was unmapped by dlclose.
Bug: http://b/22047255
Change-Id: I3fc0d9fd2c51fb36fd34cb035f37271fa893a7be
(cherry picked from commit f7d5bf334d
)
This commit is contained in:
@@ -158,6 +158,11 @@ int dlclose(void* handle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data), void* data) {
|
||||
ScopedPthreadMutexLocker locker(&g_dl_mutex);
|
||||
return do_dl_iterate_phdr(cb, data);
|
||||
}
|
||||
|
||||
void android_set_application_target_sdk_version(uint32_t target) {
|
||||
// lock to avoid modification in the middle of dlopen.
|
||||
ScopedPthreadMutexLocker locker(&g_dl_mutex);
|
||||
|
Reference in New Issue
Block a user