[前][次][番号順一覧][スレッド一覧]

ruby-changes:55214

From: tenderlove <ko1@a...>
Date: Wed, 3 Apr 2019 06:59:11 +0900 (JST)
Subject: [ruby-changes:55214] tenderlove:r67421 (trunk): Fix more ASAN errors

tenderlove	2019-04-03 06:59:04 +0900 (Wed, 03 Apr 2019)

  New Revision: 67421

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67421

  Log:
    Fix more ASAN errors

  Modified files:
    trunk/gc.c
Index: gc.c
===================================================================
--- gc.c	(revision 67420)
+++ gc.c	(revision 67421)
@@ -3065,7 +3065,7 @@ rb_objspace_call_finalizer(rb_objspace_t https://github.com/ruby/ruby/blob/trunk/gc.c#L3065
     for (i = 0; i < heap_allocated_pages; i++) {
 	p = heap_pages_sorted[i]->start; pend = p + heap_pages_sorted[i]->total_slots;
 	while (p < pend) {
-            void *poisoned = poisoned_object_p(p);
+            void *poisoned = poisoned_object_p((VALUE)p);
             unpoison_object((VALUE)p, false);
 	    switch (BUILTIN_TYPE(p)) {
 	      case T_DATA:
@@ -3558,12 +3558,18 @@ count_objects(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/gc.c#L3558
 
 	p = page->start; pend = p + page->total_slots;
 	for (;p < pend; p++) {
+            void *poisoned = poisoned_object_p((VALUE)p);
+            unpoison_object((VALUE)p, false);
 	    if (p->as.basic.flags) {
 		counts[BUILTIN_TYPE(p)]++;
 	    }
 	    else {
 		freed++;
 	    }
+            if (poisoned) {
+                GC_ASSERT(BUILTIN_TYPE((VALUE)p) == T_NONE);
+                poison_object((VALUE)p);
+            }
 	}
 	total += page->total_slots;
     }
@@ -5474,12 +5480,12 @@ gc_verify_heap_pages_(rb_objspace_t *obj https://github.com/ruby/ruby/blob/trunk/gc.c#L5480
         RVALUE *p = page->freelist;
         while(p) {
             RVALUE *prev = p;
-            unpoison_object(p, false);
+            unpoison_object((VALUE)p, false);
             if (BUILTIN_TYPE(p) != T_NONE) {
                 fprintf(stderr, "freelist slot expected to be T_NONE but was: %s\n", obj_info((VALUE)p));
             }
             p = p->as.free.next;
-            poison_object(prev);
+            poison_object((VALUE)prev);
         }
         poison_memory_region(&page->freelist, sizeof(RVALUE*));
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]