Repository navigation
🐛 fix(fork): preserve holds across PID namespaces - #1075
Merged
Merged
Conversation
gaborbernat
marked this pull request as draft
November 20, 2026 15:32
gaborbernat
changed the base branch from
main
to
fix/ynl-counter-signal-agent
November 20, 2026 15:43
gaborbernat
force-pushed
the
fix/mx-pid-namespace
branch
from
November 20, 2026 15:43
91e1577 to
4668ddd
Compare
gaborbernat
marked this pull request as ready for review
November 20, 2026 18:15
gaborbernat
marked this pull request as draft
November 20, 2026 19:33
gaborbernat
force-pushed
the
fix/mx-pid-namespace
branch
from
November 20, 2026 19:45
4668ddd to
8635548
Compare
gaborbernat
marked this pull request as ready for review
November 20, 2026 21:36
gaborbernat
marked this pull request as draft
November 20, 2026 22:00
gaborbernat
changed the base branch from
fix/ynl-counter-signal-agent
to
main
November 20, 2026 22:03
A child in a new PID namespace can have its parent’s numeric PID. Invalidate inherited locks in the child hook and check the namespace in earlier callbacks. Only a known namespace change on the forking thread can invalidate locks before the hook runs. Fixes tox-dev#1021
Mark a connection as inherited before dropping the child lock's reference. Its finalizer could otherwise close SQLite and remove the parent's private database link when the two processes have the same PID.
gaborbernat
force-pushed
the
fix/mx-pid-namespace
branch
from
November 20, 2026 22:08
8635548 to
dbb354d
Compare
gaborbernat
marked this pull request as ready for review
November 20, 2026 22:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A child in a new Linux PID namespace can have the same numeric PID as its parent. Releasing an inherited lock could then release the parent's hold. Filelock now invalidates inherited locks in the child even when the PIDs match. Finalizing an inherited SQLite lock connection in the child leaves the parent's private database link in place. Issue #1021
A child callback registered before filelock's fork hook may run first. If it accesses a lock, the thread that called
fork()checks whether its PID namespace changed. If either namespace identity is unreadable and the numeric PIDs match, an earlier callback can still see the parent's hold. After those earlier callbacks finish, filelock’s own child hook invalidates the inherited locks even without procfs. A lock created after the early check remains usable in the child.Fixes #1021.