aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2013-04-30 04:13:32 +0800
committerShenghou Ma <minux.ma@gmail.com>2013-04-30 04:13:32 +0800
commit5b78cee3764ea71722a56dc2e1b33ae7e90e5427 (patch)
tree78af54ebd96b972a861ba901bcc8918623d2429d
parent806dea82d4668c079856b77b3824143500405d25 (diff)
downloadgo-5b78cee3764ea71722a56dc2e1b33ae7e90e5427.tar.gz
go-5b78cee3764ea71722a56dc2e1b33ae7e90e5427.zip
runtime: fix stack pointer corruption in runtime.cgocallback_gofunc()
runtime.setmg() calls another function (cgo_save_gm), so it must save LR onto stack. Re-enabled TestCthread test in misc/cgo/test. Fixes #4863. R=golang-dev, r CC=golang-dev https://golang.org/cl/9019043
-rw-r--r--misc/cgo/test/cthread.go5
-rw-r--r--src/pkg/runtime/asm_arm.s2
2 files changed, 1 insertions, 6 deletions
diff --git a/misc/cgo/test/cthread.go b/misc/cgo/test/cthread.go
index bdfd1103d6..68d4a03eac 100644
--- a/misc/cgo/test/cthread.go
+++ b/misc/cgo/test/cthread.go
@@ -8,7 +8,6 @@ package cgotest
import "C"
import (
- "runtime"
"sync"
"testing"
)
@@ -31,10 +30,6 @@ func Add(x int) {
}
func testCthread(t *testing.T) {
- if runtime.GOARCH == "arm" {
- t.Skip("testCthread disabled on arm")
- }
-
sum.i = 0
C.doAdd(10, 6)
diff --git a/src/pkg/runtime/asm_arm.s b/src/pkg/runtime/asm_arm.s
index ee9acb749c..fed9b30215 100644
--- a/src/pkg/runtime/asm_arm.s
+++ b/src/pkg/runtime/asm_arm.s
@@ -417,7 +417,7 @@ havem:
RET
// void setmg(M*, G*); set m and g. for use by needm.
-TEXT runtime·setmg(SB), 7, $-4
+TEXT runtime·setmg(SB), 7, $0
MOVW mm+0(FP), m
MOVW gg+4(FP), g