зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1841538 - Unlock the PHC mutex before crashing r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D183241
This commit is contained in:
Родитель
fd37eb982e
Коммит
655b51ef61
|
@ -937,6 +937,16 @@ Mutex GMut::sMutex;
|
|||
|
||||
static GMut* gMut;
|
||||
|
||||
// When PHC wants to crash we first have to unlock so that the crash reporter
|
||||
// can call into PHC to lockup its pointer. That also means that before calling
|
||||
// PHCCrash please ensure that state is consistent. Because this can report an
|
||||
// arbitrary string, use of it must be reviewed by Firefox data stewards.
|
||||
static void PHCCrash(GMutLock, const char* aMessage)
|
||||
MOZ_REQUIRES(GMut::sMutex) {
|
||||
GMut::sMutex.Unlock();
|
||||
MOZ_CRASH_UNSAFE(aMessage);
|
||||
}
|
||||
|
||||
// On MacOS, the first __thread/thread_local access calls malloc, which leads
|
||||
// to an infinite loop. So we use pthread-based TLS instead, which somehow
|
||||
// doesn't have this problem.
|
||||
|
@ -1206,17 +1216,18 @@ static void* MaybePageAlloc(const Maybe<arena_id_t>& aArenaId, size_t aReqSize,
|
|||
|
||||
static void FreePage(GMutLock aLock, uintptr_t aIndex,
|
||||
const Maybe<arena_id_t>& aArenaId,
|
||||
const StackTrace& aFreeStack, Delay aReuseDelay) {
|
||||
const StackTrace& aFreeStack, Delay aReuseDelay)
|
||||
MOZ_REQUIRES(GMut::sMutex) {
|
||||
void* pagePtr = gConst->AllocPagePtr(aIndex);
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (!VirtualFree(pagePtr, kPageSize, MEM_DECOMMIT)) {
|
||||
MOZ_CRASH("VirtualFree failed");
|
||||
PHCCrash(aLock, "VirtualFree failed");
|
||||
}
|
||||
#else
|
||||
if (mmap(pagePtr, kPageSize, PROT_NONE, MAP_FIXED | MAP_PRIVATE | MAP_ANON,
|
||||
-1, 0) == MAP_FAILED) {
|
||||
MOZ_CRASH("mmap failed");
|
||||
PHCCrash(aLock, "mmap failed");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче