-
Notifications
You must be signed in to change notification settings - Fork 792
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
Undefined concurrent writes in BuildDockerfiles #4079
Comments
flouthoc
added a commit
to flouthoc/buildah
that referenced
this issue
Jul 18, 2022
This is refactor commit which aims to remove undefined concurrent writes from imagebuildah by making sure that fields which we are modifying are not shared by builds for each platform so there is no undefined concurrent write [NO TESTS NEEDED] [NO NEW TESTS NEEDED] No new test is needed for this OTOH all the existing tests should pass Closes: containers#4079 Signed-off-by: Aditya R <[email protected]>
I think we can avoid sharing these variable inside goroutines. Created a refactor PR above: #4120 |
flouthoc
added a commit
to flouthoc/buildah
that referenced
this issue
Jul 18, 2022
This is refactor commit which aims to remove undefined concurrent writes from imagebuildah by making sure that fields which we are modifying are not shared by builds for each platform so there is no undefined concurrent write [NO TESTS NEEDED] [NO NEW TESTS NEEDED] No new test is needed for this OTOH all the existing tests should pass Closes: containers#4079 Signed-off-by: Aditya R <[email protected]>
flouthoc
added a commit
to flouthoc/buildah
that referenced
this issue
Jul 18, 2022
This is refactor commit which aims to remove undefined concurrent writes from imagebuildah by making sure that fields which we are modifying are not shared by builds for each platform so there is no undefined concurrent write [NO TESTS NEEDED] [NO NEW TESTS NEEDED] No new test is needed for this OTOH all the existing tests should pass Closes: containers#4079 Signed-off-by: Aditya R <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Steps to reproduce the issue:
Code inspection only
buildah/imagebuildah/build.go
Line 65 in d8e9ca4
id
andref
, shared for the wholeBuildDockerfiles
function.buildah/imagebuildah/build.go
Line 255 in d8e9ca4
id
andref
atbuildah/imagebuildah/build.go
Line 278 in d8e9ca4
id
andref
values from different goroutines).I suppose the idea is that on single-platform builds there is no race, and on multi-platform builds the fields are not used anyway. (Pedantically: Go is fairly imprecise about its memory model, so it’s unclear to me that “racy but unused writes” don’t trigger undefined behavior.) I can’t see that this is actually the case, nothing forces multi-platform builds to set the
Manifest
option which would causeid
andref
to be overwritten.Moving those writes under (renamed)
instanceLock
might be a one-line fix … but it seems worthwhile to move the per-platform goroutine into a completely separate function to make it impossible to similarly write to shared state without making it explicitly visible to the goroutine.The text was updated successfully, but these errors were encountered: