From ab25db87a42bf7b5cf34ee947874d146064e79b9 Mon Sep 17 00:00:00 2001 From: Yannis Juglaret Date: Fri, 14 Apr 2023 15:54:50 +0000 Subject: [PATCH] Bug 1823634 - Use VirtualAlloc to achieve VirtualProtect's purpose on the most impactful path. r=gstoll Differential Revision: https://phabricator.services.mozilla.com/D175483 --- js/src/jit/ProcessExecutableMemory.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/src/jit/ProcessExecutableMemory.cpp b/js/src/jit/ProcessExecutableMemory.cpp index 5a569d211552..e27372f253ae 100644 --- a/js/src/jit/ProcessExecutableMemory.cpp +++ b/js/src/jit/ProcessExecutableMemory.cpp @@ -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