use /proc/thread-self for mounting network namespace#45682
Closed
spikecurtis wants to merge 1 commit intomoby:masterfrom
Closed
use /proc/thread-self for mounting network namespace#45682spikecurtis wants to merge 1 commit intomoby:masterfrom
spikecurtis wants to merge 1 commit intomoby:masterfrom
Conversation
Signed-off-by: Spike Curtis <[email protected]>
Member
corhere
requested changes
Jun 2, 2023
Contributor
corhere
left a comment
There was a problem hiding this comment.
/proc/thread-self does not exist on the oldest kernels we support so cannot be used
Contributor
|
If mounting one thread's netns from another thread is the problem, use |
Author
|
Tried with I think that means my theory for what's wrong is false, so closing this PR. |
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.
- What I did
Fixes an issue where
--net=hostruns would fail if Docker is run within a sysbox container.- How I did it
--net=hostmounts the network namespace without usingunshare, but the code uses a call tounix.Gettid()for the thread ID, builds the/procpath from it, then issues the syscall. Withoutunsharecode on the same goroutine can be run on different OS threads, and it appears the syscall is run on a different thread and fails.We can simplify and fix the logic by using
/proc/thread-selfinstead of querying for the threadID.- How to verify it
c.f. repro steps in #45681
- Description for the changelog
fixed an issue where
--net=hostwould fail in restricted environments, for example sysbox- A picture of a cute animal (not mandatory but encouraged)