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

oci: layer: skip forbidden xattrs if unchanged #259

Merged
merged 2 commits into from
Sep 11, 2018

Conversation

cyphar
Copy link
Member

@cyphar cyphar commented Sep 10, 2018

It turns out that since SELinux auto-sets labels for every directory
created, 6fd1e0e ("oci: ignore system.nfs4_acl and extend
forbidden-xattr handling") was far from sufficient to fix the overall
issue. In particular, restoring of parent metadata broke on such systems
because we try to re-apply the metadata we saw on-disk.

Erroring out because a forbidden xattr was on-disk is silly (and is
counter to what we actually want to do), so instead we can only error
out if we've been asked to change the xattr from the on-disk value. This
avoids us having to special-case restoreMetadat with on-disk data -- and
instead we can make it slightly more general. This does mean that images
which container "security.selinux" set "just right" will now be ignored,
I think that this is a small price to pay.

Fixes #235
Signed-off-by: Aleksa Sarai [email protected]

@cyphar cyphar added this to the 0.4.2 milestone Sep 10, 2018
@cyphar cyphar force-pushed the xattr-on-demand branch 2 times, most recently from 855b8ba to 7c73e71 Compare September 10, 2018 17:40
It looks like this causes test failures on Fedora. There's something odd
going on with /tmp on their system, which results in xattrs not being
able to be set. This means we cannot really do much (in the actual
unpack code we ignore this error in the same way).

Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar
Copy link
Member Author

cyphar commented Sep 10, 2018

/cc @ganto

It turns out that since SELinux auto-sets labels for every directory
created, 6fd1e0e ("oci: ignore system.nfs4_acl and extend
forbidden-xattr handling") was far from sufficient to fix the overall
issue. In particular, restoring of parent metadata broke on such systems
because we try to re-apply the metadata we saw *on-disk*.

Erroring out because a forbidden xattr was on-disk is silly (and is
counter to what we actually want to do), so instead we can only error
out if we've been asked to change the xattr from the on-disk value. This
avoids us having to special-case restoreMetadat with on-disk data -- and
instead we can make it slightly more general. This does mean that images
which container "security.selinux" set "just right" will now be ignored,
I think that this is a small price to pay.

Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar
Copy link
Member Author

cyphar commented Sep 11, 2018

LGTM, after testing on Fedora 28 it all works. I'll do a release after this is merged.

@cyphar cyphar merged commit cc4461a into opencontainers:master Sep 11, 2018
cyphar added a commit that referenced this pull request Sep 11, 2018
  oci: layer: skip forbidden xattrs if unchanged
  system: skip xattr tests if unsupported

LGTMs: @cyphar
Closes #259
@cyphar cyphar deleted the xattr-on-demand branch September 11, 2018 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unpack_test.go:169: unexpected UnpackManifest error: operation not supported
1 participant