]> granicus.if.org Git - gc/commitdiff
Fix assertion violation in GC_repeat_read if --enable-redirect-malloc
authorIvan Maidanski <ivmai@mail.ru>
Sat, 19 Nov 2016 17:37:04 +0000 (20:37 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 27 Nov 2016 06:36:19 +0000 (09:36 +0300)
* malloc.c [REDIRECT_MALLOC && GC_LINUX_THREADS] (GC_init_lib_bounds):
Declare cancel_state local variable; DISABLE_CANCEL for GC_text_mapping
(because GC_repeat_read expects the cancellation state off); call
RESTORE_CANCEL on return.

malloc.c

index c4a5430665af0e46ad837100dea071b027638704..0563cf2b3e581ccac5f8eb5d5d78179840cbe515 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -411,7 +411,10 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_uncollectable(size_t lb)
 
     STATIC void GC_init_lib_bounds(void)
     {
+      IF_CANCEL(int cancel_state;)
+
       if (GC_libpthread_start != 0) return;
+      DISABLE_CANCEL(cancel_state);
       GC_init(); /* if not called yet */
       if (!GC_text_mapping("libpthread-",
                            &GC_libpthread_start, &GC_libpthread_end)) {
@@ -424,6 +427,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_uncollectable(size_t lb)
       if (!GC_text_mapping("ld-", &GC_libld_start, &GC_libld_end)) {
           WARN("Failed to find ld.so text mapping: Expect crash\n", 0);
       }
+      RESTORE_CANCEL(cancel_state);
     }
 # endif /* GC_LINUX_THREADS */