]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: prevent GC from seeing the contents of a frame in runfinq
authorDmitriy Vyukov <dvyukov@google.com>
Fri, 19 Jul 2013 14:01:33 +0000 (18:01 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Fri, 19 Jul 2013 14:01:33 +0000 (18:01 +0400)
This holds the last finalized object and arguments to its finalizer.
Fixes #5348.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/11454044

src/pkg/runtime/mgc0.c

index f2c5939e0a00033799fdb01bd5779141a6655dbb..abf93e425b796a13f97607ac634fbfc543992c22 100644 (file)
@@ -2274,7 +2274,11 @@ runfinq(void)
                                framesz = sizeof(uintptr) + f->nret;
                                if(framecap < framesz) {
                                        runtime·free(frame);
-                                       frame = runtime·mal(framesz);
+                                       // The frame does not contain pointers interesting for GC,
+                                       // all not yet finalized objects are stored in finc.
+                                       // If we do not mark it as FlagNoPointers,
+                                       // the last finalized object is not collected.
+                                       frame = runtime·mallocgc(framesz, FlagNoPointers, 0, 1);
                                        framecap = framesz;
                                }
                                *(void**)frame = f->arg;