InitializeSwiftDemangler() attempts to resolve the
swift_demangle symbol. If this is not available, we
observe dlerror message leak.
Caught on NetBSD/amd64 in TSan.
Sponsored by <The NetBSD Foundation>
Differential D40382
Plug dlerror() leak for swift_demangle krytarowski on Nov 22 2017, 10:16 PM. Authored by
Details InitializeSwiftDemangler() attempts to resolve the Caught on NetBSD/amd64 in TSan. Sponsored by <The NetBSD Foundation>
Diff Detail
Event TimelineComment Actions FYI, this introduces a subtle regression. dlerror() calls into gettext to translate the error. ASAN itself can be initialized from a random malloc intercept which can turn out to be in gettext, which is quite common since apps initialize gettext early, and some libraries even do so in loader init calls. This ends up re-entering into gettext and corrupting a rwmutex by trying to take the write lock while the read-side is locked. The unlock sequence leaves the rwlock in a bad state. Things then deadlock much later on the bad mutex. |