go/src
Austin Clements 22689c4450 reflect: keep makeFuncImpl live across makeFuncStub
When traceback sees reflect.makeFuncStub (or reflect.methodValueCall)
on the stack, it expects to be able to get the *reflect.makeFuncImpl
(or *reflect.methodValue) for that call from the first outgoing
argument slot of makeFuncStub/methodValueCall.

However, currently this object isn't necessarily kept live across
makeFuncStub. This means it may get garbage collected while in a
reflect call and reused for something else. If we then try to
traceback, the runtime will see a corrupted makeFuncImpl object and
panic. This was not a problem in previous releases because we always
kept arguments live across the whole function. This became a problem
when we stopped doing this.

Fix this by using reflect.KeepAlive to keep the
makeFuncImpl/methodValue live across all of callReflect/callMethod,
which in turn keeps it live as long as makeFuncStub/methodValueCall
are on the stack.

Fixes #18635.

Change-Id: I91853efcf17912390fddedfb0230648391c33936
Reviewed-on: https://go-review.googlesource.com/35151
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-13 03:45:28 +00:00
..
archive Revert: "archive/zip: handle mtime in NTFS/UNIX/ExtendedTS extra fields" 2016-12-20 01:39:35 +00:00
bufio
builtin
bytes all: fix misspellings 2017-01-07 16:53:25 +00:00
cmd cmd/link: only exclude C-only symbols on darwin 2017-01-12 23:48:11 +00:00
compress compress/flate: avoid large stack growth in fillDeflate 2017-01-12 19:15:57 +00:00
container
context all: make spelling consistent 2016-12-08 23:22:37 +00:00
crypto crypto/dsa: gofmt 2017-01-11 17:10:59 +00:00
database/sql all: fix misspellings 2017-01-07 16:53:25 +00:00
debug cmd/objdump: copy gosym.PCValue into internal package 2016-12-01 18:20:04 +00:00
encoding all: make spelling consistent 2016-12-08 23:22:37 +00:00
errors
expvar
flag
fmt fmt: undo clearflags in catchPanic after error message has been printed 2016-12-11 21:59:59 +00:00
go cmd/compile: file line number for //go:xxx directives 2017-01-09 19:39:56 +00:00
hash
html html/template: lock in application/json as valid JS test 2016-12-04 03:59:31 +00:00
image
index/suffixarray
internal internal/pprof/profile: parse mutex profile including comments 2016-11-29 18:04:37 +00:00
io io: fix PipeWriter.Close to wake up Writes 2016-12-21 15:08:26 +00:00
log
math crypto/*: document use or non-use of constant-time algorithms 2016-12-07 16:34:50 +00:00
mime
net net/http: deflake TestRetryIdempotentRequestsOnError 2017-01-11 01:39:54 +00:00
os os/user: document the difference between Username and Name 2017-01-07 22:54:27 +00:00
path all: fix misspellings 2017-01-07 16:53:25 +00:00
plugin cmd/go, plugin: disable plugins on darwin 2016-12-15 05:46:20 +00:00
reflect reflect: keep makeFuncImpl live across makeFuncStub 2017-01-13 03:45:28 +00:00
regexp
runtime runtime: avoid clobbering C callee-save register in cgoSigtramp 2017-01-12 00:06:32 +00:00
sort sort: add Slice example 2016-12-01 05:43:05 +00:00
strconv
strings
sync
syscall runtime, syscall: update openbsd for changes to syskill 2016-12-12 01:30:39 +00:00
testing all: fix misspellings 2017-01-07 16:53:25 +00:00
text
time time: parse WITA timezone correctly 2016-12-12 20:14:12 +00:00
unicode
unsafe
vendor/golang_org/x vendor: update golang.org/x/crypto/chacha20poly1305 2017-01-07 00:38:37 +00:00
Make.dist
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash
make.bat
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc