Do not unlock rtld_phdr_lock over callback invocations.

The dl_iterate_phdr consumer code in libgcc does not expect multiple
callbacks running concurrently. This was fixed once already in r178807,
but accidentally got reverted in r294373.
This commit is contained in:
kan 2016-01-27 20:20:37 +00:00
parent 259ddf80ec
commit 35f6152a71

View File

@ -3533,11 +3533,9 @@ dl_iterate_phdr(__dl_iterate_hdr_callback callback, void *param)
TAILQ_INSERT_AFTER(&obj_list, obj, &marker, next);
rtld_fill_dl_phdr_info(obj, &phdr_info);
lock_release(rtld_bind_lock, &bind_lockstate);
lock_release(rtld_phdr_lock, &phdr_lockstate);
error = callback(&phdr_info, sizeof phdr_info, param);
wlock_acquire(rtld_phdr_lock, &phdr_lockstate);
rlock_acquire(rtld_bind_lock, &bind_lockstate);
obj = globallist_next(&marker);
TAILQ_REMOVE(&obj_list, &marker, next);
@ -3551,9 +3549,9 @@ dl_iterate_phdr(__dl_iterate_hdr_callback callback, void *param)
if (error == 0) {
rtld_fill_dl_phdr_info(&obj_rtld, &phdr_info);
lock_release(rtld_bind_lock, &bind_lockstate);
lock_release(rtld_phdr_lock, &phdr_lockstate);
error = callback(&phdr_info, sizeof(phdr_info), param);
}
lock_release(rtld_phdr_lock, &phdr_lockstate);
return (error);
}