Bug 1823634 - Use VirtualAlloc to achieve VirtualProtect's purpose on the most impactful path. r=gstoll

Differential Revision: https://phabricator.services.mozilla.com/D175483
This commit is contained in:
Yannis Juglaret 2023-04-14 15:54:50 +00:00
Родитель 8d0712b2c6
Коммит ab25db87a4
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -897,9 +897,10 @@ bool js::jit::ReprotectRegion(void* start, size_t size,
std::atomic_thread_fence(std::memory_order_seq_cst);
# ifdef XP_WIN
DWORD oldProtect;
DWORD flags = ProtectionSettingToFlags(protection);
if (!VirtualProtect(pageStart, size, flags, &oldProtect)) {
// This is a essentially a VirtualProtect, but with lighter impact on
// antivirus analysis. See bug 1823634.
if (!VirtualAlloc(pageStart, size, MEM_COMMIT, flags)) {
return false;
}
# else