# fs-verity: why the root alone is not the file digest

This is a deterministic native-tool observation, not a kernel or hardware test.
The documented fs-verity construction intentionally resolves ambiguities by
hashing a descriptor, not by authenticating an isolated Merkle root.

## Reproduce

Use Python 3.12 or later and fsverity-utils v1.6, upstream commit
2543e6e5037c0b1b448282c2793f8a6ce8b12d71 (MIT licensed).
Build with make fsverity after installing the project's OpenSSL build prerequisites.
The runner records the expected source commit, not an automatically verified
build identity. It measures the executable's SHA-256 and reported version.
Source checkout and build provenance must be verified separately.
No root, mounts or verity-enabled filesystem is required. The runner only creates
disposable synthetic files in a temporary directory.

    python3 observe.py --fsverity /path/to/fsverity --output replay.json
    python3 -m unittest discover -s . -p test_observe.py

Keep observe.py, test_observe.py and results.json in one directory. The tests check
saved evidence and its runner hash; they do not rerun the native executable.
For a new run, compare the rows arrays, not timestamps or environment metadata.
The script fails on a missing tool, wrong reported version or failed command.

## Experimental design

Forty digest calls: ten cases for each combination of SHA-256/SHA-512 and
1024/4096-byte blocks. Cases include empty, one-byte, zero-extended, full-block
padded, changed-byte, multi-level, root-block-as-content, two salt encodings,
and equal contents under a different filename. Salts are absent, 00 or 0000.
Inputs are generated by the runner, not sampled from users or storage failures.

Each row retains the native 256-byte descriptor, full file digest, extracted root,
input SHA-256 and exported-tree size/hash. The runner independently hashes the
descriptor and compares it to the native output. The large fixture's first
exported tree block is reused verbatim as the smaller file's contents.

## Findings and interpretation

- A, A followed by a zero byte, and A padded to a full block share a root but
  have distinct file digests. Padding makes their hashed block bytes identical.
- A multi-level file and a file containing only its top hash block share a root
  but have distinct digests. The descriptor binds the actual file length.
- Salts 00 and 0000 pad to the same hash-compression-block-sized prefix and share
  roots for this payload. The descriptor records different salt lengths and
  yields different full digests.
- Equal contents under different names have the same digest. A changed nonzero
  payload byte changes both the root and digest in the tested controls.

The four empty-file observations export zero tree bytes and an all-zero root.
Their full digests are neither the root nor the ordinary hash of empty input.
For each hash algorithm, changing 1024-byte to 4096-byte blocks changes the
descriptor digest even though the file has no data blocks. See the retained
descriptor bytes and the article's empty-file explanation.

The validator checks known synthetic payload hashes and lengths, the empty
tree's size/hash and the exact case set, as well as descriptor consistency.
These checks reject inconsistent evidence; they cannot authenticate who ran a
measurement or prove an arbitrary binary's provenance.

These are deliberately constructed equality cases, not SHA-256/SHA-512
collisions or vulnerabilities in fs-verity. Authenticate the complete fs-verity
digest using the matching algorithm and parameters. Names, authorization and
freshness require separate policy; a newly computed digest is not a trusted
expected value. Do not generalize the fs-verity tree format to every Merkle tree.

No signing, enable/measure ioctl, cache behavior, corruption injection, persistence,
physical-media read or authentication enforcement was exercised. There is no
random sample and no failure-rate estimate or confidence interval to report.

## Primary sources

Accessed 2026-10-21. Existing Hesela synthesis:
https://hesela.com/analyses/checksums-identity-and-lost-writes/#verity-read-coverage

- Linux v6.12 fs-verity documentation, File digest computation:
  https://docs.kernel.org/6.12/filesystems/fsverity.html#file-digest-computation
- fsverity-utils v1.6 manual, digest and metadata-output options:
  https://github.com/ebiggers/fsverity-utils/blob/v1.6/man/fsverity.1
- Native construction, compute_root_hash and libfsverity_compute_digest:
  https://github.com/ebiggers/fsverity-utils/blob/2543e6e5037c0b1b448282c2793f8a6ce8b12d71/lib/compute_digest.c

The code and synthetic observations here are Hesela work. No third-party code,
binary, source archive or copyrighted paper is redistributed in this bundle.
