[PATCH] D40714: Correct atexit(3) support in MSan/NetBSD
Kamil Rytarowski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 5 17:24:50 PST 2017
krytarowski added inline comments.
================
Comment at: lib/msan/msan_interceptors.cc:1144
+
+ res = REAL(__cxa_atexit)((void (*)(void *a))MSanAtExitWrapper, 0, 0);
+ // Push AtExitCtx on the top of the stack of callback functions
----------------
vitalybuka wrote:
> krytarowski wrote:
> > vitalybuka wrote:
> > > do you need to call REAL(__cxa_atexit) under the lock?
> > Yes, as I'm pushing an item to the LIFO container.
> I see
> there is possibility of MSanAtExitWrapper immediately after REAL(__cxa_atexit) call
> so we don't want want MSanAtExitWrapper pass that mutex before we push
>
The same algorithm is used in TSan. Blocking mutex is needed for hypothetical scenarios of executing atexit(3) callbacks and registering them concurrently.
Repository:
rL LLVM
https://reviews.llvm.org/D40714
More information about the llvm-commits
mailing list