From: Naoyuki Sawa Date: Wed, 2 May 2018 04:10:23 +0000 (+0900) Subject: Fix register_dynamic_libraries on Windows 10 X-Git-Tag: v8.0.0~210 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=19bf43c604522a24d74783e51d3e8661e5ef4bc6;p=gc Fix register_dynamic_libraries on Windows 10 Issue #219 (bdwgc). In the past (Windows XP, Windows 7, and older Windows 10), VirtualQuery always returned PAGE_READWRITE for the data section. In the April 2018 Update of Windows 10, it seems that PAGE_WRITECOPY is returned sometimes (thus causing GC_register_dynamic_libraries not to call GC_cond_add_roots for the section). * dyn_load.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_register_dynamic_libraries): Call GC_cond_add_roots() also for PAGE_EXECUTE_WRITECOPY and PAGE_WRITECOPY pages. --- diff --git a/dyn_load.c b/dyn_load.c index 190dc107..9320adb5 100644 --- a/dyn_load.c +++ b/dyn_load.c @@ -1030,7 +1030,9 @@ GC_INNER void GC_register_dynamic_libraries(void) protect = buf.Protect; if (buf.State == MEM_COMMIT && (protect == PAGE_EXECUTE_READWRITE - || protect == PAGE_READWRITE) + || protect == PAGE_EXECUTE_WRITECOPY + || protect == PAGE_READWRITE + || protect == PAGE_WRITECOPY) && (buf.Type == MEM_IMAGE # ifdef GC_REGISTER_MEM_PRIVATE || (protect == PAGE_READWRITE && buf.Type == MEM_PRIVATE)