deploy: Don't recompute verity checksums if not enabled
authorColin Walters <walters@verbum.org>
Sun, 27 Oct 2024 14:20:29 +0000 (10:20 -0400)
committerColin Walters <walters@verbum.org>
Mon, 28 Oct 2024 13:31:34 +0000 (09:31 -0400)
commita6d07b6cc3a6030307c6e29aaf33944ff0ad8c8b
treefdc27802e648fa9b79b42453532668f295ecac55
parent3625130ec098e19bfa3c26696ffb237b0120b546
deploy: Don't recompute verity checksums if not enabled

This fixes a truly horrific performance bug when
composefs is enabled, but fsverity is not supported
by the filesystem. We'd fall back to doing *userspace*
checksumming of all files at deployment time which was absolutely
not expected or required.

There's really an immense amount of technical debt
here, such as the confusion between `ex-integity.composefs`
vs the prepare-root config, how we handle "torn" states
where some objects don't have verity enabled but some do,
etc.

The ostree composefs state has two modes:

- signed: We need to enforce fsverity
- unsigned: Best effort resilience

So we fix this by making the deploy path to make verity
"opportunistic" - if the ioctl gives us the data, then we
add it to the composefs.

However, this code path is also invoked when we're
computing the expected composefs digest to inject
as commit metadata, and *that* API must work regardless
of whether the target repo has fsverity enabled as
it may operate on a build server.

One lucky thing in all of this: When I went to add
the "checkout composefs" API I added a stub `GVariant`
for options extensibility, which we now use.

Signed-off-by: Colin Walters <walters@verbum.org>
man/ostree-checkout.xml
src/libostree/ostree-repo-checkout.c
src/libostree/ostree-repo-composefs.c
src/libostree/ostree-repo-private.h
src/libostree/ostree-sysroot-deploy.c
src/libotutil/ot-gio-utils.c
src/libotutil/ot-gio-utils.h
src/ostree/ot-builtin-checkout.c
tests/test-composefs.sh
tests/test-ot-unix-utils.c