-
Notifications
You must be signed in to change notification settings - Fork 63
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
Older kernels do not support keyring labeling #51
Conversation
@cyphar @vrothberg @mrunalp PTAL |
This is similar to what I suggested in #49, though I do wonder why not just do it like this: diff --git a/go-selinux/selinux_linux.go b/go-selinux/selinux_linux.go
index 51fa8de68a33..45e47f5eda00 100644
--- a/go-selinux/selinux_linux.go
+++ b/go-selinux/selinux_linux.go
@@ -341,6 +341,10 @@ func writeCon(fpath string, val string) error {
out, err := os.OpenFile(fpath, os.O_WRONLY, 0)
if err != nil {
+ // Non-existent /proc files indicate a vintage kernel.
+ if os.IsNotExist(err) {
+ err = nil
+ }
return err
}
defer out.Close() So any new In any case, LGTM. |
@cyphar I think the problem I have with this is it would be easy to mistake a success versus a typo in the code. |
@lifubang Could you show me the failure you are seeing with permission denied? I would always want that feedback. |
@lifubang I updated this PR to handle your issue. |
Ignore setting the kernel keyring label if the /proc/self/attr/keycreate file does not exists. runc attempts to set this file on older kernels and is blowing up. If a system has a /proc/self/attr/keyring and the caller attempts to set the label to "" and SELinux is disabled, ignore the error. Signed-off-by: Daniel J Walsh <[email protected]>
What error does this patch miss? Your patch misses Permission Denied. |
I think we don't need it any more. |
if os.IsNotExist(err) { | ||
return nil | ||
} | ||
if label == "" && os.IsPermission(err) && !GetEnabled() { |
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.
Once we really have no permission to keycreate
?
So I don't think we should use this err check.
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.
This will check if someone executes runc on a machine with /proc/self/attr/keycreate, attempted to set "", got permission denied, and SELinux was disabled, so we ignore the error.
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.
Oh, not SELinux disabled, but SELinux enabled.
I can't explain it in one sentence because of my English's level. |
@lifubang Lets stick to my PR. Rather then switching back and forth. |
I think I need to debug it to ensure it is really right, so I will work on in my PR #52 . |
@cpuguy83 Does this fix the issue you are seeing. I will merge and open a vendor for runc if it does. I am not in favor of the other patch. |
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.
Looks like it would. I will give it a try later today.
Thanks!
Ok, so the issue is |
@cpuguy83 Is this on an SELinux system? Is SELinux enabled? |
@@ -1 +1 @@ | |||
1.3.0-dev | |||
1.2.2 |
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.
Did you mean to commit this?
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.
Yes I am only bumping the minor number, Since this is only a bugfix.
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 but usually releases in OCI go through a voting process and so on. Bit odd to include it in an ordinary PR.
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.
I have not been following any such procedure on the SELinux package. I guess I could, but have not in the past. Bottom line, I would like to get this PR Verified as fixing the issue and then vendored into runc, so we can fix it there.
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, do whatever works for you.
The release procedures for all opencontainers
projects (except I guess selinux
) have all used the voting system we use for spec releases, but it's pretty obvious that's not a great model for non-spec projects. I'm hoping to correct this after we get 1.0.0
out.
Yes and yes. |
@cpuguy83 And did a patched version of runc with this patch fix the issue. I take it this is using an older RHEL/Centos kernel that did not support keycreate labels? |
@rhatdan I'm using CentOS on Azure (kernel 3.10.0-862.11.6.el7.x86_64). |
Are you seeing AVCs? |
Denial is:
With |
This is a container-selinux issue. The latest container-selinux-2.91 and greater allows this AVC. So give this a LGTM and we can move on. @mrunalp @runcom PTAL at this PR, I believe it is correct and @cpuguy83 is experiencing an different issue, that is fixed in container-selinux package. |
@cpuguy83 I just fixed another issue in container-selinux to allow spc_t to write unlabeled_t files. |
Can we get a tagged release so we can bump runc? 💚 |
full diff: opencontainers/selinux@v1.2.1...v1.2.2 - opencontainers/selinux#51 Older kernels do not support keyring labeling Signed-off-by: Sebastiaan van Stijn <[email protected]>
full diff: opencontainers/selinux@v1.2.1...v1.2.2 - opencontainers/selinux#51 Older kernels do not support keyring labeling Signed-off-by: Sebastiaan van Stijn <[email protected]>
full diff: opencontainers/selinux@v1.2.1...v1.2.2 - opencontainers/selinux#51 Older kernels do not support keyring labeling Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit e5aab17) Signed-off-by: Sebastiaan van Stijn <[email protected]>
full diff: opencontainers/selinux@v1.2.1...v1.2.2 - opencontainers/selinux#51 Older kernels do not support keyring labeling Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit e5aab17) Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 05c3be6) Signed-off-by: Sebastiaan van Stijn <[email protected]>
full diff: opencontainers/selinux@v1.2.1...v1.2.2 - opencontainers/selinux#51 Older kernels do not support keyring labeling Signed-off-by: Sebastiaan van Stijn <[email protected]> Upstream-commit: 0d453115fe0b1b19c08c614b6029c4edf92a0f0a Component: engine
full diff: opencontainers/selinux@v1.2.1...v1.2.2 - opencontainers/selinux#51 Older kernels do not support keyring labeling Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 0d45311) Signed-off-by: Sebastiaan van Stijn <[email protected]>
full diff: opencontainers/selinux@v1.2.1...v1.2.2 - opencontainers/selinux#51 Older kernels do not support keyring labeling Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit 0d453115fe0b1b19c08c614b6029c4edf92a0f0a) Signed-off-by: Sebastiaan van Stijn <[email protected]> Upstream-commit: e7a837120de1f4f2d45c673e758bd444441a0c8f Component: engine
full diff: opencontainers/selinux@v1.2.1...v1.2.2 - opencontainers/selinux#51 Older kernels do not support keyring labeling Signed-off-by: Sebastiaan van Stijn <[email protected]>
Ignore setting the kernel keyring label if the
/proc/self/attr/keycreate file does not exists.
runc attempts to set this file on older kernels and is blowing up.
Signed-off-by: Daniel J Walsh [email protected]