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

Issue 146100043: runtime: Mark runtime_goexit function as noinline.

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 12 months ago by pcc
Modified:
9 years, 12 months ago
Reviewers:
iant
CC:
iant, gofrontend-dev_googlegroups.com
Visibility:
Public.

Description

runtime: Mark runtime_goexit function as noinline. If the compiler inlines this function into kickoff, it may reuse the TLS block address to load g. However, this is not necessarily correct, as the call to g->entry in kickoff may cause the TLS address to change. If the wrong value is loaded for g->status in runtime_goexit, it may cause a runtime panic. By marking the function as noinline we prevent the compiler from reusing the TLS address.

Patch Set 1 #

Patch Set 2 : diff -r 8a06080d0d9b0e425f5d87f30182cde9be949386 https://code.google.com/p/gofrontend/ #

Total comments: 2

Patch Set 3 : diff -r 8a06080d0d9b0e425f5d87f30182cde9be949386 https://code.google.com/p/gofrontend/ #

Patch Set 4 : diff -r 8a06080d0d9b0e425f5d87f30182cde9be949386 https://code.google.com/p/gofrontend/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -0 lines) Patch
M libgo/runtime/proc.c View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 5
pcc
9 years, 12 months ago (2014-09-22 20:14:12 UTC) #1
iant
Thanks for finding this. Do you have a test case? Or does it happen for ...
9 years, 12 months ago (2014-09-22 20:23:18 UTC) #2
pcc
I do not. The issue caused several test failures in the regular test suite when ...
9 years, 12 months ago (2014-09-22 20:40:34 UTC) #3
iant
LGTM
9 years, 12 months ago (2014-09-22 21:00:22 UTC) #4
iant
9 years, 12 months ago (2014-09-22 21:14:28 UTC) #5
*** Submitted as
https://code.google.com/p/gofrontend/source/detail?r=225a208260a6 ***

runtime: Mark runtime_goexit function as noinline.

If the compiler inlines this function into kickoff, it may reuse
the TLS block address to load g. However, this is not necessarily
correct, as the call to g->entry in kickoff may cause the TLS
address to change. If the wrong value is loaded for g->status in
runtime_goexit, it may cause a runtime panic.

By marking the function as noinline we prevent the compiler from
reusing the TLS address.

LGTM=iant
R=iant
CC=gofrontend-dev
https://codereview.appspot.com/146100043

Committer: Ian Lance Taylor <iant@golang.org>
Sign in to reply to this message.

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