From: Alexis Christoforides Date: Tue, 7 Oct 2014 00:02:23 +0000 (-0700) Subject: [runtime] Fix another lost canary change X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=14d49cce103796228e6869130846f17157872e08;p=mono.git [runtime] Fix another lost canary change --- diff --git a/mono/metadata/sgen-gc.c b/mono/metadata/sgen-gc.c index d29c6c5b1f3..f1f55e73da8 100644 --- a/mono/metadata/sgen-gc.c +++ b/mono/metadata/sgen-gc.c @@ -1001,7 +1001,8 @@ pin_objects_from_nursery_pin_queue (ScanCopyContext ctx) /* Skip to the next object */ if (((MonoObject*)search_start)->synchronisation != GINT_TO_POINTER (-1)) { CHECK_CANARY_FOR_OBJECT (search_start); - obj_size = obj_size + CANARY_SIZE; + CANARIFY_SIZE (obj_size); + CANARIFY_SIZE (obj_to_pin_size); } search_start = (void*)((char*)search_start + obj_size); } while (search_start <= addr); @@ -1024,8 +1025,6 @@ pin_objects_from_nursery_pin_queue (ScanCopyContext ctx) */ if (((MonoObject*)obj_to_pin)->synchronisation == GINT_TO_POINTER (-1)) goto next_pin_queue_entry; - else if (nursery_canaries_enabled ()) - pinning_front = (char*)pinning_front + CANARY_SIZE; /* * Finally - pin the object! diff --git a/mono/metadata/sgen-gc.h b/mono/metadata/sgen-gc.h index 6eaea3e0a7d..12121dc723f 100644 --- a/mono/metadata/sgen-gc.h +++ b/mono/metadata/sgen-gc.h @@ -1172,7 +1172,9 @@ gboolean nursery_canaries_enabled (void) MONO_INTERNAL; #define CANARY_SIZE 8 #define CANARY_STRING "koupepia" -#define CANARIFY_SIZE(size) size = size + CANARY_SIZE +#define CANARIFY_SIZE(size) if (nursery_canaries_enabled ()) { \ + size = size + CANARY_SIZE; \ + } #define CANARIFY_ALLOC(addr,size) if (nursery_canaries_enabled ()) { \ memcpy ((char*) (addr) + (size), CANARY_STRING, CANARY_SIZE); \