-
Notifications
You must be signed in to change notification settings - Fork 307
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
core: Always sort incoming xattrs #3346
Conversation
tests/test-basic-c.c
Outdated
g_assert_no_error (error); | ||
} | ||
|
||
/* And now with a swapped order */ |
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.
And I also verified that this test successfully fails if we drop the xattr canonicalization.
I get the following error when pulling an image into ostree layered on top of quay.io/fedora/fedora-kinoite. It has user.* xattrs in the container tar stream.
EDIT: If you want to see the CI job, it is here: https://github.com/prydom/my-ostree-build/actions/runs/12056266866/job/33618838686. The build container has ostree and ostree-libs build from commit 2be4c52. |
2be4c52
to
c863558
Compare
Thanks for testing this out! I pushed an update that also covers directory metadata - only unit tested here so far. |
I've done another round of end-to-end testing and the changes work well for me. On github actions:
In
On target machine:
|
When recomputing selinux attrs during commit, we weren't sorting, which could cause various issues like fsck failures. This is a big hammer; change things so we always canonicalize (i.e. sort) the incoming xattrs when creating a file header and directory metadata. I think almost all places in the code were already keeping things sorted, but it's better to ensure correctness first. If we ever have some performance issue (I'm doubtful) we could add something like `_ostree_file_header_known_canonicalized` or so. Closes: ostreedev#3343 Signed-off-by: Colin Walters <[email protected]>
Came out of a related discussion in ostree ostreedev/ostree#3346 (comment) Today we faithfully write this, and `fsck.erofs` doesn't seem to complain...but such a thing makes no sense so we shouldn't support it. Actually digging in more here...in practice the way xattrs work in Linux at least is they're restricted to starting with one of the standard prefixes like `security.` or `user.`; but enforcing/validating that is a whole other thing. For now let's just deny this edge case. Signed-off-by: Colin Walters <[email protected]>
Came out of a related discussion in ostree ostreedev/ostree#3346 (comment) Today we faithfully write this, and `fsck.erofs` doesn't seem to complain...but such a thing makes no sense so we shouldn't support it. Actually digging in more here...in practice the way xattrs work in Linux at least is they're restricted to starting with one of the standard prefixes like `security.` or `user.`; but enforcing/validating that is a whole other thing. For now let's just deny this edge case. Signed-off-by: Colin Walters <[email protected]>
OK, updated this one, should be good to go! |
c863558
to
1858d3d
Compare
When recomputing selinux attrs during commit, we weren't sorting, which could cause various issues like fsck failures.
This is a big hammer; change things so we always canonicalize (i.e. sort) the incoming xattrs when creating a file header.
I think almost all places in the code were already keeping things sorted, but it's better to ensure correctness first. If we ever have some performance issue (I'm doubtful) we could add something like
_ostree_file_header_known_canonicalized
or so.Closes: #3343