-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: stack growth within newobject sees junk pointer because of incorrect liveness info #16249
Comments
And we have a reproducer: https://play.golang.org/p/RiYHHWryIj For a less-commented version of same test:
That last line is wrong-wrong-wrong, because the result of newobject is assigned to &err -- i.e., it is live before it is initialized. |
CC @dsnet |
Note this is believed to be a result of https://go-review.googlesource.com/c/24213/ (according to @dsnet) |
The description of https://golang.org/cl/24213 says it does pretty much exactly what you describe as a symptom. |
@dr2chase Pretty sure this is the fix. What do you think?
|
@ianlancetaylor, I cherry picked your change and used it to build and run a test that was failing on this issue. After 1000 runs, they all passed. For reference, it would fail on 734/1000 of them without this change. |
CL https://golang.org/cl/24715 mentions this issue. |
Go 1.7 calls runtime.newobject before initializing all return parameters; if this happens during a GC, the GC will see garbage data on the stack. @dr2chase can fill in more details here.
The text was updated successfully, but these errors were encountered: