]> granicus.if.org Git - gc/commitdiff
Fix register_dynamic_libraries on Windows 10
authorNaoyuki Sawa <sawa_naoyuki-1@yahoo.co.jp>
Wed, 2 May 2018 04:10:23 +0000 (13:10 +0900)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 17 Jul 2018 05:56:17 +0000 (08:56 +0300)
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.

dyn_load.c

index f327cddfb24dbe0243c236c2bbc67c79e974138c..8400a10ce7a9b39451e694aebc68caf9637ccce9 100644 (file)
@@ -1011,7 +1011,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)