]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: reset typed dangling pointer
authorDmitriy Vyukov <dvyukov@google.com>
Sun, 7 Apr 2013 03:00:45 +0000 (20:00 -0700)
committerDmitriy Vyukov <dvyukov@google.com>
Sun, 7 Apr 2013 03:00:45 +0000 (20:00 -0700)
If for whatever reason seh points into Go heap region,
the dangling pointer will cause memory corruption during GC.
Update #5193.

R=golang-dev, alex.brainman, iant
CC=golang-dev
https://golang.org/cl/8402045

src/pkg/runtime/proc.c

index eec7531e155cb5890c39cd41e0cd624ef3b55525..438de78b09d5066f63b2a8147aff58eba1b05cce 100644 (file)
@@ -695,6 +695,7 @@ runtime·dropm(void)
 
        // Undo whatever initialization minit did during needm.
        runtime·unminit();
+       m->seh = nil;  // reset dangling typed pointer
 
        // Clear m and g, and return m to the extra list.
        // After the call to setmg we can only call nosplit functions.