mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
libthr: Force the thr_wake() symbol to be resolved during initialization
Otherwise the lock upgrade performed by rtld's load_filtees() can result
in infinite recursion, wherein:
1. _rtld_bind() acquires the bind read lock,
2. the source DSO's filtees haven't been loaded yet, so the lock upgrade
in load_filtees() cause rtld to jump to _rtld_bind() and release the
bind lock,
3. _thr_rtld_lock_release() calls _thr_ast(), which calls thr_wake(),
which hasn't been resolved yet,
4. _rtld_bind() acquires the bind read lock in order to resolve
thr_wake(),
5. ...
See the linked pull request for an instance of this problem arising with
libsys. That particular instance is also worked around by commit
e7951d0b04
.
Reported by: brooks
Reviewed by: kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/908
MFC after: 1 week
Sponsored by: Innovate UK
This commit is contained in:
parent
4339f1e667
commit
36f0a34ca6
|
@ -238,6 +238,7 @@ _thr_rtld_init(void)
|
||||||
|
|
||||||
mprotect(NULL, 0, 0);
|
mprotect(NULL, 0, 0);
|
||||||
_rtld_get_stack_prot();
|
_rtld_get_stack_prot();
|
||||||
|
thr_wake(-1);
|
||||||
|
|
||||||
li.rtli_version = RTLI_VERSION;
|
li.rtli_version = RTLI_VERSION;
|
||||||
li.lock_create = _thr_rtld_lock_create;
|
li.lock_create = _thr_rtld_lock_create;
|
||||||
|
|
Loading…
Reference in a new issue