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
Assignees
Milestone

Comments

@mknyszek
Copy link
Contributor

@mknyszek mknyszek commented Jul 28, 2020

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

@mknyszek mknyszek commented Jul 28, 2020

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 28, 2020

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

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jul 30, 2020

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

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
3 participants
You can’t perform that action at this time.