-
Notifications
You must be signed in to change notification settings - Fork 814
run: handle relabeling bind mounts ourselves #6132
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
Open
nalind
wants to merge
1
commit into
containers:main
Choose a base branch
from
nalind:relabel-binds
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -543,6 +543,33 @@ rootless=%d | |||||||||||||||||
|
||||||||||||||||||
defer b.cleanupTempVolumes() | ||||||||||||||||||
|
||||||||||||||||||
// Handle mount flags that request that the source locations for "bind" mountpoints be | ||||||||||||||||||
// relabeled, and filter those flags out of the list of mount options we pass to the | ||||||||||||||||||
// runtime. | ||||||||||||||||||
for i := range spec.Mounts { | ||||||||||||||||||
switch spec.Mounts[i].Type { | ||||||||||||||||||
default: | ||||||||||||||||||
continue | ||||||||||||||||||
case "bind", "rbind": | ||||||||||||||||||
// all good, keep going | ||||||||||||||||||
} | ||||||||||||||||||
Comment on lines
+550
to
+555
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Do you think |
||||||||||||||||||
zflag := "" | ||||||||||||||||||
for _, opt := range spec.Mounts[i].Options { | ||||||||||||||||||
if opt == "z" || opt == "Z" { | ||||||||||||||||||
zflag = opt | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
if zflag == "" { | ||||||||||||||||||
continue | ||||||||||||||||||
} | ||||||||||||||||||
spec.Mounts[i].Options = slices.DeleteFunc(spec.Mounts[i].Options, func(opt string) bool { | ||||||||||||||||||
return opt == "z" || opt == "Z" | ||||||||||||||||||
}) | ||||||||||||||||||
if err := relabel(spec.Mounts[i].Source, b.MountLabel, zflag == "z"); err != nil { | ||||||||||||||||||
return fmt.Errorf("setting file label %q on %q: %w", b.MountLabel, spec.Mounts[i].Source, err) | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
switch isolation { | ||||||||||||||||||
case define.IsolationOCI: | ||||||||||||||||||
var moreCreateArgs []string | ||||||||||||||||||
|
@@ -1139,16 +1166,19 @@ func (b *Builder) runSetupVolumeMounts(mountLabel string, volumeMounts []string, | |||||||||||||||||
if err := relabel(host, mountLabel, true); err != nil { | ||||||||||||||||||
return specs.Mount{}, err | ||||||||||||||||||
} | ||||||||||||||||||
options = slices.DeleteFunc(options, func(o string) bool { return o == "z" }) | ||||||||||||||||||
} | ||||||||||||||||||
if foundZ { | ||||||||||||||||||
if err := relabel(host, mountLabel, false); err != nil { | ||||||||||||||||||
return specs.Mount{}, err | ||||||||||||||||||
} | ||||||||||||||||||
options = slices.DeleteFunc(options, func(o string) bool { return o == "Z" }) | ||||||||||||||||||
} | ||||||||||||||||||
if foundU { | ||||||||||||||||||
if err := chown.ChangeHostPathOwnership(host, true, idMaps.processUID, idMaps.processGID); err != nil { | ||||||||||||||||||
return specs.Mount{}, err | ||||||||||||||||||
} | ||||||||||||||||||
options = slices.DeleteFunc(options, func(o string) bool { return o == "U" }) | ||||||||||||||||||
} | ||||||||||||||||||
if foundO { | ||||||||||||||||||
if (upperDir != "" && workDir == "") || (workDir != "" && upperDir == "") { | ||||||||||||||||||
|
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have dropped all runc testing not to long ago in podman. It was a huge maintenance headache.
Every image update now has yet another big failure point which causes regressions. As the person who currently manages all the updates I am strongly against making my life harder with these things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What failure point do you mean? I wouldn't expect that installing the package, which should already be available, would be more than a one-time change. Beyond that, I'm not clear on what it is that you think I'm asking you to take on here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost every CI image update contains one or more regressions in our dependencies, kernel, systemd, golang, crun, glibc, well you get the point. By testing with runc every runc update is now a new potential failure point that then blocks image updates and requires me (or whoever does the image update) to do the work of investigating the test failure, reporting the bug and/or adding a work around or skip to test. Can that be done? Sure, but we decided over a year ago that we no longer want to test runc (containers/podman#22706) and I at least am not interested in doing a ton of extra work for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then those can be marked as not required for the "Total Success" check. But the idea of fixing this bug that runc exposes, and then not taking available steps to help ensure that we won't encounter something similar again, doesn't sit well with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure that would not block the image update but then you have a permanent red check until someone takes the time to fix it. My general experiences around such things have no been good at all as people just quickly ignore that then. And overall it does not remove the time someone has to invest to fix that.
So to me the question is do we want to spend time dealing with runc issues or not, as I remember the discussion a year ago the answer was no. If you think we should then we likely should discus that as a team again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could have caught this bug earlier. If we need to have a conversation about that, then I think we should have the conversation.