dm-verity
dm-verity is a Linux device-mapper target that verifies a read-only block mapping against a trusted cryptographic root hash.
The root hash must come from a trusted source; ordinary block checking does not authenticate that source. Optional forward-error correction can recover some damaged data, but recovered bytes must still pass hash verification. [1]
The device-mapper status character V reports that checks performed so far succeeded; it does not establish that every block was read. C reports detected corruption. Monitoring must retain the mapping options, because ignore_corruption permits access despite a detected mismatch, while check_at_most_once limits data verification to the first read and does not protect against subsequent online changes. [1]
With ignore_zero_blocks, ranges identified by the expected zero-block digest return zeros without verification of the underlying data. Successful reads do not certify those backing bytes. [1]
A hash block holds as many digests as fit, so SHA-256 with 4,096-byte blocks gives 128 per block, and 32,768 data blocks need 256 + 2 + 1 = 259 hash blocks, 0.79% of the data. Blocks whose hash block was already verified are checked without walking the tree again. [1] [3]
A study of hash trees on fast storage measured a writable binary tree losing about 60% of write-heavy throughput at 16 MB and 75% at 4 TB, while reads stayed cheap because the hash cache hit rate exceeded 99%. [4]
Relations
- related
- Merkle tree, fs-verity, dm-integrity, Rollback protection, Dynamic Merkle Tree, Hash collision, EROFS, SquashFS
Advantages
- Read-only block verification can authenticate accessed data against a trusted root without reading the whole volume in advance. [1]
- A pkcs7 signature of the root hash can be checked against a kernel keyring when the kernel is built with that option. [1]
Limitations
- ignore_corruption permits reads after detected corruption; check_at_most_once reduces protection against online changes. [1]
- The kernel ignores the on-disk header, so user space has to verify it or pass the parameters on a verified command line. [1]
Citations
- Linux v6.12 documentation: dm-verity, parameters, failure policies and hash-tree format
- Linux v6.12 drivers/md/dm-verity-target.c: tree levels, verification order, corruption modes.
- Burke, Sheatsley, King, Hines, Swift, McDaniel. On Scalable Integrity Checking for Secure Cloud Disks. USENIX FAST 2025 (arXiv 2405.03830).
Further reading
Sources & caveats
- The kernel documentation and code are project material for v6.12; newer kernels may differ.
- The hash-tree cost study is a university paper that measured a writable binary tree in its own block-device driver on fast local storage, not the kernel target, so it shows hash-tree cost under writes rather than dm-verity cost on a read-only system.
- The 60% and 75% losses are for a write-heavy example with a 1% read ratio against an encryption-only baseline; no independent measurement of the kernel target read overhead was found.
- Arithmetic from the documentation example: 4,096 / 32 = 128 digests per block; 32,768 / 128 = 256, then 2, then 1, so 259 hash blocks, 0.79% of the data.