Merge External PR: Merge main-pr863 into main - #866
Merged
Conversation
Exec() decided whether to pivot_root or chroot by checking if findNS() returned an error for the mount namespace. findNS() returns a non-nil error both when the namespace type is missing from the spec entirely and when it's present but not created yet, so the old check (withPivot := err != nil) ended up pivoting even when the spec had no mount namespace at all. In that case FormatNsenterInfo() never sets CLONE_NEWNS, so no new mount namespace gets created and the process stays in whatever mount namespace the caller (normally urunc create) is running in, usually the host's. pivot_root then runs against that namespace instead of an isolated one. Use the same ErrNotExistingNS check joinSandboxNetNs already relies on for the network namespace: only pivot when findNS returns nil (joining an existing namespace) or ErrNotExistingNS (entry present, about to be created). Fall back to chroot when the namespace type is missing from the spec entirely. Fixes #861 PR: #863 Signed-off-by: Anand-240 <anandprakashsrivastava68@gmail.com> Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk> Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
PR: #863 Signed-off-by: Anand-240 <anandprakashsrivastava68@gmail.com> Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk> Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Use a dummy path instead of a real proc path in the "namespace type missing from spec" case, merge the assert.False call and its message onto one line, and drop the unnecessary file creation in the "existing path" case since t.TempDir() already returns a real directory. Also fixes the gosec G306 warning on the removed WriteFile call. PR: #863 Signed-off-by: Anand-240 <anandprakashsrivastava68@gmail.com> Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk> Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
✅ Deploy Preview for urunc canceled.
|
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.
This PR was automatically created by GitHub Actions to merge changes from main-pr863 into main.