-
Notifications
You must be signed in to change notification settings - Fork 305
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
SELinux relabeling during commit causes the wrong content hash to be stored if ACLs or user xattrs are present #3343
Comments
Thanks for that analysis! Indeed this looks like a basic bug in core ostree, we need to always ensure the xattrs are sorted. (composefs does this) I recently hit a related bug in #3261 - and so a good first step here would be to change our object writing code and fsck code to enforce this. |
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: ostreedev#3343 Signed-off-by: Colin Walters <[email protected]>
@cgwalters, based on my recent test of #3346 it looks like we might need an accompanying change to ostree-ext-rs/bootc to ensure xattrs introduced by container layering are also sorted. I undid my workaround that stripped all the user.* attributes from buildah layered images during that test. |
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]>
Putting a pointer to containers/bootc#920 (comment) here. Please read the initial report there for a minimal reproduction script. The observed behavior was:
ostree fsck
on a bootable base image created from an ostree commit.ostree fsck
if further container layers added xattrs.I originally filed in bootc since I thought the bug was in the ostree-ext-rs crate but based on the following analysis I think the issue is in OSTree.
The text was updated successfully, but these errors were encountered: