__cxa_finalize() modifies the access permissions of __atexit
global variable without acquiring _ATEXIT_LOCK(). Fix it prevent
any possible races.
Change-Id: I11939d0ebcbf6f360c14163222d40a449d96948e
if (__atexit_invalid)
return;
+ _ATEXIT_LOCK();
call_depth++;
for (p = __atexit; p != NULL; p = p->next) {
p->fns[n].fn_ptr.cxa_func = NULL;
mprotect(p, pgsize, PROT_READ);
}
+ _ATEXIT_UNLOCK();
#if ANDROID
/* it looks like we should always call the function
* with an argument, even if dso is not NULL. Otherwise
else
(*fn.fn_ptr.std_func)();
#endif /* !ANDROID */
+ _ATEXIT_LOCK();
}
}
}
__atexit = NULL;
}
+ _ATEXIT_UNLOCK();
}
/*