-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix one (of two) SELinux denials during checkpointing #2382
Conversation
@rhatdan PTAL |
I have to remove one of the patches as the second commit telling runc which SELinux label to use is wrong. |
This PR is now only about the SELinux labelling of the CRIU logfile. It has no dependency on runc or anything else. This includes all changes from the reviews. |
LGTM |
@@ -482,6 +482,19 @@ func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointO | |||
if c.state.State != ContainerStateRunning { | |||
return errors.Wrapf(ErrCtrStateInvalid, "%q is not running, cannot checkpoint", c.state.State) | |||
} | |||
|
|||
// Create the CRIU log file and label it | |||
dumpLog := filepath.Join(c.bundlePath(), "dump.log") |
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.
👍
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.
LGTM, thx @adrianreber
/lgtm |
CRIU creates a log file during checkpointing in .../userdata/dump.log. The problem with this file is, is that CRIU injects a parasite code into the container processes and this parasite code also writes to the same log file. At this point a process from the inside of the container is trying to access the log file on the outside of the container and SELinux prohibits this. To enable writing to the log file from the injected parasite code, this commit creates an empty log file and labels the log file with c.MountLabel(). CRIU uses existing files when writing it logs so the log file label persists and now, with the correct label, SELinux no longer blocks access to the log file. Signed-off-by: Adrian Reber <[email protected]>
Thanks. /lgtm |
/retest |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: adrianreber, rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This is the fix as discussed in #2334 and it depends on runc changes from opencontainers/runc#1992