]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix heap corruption
authorDmitriy Vyukov <dvyukov@google.com>
Thu, 21 Feb 2013 17:59:46 +0000 (21:59 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Thu, 21 Feb 2013 17:59:46 +0000 (21:59 +0400)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7397049

src/pkg/runtime/proc.c

index 5c36ddf745fb4dd298766f67e623cc6c2da52c09..9909182b6b1354ffd287b043b9016f87479de1cf 100644 (file)
@@ -972,6 +972,12 @@ runtime·newextram(void)
        mp->locked = LockInternal;
        mp->lockedg = gp;
        gp->lockedm = mp;
+       // put on allg for garbage collector
+       if(runtime·lastg == nil)
+               runtime·allg = gp;
+       else
+               runtime·lastg->alllink = gp;
+       runtime·lastg = gp;
        schedunlock();
 
        // Add m to the extra list.