]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libthr malloc: support recursion on thr_malloc_umtx.
authorKonstantin Belousov <kib@FreeBSD.org>
Tue, 12 Jan 2021 09:02:37 +0000 (11:02 +0200)
committerKonstantin Belousov <kib@FreeBSD.org>
Tue, 12 Jan 2021 10:45:44 +0000 (12:45 +0200)
commit85d028223bc2768651f4d44881644ceb5dc2a664
tree72b748fcf5e4d4e6cefc897c0bf4750c48e69b91
parent57f22c828ec01e0d92bc8858f61df06b4d81ea5c
libthr malloc: support recursion on thr_malloc_umtx.

One possible way the recursion can happen is during fork: suppose
that fork is called from early code that did not triggered
jemalloc(3) initialization yet. Then we lock thr_malloc lock, and
call malloc_prefork() that might require initialization of jemalloc
pthread_mutexes, calling into libthr malloc. It is safe to allow
recursion for this occurence.

PR: 252579
Reported by: Vasily Postnicov <shamaz.mazum@gmail.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
lib/libthr/thread/thr_malloc.c