Skip to content

Commit

Permalink
Fix _ostree_ensure_fsverity reporting of supports in early exit
Browse files Browse the repository at this point in the history
If supported_out is passed to _ostree_ensure_fsverity and we
successfully exit early, for example because the file is a symlink, then
*supported_out is not initialized.

This is problematic in the case of ostree_sysroot_update_post_copy(),
because it passes in an uninitialized supported, and on successfull
return of _ostree_ensure_fsverity() it assumes that it is iniialized.

In case supported happened to be initialized to non-zero it will take
this branch:

      if (!supported)
        break; /* If not supported, skip rest */

Which means *all* further objects will not get fs-verity enabled.
  • Loading branch information
alexlarsson committed May 15, 2024
1 parent f911d40 commit 083eacd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libostree/ostree-repo-verity.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ _ostree_ensure_fsverity (OstreeRepo *self, gboolean allow_enoent, int dirfd, con
struct stat buf;
gboolean supported;

if (supported_out)
*supported_out = TRUE;

if (fstatat (dirfd, path, &buf, AT_SYMLINK_NOFOLLOW) != 0)
{
if (errno == ENOENT && allow_enoent)
Expand Down

0 comments on commit 083eacd

Please sign in to comment.