Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(32)

Issue 167060043: code review 167060043: runtime: avoid gentraceback of self on user goroutine stack (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 11 months ago by rsc
Modified:
11 years, 11 months ago
Reviewers:
khr
CC:
khr, bradfitz, golang-codereviews, r
Visibility:
Public.

Description

runtime: avoid gentraceback of self on user goroutine stack Gentraceback may grow the stack. One of the gentraceback wrappers may grow the stack. One of the gentraceback callback calls may grow the stack. Various stack pointers are stored in various stack locations as type uintptr during the execution of these calls. If the stack does grow, these stack pointers will not be updated and will start trying to decode stack memory that is no longer valid. It may be possible to change the type of the stack pointer variables to be unsafe.Pointer, but that's pretty subtle and may still have problems, even if we catch every last one. An easier, more obviously correct fix is to require that gentraceback of the currently running goroutine must run on the g0 stack, not on the goroutine's own stack. Not doing this causes faults when you set StackFromSystem = 1 StackFaultOnFree = 1 The new check in gentraceback will catch future lapses. The more general problem is calling getcallersp but then calling a function that might relocate the stack, which would invalidate the result of getcallersp. Add note to stubs.go declaration of getcallersp explaining the problem, and check all existing calls to getcallersp. Most needed fixes. This affects Callers, Stack, and nearly all the runtime profiling routines. It does not affect stack copying directly nor garbage collection.

Patch Set 1 #

Patch Set 2 : diff -r 1fdfd7dfaedb1b7702141617e621ab7328a236a1 https://code.google.com/p/go/ #

Patch Set 3 : diff -r 1fdfd7dfaedb1b7702141617e621ab7328a236a1 https://code.google.com/p/go/ #

Patch Set 4 : diff -r 53ebc70d4e9f843cb718f173e3225e9a0fc121e2 https://code.google.com/p/go/ #

Total comments: 4

Patch Set 5 : diff -r c3de8d47b28245a3fd5e8bdf2520046a16239fc5 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -16 lines) Patch
M src/runtime/mprof.go View 1 2 3 4 6 chunks +28 lines, -15 lines 0 comments Download
M src/runtime/stubs.go View 1 2 3 4 1 chunk +28 lines, -0 lines 0 comments Download
M src/runtime/traceback.go View 1 2 2 chunks +21 lines, -1 line 0 comments Download

Messages

Total messages: 5
rsc
Hello khr (cc: golang-codereviews@googlegroups.com, r), I'd like you to review this change to https://code.google.com/p/go/
11 years, 11 months ago (2014-11-02 15:31:05 UTC) #1
bradfitz
its instead of it's in two places. On Nov 2, 2014 12:31 PM, <rsc@golang.org> wrote: ...
11 years, 11 months ago (2014-11-02 16:35:25 UTC) #2
khr
LGTM. https://codereview.appspot.com/167060043/diff/60001/src/runtime/mprof.go File src/runtime/mprof.go (right): https://codereview.appspot.com/167060043/diff/60001/src/runtime/mprof.go#newcode598 src/runtime/mprof.go:598: g0.writebuf = gp.writebuf This is kind of strange, ...
11 years, 11 months ago (2014-11-03 17:12:44 UTC) #3
rsc
*** Submitted as https://code.google.com/p/go/source/detail?r=19b82cc0198a *** runtime: avoid gentraceback of self on user goroutine stack Gentraceback ...
11 years, 11 months ago (2014-11-06 04:01:55 UTC) #4
rsc
11 years, 11 months ago (2014-11-06 14:57:44 UTC) #5
Message was sent while issue was closed.
Fixed issue 9044.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b