int main() { #ifdef _WIN32 GetSystemInfo(&_sinfo); #else _pagesize = sysconf(_SC_PAGESIZE); #endif uintptr_t ncontrol = ReserveNegativeControl(); uintptr_t pcontrol = ReservePositiveControl(); uintptr_t poison = ReservePoisonArea(); if (!ncontrol || !pcontrol || !poison) return 2; bool failed = false; failed |= TestPage("negative control", ncontrol, 1); failed |= TestPage("positive control", pcontrol, 0); failed |= TestPage("poison area", poison, 0); return failed ? 1 : 0; }
static PRStatus ARENA_POISON_init() { PRUword rgnsize = GetDesiredRegionSize(); PRUword rgnbase = ReservePoisonArea(rgnsize); if (rgnsize == 0) // can't happen return PR_FAILURE; ARENA_POISON = rgnbase + rgnsize/2 - 1; #ifdef MOZ_CRASHREPORTER nsCOMPtr<nsICrashReporter> cr = do_GetService("@mozilla.org/toolkit/crash-reporter;1"); PRBool enabled; if (cr && NS_SUCCEEDED(cr->GetEnabled(&enabled)) && enabled) { cr->AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonBase"), nsPrintfCString(17, "%.16llx", PRUint64(rgnbase))); cr->AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonSize"), nsPrintfCString("%lu", PRUint32(rgnsize))); } #endif return PR_SUCCESS; }