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

runtime: runqputbatch does not protect its call to globrunqputbatch #40457

Closed
mknyszek opened this issue Jul 28, 2020 · 3 comments
Closed

runtime: runqputbatch does not protect its call to globrunqputbatch #40457

mknyszek opened this issue Jul 28, 2020 · 3 comments

Comments

@mknyszek
Copy link
Contributor

As part of https://go-review.googlesource.com/c/go/+/216198 which landed in the Go 1.15 cycle, the new function runqputbatch documents that it may acquire sched.lock because it needs to call globrunqputbatch, but it never does.

Not protecting globrunqputbatch can lead to very bad things, since manipulating the global runq is protected by sched.lock. In particular, we've seen nil g pointers in the global runq as well as general corruption of the global runq field in production.

The fix is straightforward and I'll upload it shortly. This problem is new in Go 1.15.

@mknyszek mknyszek self-assigned this Jul 28, 2020
@mknyszek mknyszek added this to the Go1.15 milestone Jul 28, 2020
@mknyszek
Copy link
Contributor Author

@gopherbot
Copy link

Change https://golang.org/cl/245377 mentions this issue: runtime: hold sched.lock over globrunqputbatch in runqputbatch

@ianlancetaylor
Copy link
Contributor

Bother, sorry about that. Not sure how that happened, and not sure how no test caught it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants