Skip to content
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 · 5 comments
Open

cmd/compile: don't depend on statictmp_ variables being read only #21940

randall77 opened this issue Sep 20, 2017 · 5 comments
Labels
Milestone

Comments

@randall77
Copy link
Contributor

@randall77 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
Copy link
Member

@odeke-em odeke-em commented Jun 15, 2018

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

@randall77
Copy link
Contributor Author

@randall77 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
Copy link
Member

@dvyukov dvyukov commented Jun 15, 2018

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

@andybons andybons modified the milestones: Go1.12, Go1.13 Feb 12, 2019
@randall77 randall77 modified the milestones: Go1.13, Go1.14 Jun 3, 2019
@cuonglm
Copy link
Contributor

@cuonglm cuonglm commented Aug 2, 2019

@randall77 This issue seems to be outdated after https://go-review.googlesource.com/102817

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Oct 24, 2019

The string comparison in question is now in ssa.IsSanitizerSafeAddr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.