1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-03 12:35:02 +00:00

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:
Alexander Kabaev 2016-01-27 20:20:37 +00:00
parent a2e4e33f34
commit ef2c2a692b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=294936

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);
}