Skip to content
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

Merged
merged 1 commit into from
Feb 26, 2019

Conversation

adrianreber
Copy link
Collaborator

This is the fix as discussed in #2334 and it depends on runc changes from opencontainers/runc#1992

@mheon
Copy link
Member

mheon commented Feb 21, 2019

@rhatdan PTAL

@adrianreber adrianreber changed the title Fix two SELinux denials during checkpointing [WIP] Fix two SELinux denials during checkpointing Feb 21, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 21, 2019
@adrianreber
Copy link
Collaborator Author

I have to remove one of the patches as the second commit telling runc which SELinux label to use is wrong.

@adrianreber adrianreber changed the title [WIP] Fix two SELinux denials during checkpointing Fix two SELinux denials during checkpointing Feb 22, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 22, 2019
@adrianreber
Copy link
Collaborator Author

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.

libpod/oci.go Outdated Show resolved Hide resolved
libpod/container_internal_linux.go Outdated Show resolved Hide resolved
@adrianreber adrianreber changed the title Fix two SELinux denials during checkpointing Fix one (of two) SELinux denials during checkpointing Feb 25, 2019
@rhatdan
Copy link
Member

rhatdan commented Feb 25, 2019

@@ -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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx @adrianreber

@rhatdan
Copy link
Member

rhatdan commented Feb 26, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2019
libpod/container_internal_linux.go Show resolved Hide resolved
libpod/container_internal_linux.go Outdated Show resolved Hide resolved
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]>
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2019
@giuseppe
Copy link
Member

Thanks.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2019
@adrianreber
Copy link
Collaborator Author

/retest

@rhatdan
Copy link
Member

rhatdan commented Feb 26, 2019

/approve

@openshift-ci-robot
Copy link
Collaborator

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 26, 2019
@openshift-merge-robot openshift-merge-robot merged commit 02988f1 into containers:master Feb 26, 2019
@adrianreber adrianreber deleted the selinux branch February 26, 2019 15:11
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants