Merge patch series "boot: fit: authenticate the dm-verity roothash"

Daniel Golle <daniel@makrotopia.org> says:

A signed FIT configuration can delegate the integrity of a (potentially
large) root filesystem image to the kernel's dm-verity instead of having
U-Boot hash the whole payload at boot: the FIT carries a "dm-verity"
subnode with the roothash, salt and block parameters, U-Boot passes the
roothash to Linux through the dm-mod.create bootargs, and dm-verity then
validates the filesystem block by block against it.

For that to be safe the roothash has to be trusted, and in a signed
configuration the only thing that establishes trust is the configuration
signature. The roothash was not covered by it. fit_config_add_hash()
collected the image node, its hash subnodes and its cipher subnode into
the signed region, but not the dm-verity subnode, so the roothash, the
sole integrity anchor for the filesystem, was left unsigned.

The result is a verified-boot bypass for the root filesystem: an
attacker who can rewrite the boot medium can replace the filesystem,
recompute a matching dm-verity tree, write the new roothash into the
unsigned dm-verity subnode, and the configuration signature still
verifies. dm-verity then faithfully validates the malicious filesystem
against the attacker's roothash.

This series closes the gap.

Link: https://lore.kernel.org/r/cover.1785276461.git.daniel@makrotopia.org
This commit is contained in:
Tom Rini
2026-08-10 12:37:16 -06:00
8 changed files with 580 additions and 67 deletions
@@ -0,0 +1,10 @@
.. SPDX-License-Identifier: GPL-2.0+
test_fit_verity_sign
====================
.. automodule:: test_fit_verity_sign
:synopsis:
:member-order: bysource
:members:
:undoc-members:
+5
View File
@@ -209,6 +209,11 @@ typically be obtained from its output.
The ``digest`` and ``salt`` byte arrays correspond to the hex-encoded
``Root hash`` and ``Salt`` printed by ``veritysetup format``.
When the configuration is signed, ``digest`` and ``salt`` are covered by
the configuration signature (see :doc:`signature`), so the roothash
cannot be swapped out for a matching one without invalidating the
signature.
Optional boolean properties (when present, they are collected and appended
as dm-verity optional parameters with hyphens converted to underscores):
+1 -1
View File
@@ -359,7 +359,7 @@ however, U-Boot does not read 'hashed-nodes'. Instead it rebuilds the node
list from the configuration's own image references (kernel, fdt, ramdisk,
etc.), since 'hashed-nodes' is not itself covered by the signature. The
rebuilt list always includes the root node, the configuration node, each
referenced image node and its hash/cipher subnodes.
referenced image node and its hash, cipher and dm-verity subnodes.
The image is walked in order and each tag processed as follows: