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
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@randall77
Copy link
Contributor

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 the NeedsFix The path to resolution is known, but the work has not been done. label Mar 30, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.11 milestone Mar 30, 2018
@odeke-em
Copy link
Member

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

@randall77
Copy link
Contributor Author

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 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
Member

cuonglm commented Aug 2, 2019

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

@mdempsky
Copy link
Contributor

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

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done.
Projects
Status: Triage Backlog
Development

No branches or pull requests

9 participants