diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2013-07-29 22:22:34 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2013-07-29 22:22:34 +0400 |
| commit | e84d9e1fb3a0d87abd60d31afb9cd0ddfb7d9bfa (patch) | |
| tree | 1a0213f1250994c0734456bdcd81bb1bf5e56ee4 /src/pkg/runtime/stack.c | |
| parent | b8734748b6b151a7fd724fc41e2555e6cd34385f (diff) | |
| download | go-e84d9e1fb3a0d87abd60d31afb9cd0ddfb7d9bfa.tar.xz | |
runtime: do not split stacks in syscall status
Split stack checks (morestack) corrupt g->sched,
but g->sched must be preserved consistent for GC/traceback.
The change implements runtime.notetsleepg function,
which does entersyscall/exitsyscall and is carefully arranged
to not call any split functions in between.
R=rsc
CC=golang-dev
https://golang.org/cl/11575044
Diffstat (limited to 'src/pkg/runtime/stack.c')
| -rw-r--r-- | src/pkg/runtime/stack.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pkg/runtime/stack.c b/src/pkg/runtime/stack.c index dda65f9463..b959eb316d 100644 --- a/src/pkg/runtime/stack.c +++ b/src/pkg/runtime/stack.c @@ -246,6 +246,8 @@ runtime·newstack(void) runtime·throw("runtime: preempt g0"); if(oldstatus == Grunning && m->p == nil) runtime·throw("runtime: g is running but p is not"); + if(oldstatus == Gsyscall && m->locks == 0) + runtime·throw("runtime: stack split during syscall"); // Be conservative about where we preempt. // We are interested in preempting user Go code, not runtime code. if(oldstatus != Grunning || m->locks || m->mallocing || m->gcing || m->p->status != Prunning) { |
