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: don't depend on statictmp_ variables being read only #21940

Open
randall77 opened this Issue Sep 20, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@randall77
Contributor

randall77 commented Sep 20, 2017

In cmd/compile/internal/gc/racewalk.go:

		// statictmp's are read-only
		if strings.HasPrefix(n.Sym.Name, "statictmp_") {
			return true
		}

This isn't really true. If you do:

type T struct {
	x int
}
var y = &T{}

Then the &T allocates a variable that starts with statictmp_, but it is writeable.

I think it would be hard to have a race on these variables, as they are only accessed directly during init functions. But maybe we should update the comment.

@dvyukov

@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Mar 30, 2018

@odeke-em

This comment has been minimized.

Member

odeke-em commented Jun 15, 2018

How's it going here @dvyukov and @randall77?

@randall77

This comment has been minimized.

Contributor

randall77 commented Jun 15, 2018

I'm not sure what the right answer is here. Possibly this allows races to go undetected. But it is a very weird corner case, not sure it is worth the effort.
In any case, nothing is happening on it. Punting.

@randall77 randall77 modified the milestones: Go1.11, Go1.12 Jun 15, 2018

@dvyukov

This comment has been minimized.

Member

dvyukov commented Jun 15, 2018

How hard is it to detect these variables? Is it just checking some addrtaken flag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment