[PATCH] D40382: Plug dlerror() leak for swift_demangle

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 17:52:09 PDT 2023


pcc added a comment.

In D40382#4188437 <https://reviews.llvm.org/D40382#4188437>, @marcan wrote:

> 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.

Looks like this was fixed by D128992 <https://reviews.llvm.org/D128992> by removing the call to `dlerror()`.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D40382/new/

https://reviews.llvm.org/D40382



More information about the llvm-commits mailing list