gcc/libgo/runtime
Ian Lance Taylor 421a8ed412 runtime: scan caller-saved registers for non-split-stack
While testing a patch on Solaris, which does not support split-stack, I
    ran across a bug in the handling of caller-saved registers for the
    garbage collector.  For non-split-stack systems, runtime_mcall is
    responsible for saving all caller-saved registers on the stack so that
    the GC stack scan will see them.  It does this by calling
    __builtin_unwind_init and setting the g's gcnextsp field to point to the
    current stack.  The garbage collector then scans the stack from gcnextsp
    to the top of stack.
    
    Unfortunately, the code was setting gcnextsp to point to runtime_mcall's
    argument, which meant that even though runtime_mcall was careful to
    store all caller-saved registers on the stack, the GC never saw them.
    This is, of course, only a problem if a value lives only in a
    caller-saved register, and not anywhere else on the stack or heap.  And
    it is only a problem if that caller-saved register manages to make it
    all the way down to runtime_mcall without being saved by any function on
    the way.  This is moderately unlikely but it turns out that the recent
    changes to keep values on the stack when compiling the runtime package
    caused it to happen for the local variable `s` in `notifyListWait` in
    runtime/sema.go.  That function calls goparkunlock which is simple
    enough to not require all registers, and itself calls runtime_mcall.  So
    it was possible for `s` to be released by the GC before the goroutine
    returned from goparkunlock, which eventually caused a dangling pointer
    to be passed to releaseSudog.
    
    This is not a problem on split-stack systems, which use
    __splitstack_get_context, which saves a stack pointer low enough on the
    stack to scan the registers saved by runtime_mcall.
    
    Reviewed-on: https://go-review.googlesource.com/31323

From-SVN: r241304
2016-10-18 13:29:37 +00:00
..
arch.h
array.h
defs.h
env_posix.c runtime: copy runtime.go and runtime1.go from Go 1.7 2016-09-29 00:56:44 +00:00
getncpu-bsd.c
getncpu-irix.c
getncpu-linux.c
getncpu-none.c
getncpu-solaris.c
go-alloc.h
go-append.c
go-assert-interface.c
go-assert.c
go-assert.h
go-breakpoint.c
go-caller.c runtime: just do file/line lookup in C, move Func to Go 2016-10-14 17:20:40 +00:00
go-callers.c
go-can-convert-interface.c
go-cdiv.c
go-cgo.c runtime: copy channel code from Go 1.7 runtime 2016-10-10 16:52:09 +00:00
go-check-interface.c
go-construct-map.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-convert-interface.c
go-copy.c
go-defer.c runtime: use -fgo-c-header to build C header file 2016-08-30 21:07:47 +00:00
go-deferred-recover.c runtime: use -fgo-c-header to build C header file 2016-08-30 21:07:47 +00:00
go-eface-compare.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-eface-val-compare.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-ffi.c re PR go/72814 (reflect FAILs on 32-bit Solaris/SPARC: SIGILL) 2016-08-08 19:53:44 +00:00
go-ffi.h
go-fieldtrack.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-iface.goc
go-interface-compare.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-interface-eface-compare.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-interface-val-compare.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-libmain.c
go-main.c
go-make-slice.c
go-matherr.c
go-memclr.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-memcmp.c
go-memequal.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-memmove.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-nanotime.c runtime: copy runtime package time code from Go 1.7 2016-10-15 00:29:06 +00:00
go-new.c
go-nosys.c libgo: change build procedure to use build tags 2016-08-06 00:36:33 +00:00
go-now.c
go-panic.c runtime: use -fgo-c-header to build C header file 2016-08-30 21:07:47 +00:00
go-panic.h runtime: use -fgo-c-header to build C header file 2016-08-30 21:07:47 +00:00
go-recover.c runtime: use -fgo-c-header to build C header file 2016-08-30 21:07:47 +00:00
go-reflect-call.c
go-runtime-error.c
go-setenv.c
go-signal.c runtime: copy rdebug code from Go 1.7 runtime 2016-10-17 16:54:25 +00:00
go-strcmp.c
go-string.h
go-strslice.c
go-trampoline.c
go-type-complex.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-type-eface.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-type-float.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-type-identity.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-type-interface.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-type-string.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-type.h compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
go-typedesc-equal.c
go-unsafe-new.c
go-unsafe-newarray.c
go-unsafe-pointer.c
go-unsetenv.c
go-unwind.c runtime: use -fgo-c-header to build C header file 2016-08-30 21:07:47 +00:00
go-varargs.c
goc2c.c
heapdump.c runtime: copy rdebug code from Go 1.7 runtime 2016-10-17 16:54:25 +00:00
interface.h
lfstack.goc
malloc.goc runtime: copy mstats code from Go 1.7 runtime 2016-10-13 15:24:50 +00:00
malloc.h runtime: copy rdebug code from Go 1.7 runtime 2016-10-17 16:54:25 +00:00
mcache.c runtime: use -fgo-c-header to build C header file 2016-08-30 21:07:47 +00:00
mcentral.c compiler, runtime: replace hashmap code with Go 1.7 hashmap 2016-09-21 20:58:51 +00:00
mem.c
mem_posix_memalign.c runtime: copy mstats code from Go 1.7 runtime 2016-10-13 15:24:50 +00:00
mfixalloc.c
mgc0.c runtime: copy rdebug code from Go 1.7 runtime 2016-10-17 16:54:25 +00:00
mgc0.h
mheap.c runtime: copy mstats code from Go 1.7 runtime 2016-10-13 15:24:50 +00:00
msize.c runtime: copy mstats code from Go 1.7 runtime 2016-10-13 15:24:50 +00:00
netpoll.goc runtime: copy runtime package time code from Go 1.7 2016-10-15 00:29:06 +00:00
netpoll_epoll.c
netpoll_kqueue.c
netpoll_select.c runtime: copy mstats code from Go 1.7 runtime 2016-10-13 15:24:50 +00:00
netpoll_stub.c libgo: Merge to master revision 19184. 2014-06-06 22:37:27 +00:00
panic.c runtime: copy rdebug code from Go 1.7 runtime 2016-10-17 16:54:25 +00:00
parfor.c
print.c runtime: copy print/println support from Go 1.7 2016-10-10 23:13:39 +00:00
proc.c runtime: scan caller-saved registers for non-split-stack 2016-10-18 13:29:37 +00:00
reflect.goc
rtems-task-variable-add.c
runtime.c runtime: copy rdebug code from Go 1.7 runtime 2016-10-17 16:54:25 +00:00
runtime.h runtime: copy rdebug code from Go 1.7 runtime 2016-10-17 16:54:25 +00:00
runtime1.goc runtime: copy cpuprof code from Go 1.7 runtime 2016-10-14 13:36:35 +00:00
signal_unix.c runtime: use -fgo-c-header to build C header file 2016-08-30 21:07:47 +00:00
signal_unix.h
sigqueue.goc
thread-linux.c runtime: copy internal locking code from Go 1.7 runtime 2016-09-30 13:45:08 +00:00
thread-sema.c runtime: copy internal locking code from Go 1.7 runtime 2016-09-30 13:45:08 +00:00
thread.c
yield.c