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

server: Canonize selinux label for comparison with filesystem label #5775

Merged
merged 2 commits into from Apr 7, 2022

Conversation

manuelluis
Copy link
Contributor

@manuelluis manuelluis commented Apr 4, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

If you try to use the annotation: io.kubernetes.cri-o.TrySkipVolumeSELinuxLabel, It doesn't work because, the selinux label with the mcs from the annotation in the namespace, has the wrong order in the mcs.

$ oc get project test -o yaml | grep mcs
openshift.io/sa.scc.mcs: s0:c75,c35

The selinux label for the comparison with the label in the filesystem will be: system_u:object_r:container_file_t:s0:c75,c35
but in the filesystem the label is: system_u:object_r:container_file_t:s0:c35,c75

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

None

Fixed `io.kubernetes.cri-o.TrySkipVolumeSELinuxLabel` annotation usage with the OpenShift MCS.

@openshift-ci openshift-ci bot added kind/bug Categorizes issue or PR as related to a bug. dco-signoff: no Indicates the PR's author has not DCO signed all their commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 4, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 4, 2022

Hi @manuelluis. Thanks for your PR.

I'm waiting for a cri-o member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot requested review from fgiudici and klihub April 4, 2022 10:25
Signed-off-by: Manuel Luis Sanmartín Rozada <manuel.luis@gmail.com>
@openshift-ci openshift-ci bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. and removed dco-signoff: no Indicates the PR's author has not DCO signed all their commits. labels Apr 4, 2022
if err != nil {
logrus.Errorf("Canonicalize label failed %s: %v", secLabel, err)
} else {
currentLabel, err := label.FileLabel(path)
Copy link
Member

Choose a reason for hiding this comment

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

should we Canonicalize this one as well, or do we think it'll be correct because we're reading it from disk (after it's been procesed by the kernel)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I've seen, the kernel always saves it in the correct order, even if the attribute is with the mcs out of order.
I don't know if there is any filesystem that can skip the kernel ordering and return the mcs in the wrong order.

@haircommander
Copy link
Member

/ok-to-test

Thanks for opening tihs! approach LGTM. Maybe we should create a test in test/selinux.bats with the contexts inverted to make sure this is working orrectly. That can be a follow up if you'd like, or could be brought in with this. up to you @manuelluis

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 4, 2022
…nux label

Signed-off-by: Manuel Luis Sanmartín Rozada <manuel.luis@gmail.com>
@haircommander
Copy link
Member

/retest

@haircommander
Copy link
Member

/approve

LGTM, @cri-o/cri-o-maintainers PTAL

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 4, 2022
@dmunne
Copy link

dmunne commented Apr 6, 2022

/retest

@haircommander
Copy link
Member

@saschagrunert PTAL

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

/lgtm
/retest-required

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 7, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, manuelluis, saschagrunert

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:
  • OWNERS [haircommander,saschagrunert]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@saschagrunert
Copy link
Member

Integration tests have been fixed in another PR.

@openshift-ci openshift-ci bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 7, 2022
@saschagrunert
Copy link
Member

/test integration_fedora

@openshift-merge-robot openshift-merge-robot merged commit 4db8e81 into cri-o:main Apr 7, 2022
@haircommander
Copy link
Member

/cherry-pick release-1.23

@openshift-cherrypick-robot

@haircommander: new pull request created: #5792

In response to this:

/cherry-pick release-1.23

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants