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

We should only be relabeling when on first run #11959

Merged
merged 1 commit into from
Oct 18, 2021

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Oct 13, 2021

On the second runs, the labels should be the same so no
need to relabel.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2013548

Signed-off-by: Daniel J Walsh [email protected]

What this PR does / why we need it:

How to verify it

Which issue(s) this PR fixes:

Special notes for your reviewer:

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 13, 2021
run ls -dZ $tmpdir
is "$output" "system_u:object_r:usr_t:s0 $tmpdir" \
"Start did not Relabel"

Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test for the chown change too? It would be nice to have a note in the description about that change.

@Luap99
Copy link
Member

Luap99 commented Oct 14, 2021

Can you explain how this fixes the linked issue. The issue is talking about random failures during relabel. AFAIK you are allowed to relabel more than once.
This change could also cause problems for people mounting a directory on a tmpfs. After a reboot the container start will not relabel it. Would the correct fix be to look at the the current label and only relabel if it is different?

@rhatdan
Copy link
Member Author

rhatdan commented Oct 14, 2021

Good point on the tmpfs, as far as the linked message, it would at least make it less likely. I believe the linked issue is most likely a problem in Ceph file system not in Podman at all.

The main advantage of this fix is if a directory had a massive amount of files, the relabel will no longer be done.

@rhatdan
Copy link
Member Author

rhatdan commented Oct 14, 2021

Top level directory is now checked to make sure it matches the UID, before chowning and checks the label before relabeling.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

@rhatdan rhatdan force-pushed the selinux branch 3 times, most recently from 089edb3 to 5bb19ea Compare October 14, 2021 17:49
On the second runs, the labels should be the same so no
need to relabel.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2013548

Signed-off-by: Daniel J Walsh <[email protected]>
@flouthoc
Copy link
Collaborator

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 18, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 18, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: flouthoc, 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-merge-robot openshift-merge-robot merged commit e0ffc43 into containers:main Oct 18, 2021
@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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 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.

5 participants