Date: Tue, 29 Jan 2019 22:47:42 +0000 From: bugzilla-noreply@freebsd.org To: threads@FreeBSD.org Subject: [Bug 235211] dlopen/libthr appears broken Message-ID: <bug-235211-13406-zSAcsIA2nu@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-235211-13406@https.bugs.freebsd.org/bugzilla/> References: <bug-235211-13406@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235211 --- Comment #3 from commit-hook@freebsd.org --- A commit references this bug: Author: kib Date: Tue Jan 29 22:46:46 UTC 2019 New revision: 343566 URL: https://svnweb.freebsd.org/changeset/base/343566 Log: Untangle jemalloc and mutexes initialization. The need to use libc malloc(3) from some places in libthr always caused issues. For instance, per-thread key allocation was switched to use plain mmap(2) to get storage, because some third party mallocs used keys for implementation of calloc(3). Even more important, libthr calls calloc(3) during initialization of pthread mutexes, and jemalloc uses pthread mutexes. Jemalloc provides some way to both postpone the initialization, and to make initialization to use specialized allocator, but this is very fragile and often breaks. See the referenced PR for another example. Add the small malloc implementation used by rtld, to libthr. Use it in thr_spec.c and for mutexes initialization. This avoids the issues with mutual dependencies between malloc and libthr in principle. The drawback is that some more allocations are not interceptable for alternate malloc implementations. There should be not too much memory use from this allocator, and the alternative, direct use of mmap(2) is obviously worse. PR: 235211 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D18988 Changes: head/lib/libthr/Makefile head/lib/libthr/thread/Makefile.inc head/lib/libthr/thread/thr_fork.c head/lib/libthr/thread/thr_init.c head/lib/libthr/thread/thr_malloc.c head/lib/libthr/thread/thr_mutex.c head/lib/libthr/thread/thr_private.h head/lib/libthr/thread/thr_spec.c --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-235211-13406-zSAcsIA2nu>