sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget4/translations/zh_CN/admin-guide/device-mapper/veritymodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/zh_TW/admin-guide/device-mapper/veritymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/it_IT/admin-guide/device-mapper/veritymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/ja_JP/admin-guide/device-mapper/veritymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/ko_KR/admin-guide/device-mapper/veritymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget4/translations/sp_SP/admin-guide/device-mapper/veritymodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(h dm-verityh]h dm-verity}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhN/var/lib/git/docbuild/linux/Documentation/admin-guide/device-mapper/verity.rsthKubh paragraph)}(hDevice-Mapper's "verity" target provides transparent integrity checking of block devices using a cryptographic digest provided by the kernel crypto API. This target is read-only.h]hDevice-Mapper’s “verity” target provides transparent integrity checking of block devices using a cryptographic digest provided by the kernel crypto API. This target is read-only.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(hConstruction Parametersh]hConstruction Parameters}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh literal_block)}(h [<#opt_params> ]h]h [<#opt_params> ]}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhKhhhhubhdefinition_list)}(hhh](hdefinition_list_item)}(hX This is the type of the on-disk hash format. 0 is the original format used in the Chromium OS. The salt is appended when hashing, digests are stored continuously and the rest of the block is padded with zeroes. 1 is the current format that should be used for new devices. The salt is prepended when hashing and each digest is padded with zeroes to the power of two. h](hterm)}(h h]h }(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhubh definition)}(hhh](h)}(h,This is the type of the on-disk hash format.h]h,This is the type of the on-disk hash format.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hhh](h)}(h0 is the original format used in the Chromium OS. The salt is appended when hashing, digests are stored continuously and the rest of the block is padded with zeroes. h](h)}(h10 is the original format used in the Chromium OS.h]h10 is the original format used in the Chromium OS.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(hhh]h)}(hsThe salt is appended when hashing, digests are stored continuously and the rest of the block is padded with zeroes.h]hsThe salt is appended when hashing, digests are stored continuously and the rest of the block is padded with zeroes.}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj-ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(h1 is the current format that should be used for new devices. The salt is prepended when hashing and each digest is padded with zeroes to the power of two. h](h)}(h<1 is the current format that should be used for new devices.h]h<1 is the current format that should be used for new devices.}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjJubj)}(hhh]h)}(h]The salt is prepended when hashing and each digest is padded with zeroes to the power of two.h]h]The salt is prepended when hashing and each digest is padded with zeroes to the power of two.}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj\ubah}(h]h ]h"]h$]h&]uh1jhjJubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1jhhubeh}(h]h ]h"]h$]h&]uh1hhhhKhhubh)}(h This is the device containing data, the integrity of which needs to be checked. It may be specified as a path, like /dev/sdaX, or a device number, :. h](h)}(hh]h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hjubj)}(hhh]h)}(hThis is the device containing data, the integrity of which needs to be checked. It may be specified as a path, like /dev/sdaX, or a device number, :.h]hThis is the device containing data, the integrity of which needs to be checked. It may be specified as a path, like /dev/sdaX, or a device number, :.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhK"hhhhubh)}(h This is the device that supplies the hash tree data. It may be specified similarly to the device path and may be the same device. If the same device is used, the hash_start should be outside the configured dm-verity device. h](h)}(h h]h }(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hjubj)}(hhh]h)}(hThis is the device that supplies the hash tree data. It may be specified similarly to the device path and may be the same device. If the same device is used, the hash_start should be outside the configured dm-verity device.h]hThis is the device that supplies the hash tree data. It may be specified similarly to the device path and may be the same device. If the same device is used, the hash_start should be outside the configured dm-verity device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhK(hhhhubh)}(hu The block size on a data device in bytes. Each block corresponds to one digest on the hash device. h](h)}(hh]h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK,hjubj)}(hhh]h)}(hbThe block size on a data device in bytes. Each block corresponds to one digest on the hash device.h]hbThe block size on a data device in bytes. Each block corresponds to one digest on the hash device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK+hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhK,hhhhubh)}(h5 The size of a hash block in bytes. h](h)}(hh]h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hjubj)}(hhh]h)}(h"The size of a hash block in bytes.h]h"The size of a hash block in bytes.}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hj*ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhK/hhhhubh)}(h The number of data blocks on the data device. Additional blocks are inaccessible. You can place hashes to the same partition as data, in this case hashes are placed after . h](h)}(hh]h}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hjGubj)}(hhh]h)}(hThe number of data blocks on the data device. Additional blocks are inaccessible. You can place hashes to the same partition as data, in this case hashes are placed after .h]hThe number of data blocks on the data device. Additional blocks are inaccessible. You can place hashes to the same partition as data, in this case hashes are placed after .}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK2hjYubah}(h]h ]h"]h$]h&]uh1jhjGubeh}(h]h ]h"]h$]h&]uh1hhhhK4hhhhubh)}(h This is the offset, in -blocks, from the start of hash_dev to the root block of the hash tree. h](h)}(hh]h}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hjvubj)}(hhh]h)}(hoThis is the offset, in -blocks, from the start of hash_dev to the root block of the hash tree.h]hoThis is the offset, in -blocks, from the start of hash_dev to the root block of the hash tree.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK7hjubah}(h]h ]h"]h$]h&]uh1jhjvubeh}(h]h ]h"]h$]h&]uh1hhhhK8hhhhubh)}(h{ The cryptographic hash algorithm used for this device. This should be the name of the algorithm, like "sha1". h](h)}(h h]h }(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK The hexadecimal encoding of the cryptographic hash of the root hash block and the salt. This hash should be trusted as there is no other authenticity beyond this point. h](h)}(hh]h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjubj)}(hhh]h)}(hThe hexadecimal encoding of the cryptographic hash of the root hash block and the salt. This hash should be trusted as there is no other authenticity beyond this point.h]hThe hexadecimal encoding of the cryptographic hash of the root hash block and the salt. This hash should be trusted as there is no other authenticity beyond this point.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK?hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKAhhhhubh)}(h3 The hexadecimal encoding of the salt value. h](h)}(hh]h}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhjubj)}(hhh]h)}(h+The hexadecimal encoding of the salt value.h]h+The hexadecimal encoding of the salt value.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKDhhhhubh)}(hX<#opt_params> Number of optional parameters. If there are no optional parameters, the optional parameters section can be skipped or #opt_params can be zero. Otherwise #opt_params is the number of following arguments. Example of optional parameters section: 1 ignore_corruption h](h)}(h <#opt_params>h]h <#opt_params>}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhj2ubj)}(hhh](h)}(hNumber of optional parameters. If there are no optional parameters, the optional parameters section can be skipped or #opt_params can be zero. Otherwise #opt_params is the number of following arguments.h]hNumber of optional parameters. If there are no optional parameters, the optional parameters section can be skipped or #opt_params can be zero. Otherwise #opt_params is the number of following arguments.}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKGhjDubh)}(hhh]h)}(h Use forward error correction (FEC) to recover from corruption if hash verification fails. Use encoding data from the specified device. This may be the same device where data and hash blocks reside, in which case fec_start must be outside data and hash areas. If the encoding data covers additional metadata, it must be accessible on the hash device after the hash blocks. Note: block sizes for data and hash devices must match. Also, if the verity is encrypted the should be too. h](h)}(huse_fec_from_device h]huse_fec_from_device }(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKrhjubj)}(hhh](h)}(hXUse forward error correction (FEC) to recover from corruption if hash verification fails. Use encoding data from the specified device. This may be the same device where data and hash blocks reside, in which case fec_start must be outside data and hash areas.h]hXUse forward error correction (FEC) to recover from corruption if hash verification fails. Use encoding data from the specified device. This may be the same device where data and hash blocks reside, in which case fec_start must be outside data and hash areas.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKihjubh)}(hpIf the encoding data covers additional metadata, it must be accessible on the hash device after the hash blocks.h]hpIf the encoding data covers additional metadata, it must be accessible on the hash device after the hash blocks.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhjubh)}(h{Note: block sizes for data and hash devices must match. Also, if the verity is encrypted the should be too.h]h{Note: block sizes for data and hash devices must match. Also, if the verity is encrypted the should be too.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKqhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKrhhhhubh)}(hfec_roots Number of generator roots. This equals to the number of parity bytes in the encoding data. For example, in RS(M, N) encoding, the number of roots is M-N. h](h)}(hfec_roots h]hfec_roots }(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKwhjubj)}(hhh]h)}(hNumber of generator roots. This equals to the number of parity bytes in the encoding data. For example, in RS(M, N) encoding, the number of roots is M-N.h]hNumber of generator roots. This equals to the number of parity bytes in the encoding data. For example, in RS(M, N) encoding, the number of roots is M-N.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKuhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKwhhhhubh)}(hfec_blocks The number of encoding data blocks on the FEC device. The block size for the FEC device is . h](h)}(hfec_blocks h]hfec_blocks }(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK{hj-ubj)}(hhh]h)}(hmThe number of encoding data blocks on the FEC device. The block size for the FEC device is .h]hmThe number of encoding data blocks on the FEC device. The block size for the FEC device is .}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKzhj?ubah}(h]h ]h"]h$]h&]uh1jhj-ubeh}(h]h ]h"]h$]h&]uh1hhhhK{hhhhubh)}(hfec_start This is the offset, in blocks, from the start of the FEC device to the beginning of the encoding data. h](h)}(hfec_start h]hfec_start }(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj\ubj)}(hhh]h)}(hxThis is the offset, in blocks, from the start of the FEC device to the beginning of the encoding data.h]hxThis is the offset, in blocks, from the start of the FEC device to the beginning of the encoding data.}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK~hjnubah}(h]h ]h"]h$]h&]uh1jhj\ubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXcheck_at_most_once Verify data blocks only the first time they are read from the data device, rather than every time. This reduces the overhead of dm-verity so that it can be used on systems that are memory and/or CPU constrained. However, it provides a reduced level of security because only offline tampering of the data device's content will be detected, not online tampering. Hash blocks are still verified each time they are read from the hash device, since verification of hash blocks is less performance critical than data blocks, and a hash block will not be verified any more after all the data blocks it covers have been verified anyway. h](h)}(hcheck_at_most_onceh]hcheck_at_most_once}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(hhh](h)}(hXjVerify data blocks only the first time they are read from the data device, rather than every time. This reduces the overhead of dm-verity so that it can be used on systems that are memory and/or CPU constrained. However, it provides a reduced level of security because only offline tampering of the data device's content will be detected, not online tampering.h]hXlVerify data blocks only the first time they are read from the data device, rather than every time. This reduces the overhead of dm-verity so that it can be used on systems that are memory and/or CPU constrained. However, it provides a reduced level of security because only offline tampering of the data device’s content will be detected, not online tampering.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hX Hash blocks are still verified each time they are read from the hash device, since verification of hash blocks is less performance critical than data blocks, and a hash block will not be verified any more after all the data blocks it covers have been verified anyway.h]hX Hash blocks are still verified each time they are read from the hash device, since verification of hash blocks is less performance critical than data blocks, and a hash block will not be verified any more after all the data blocks it covers have been verified anyway.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXroot_hash_sig_key_desc This is the description of the USER_KEY that the kernel will lookup to get the pkcs7 signature of the roothash. The pkcs7 signature is used to validate the root hash during the creation of the device mapper block device. Verification of roothash depends on the config DM_VERITY_VERIFY_ROOTHASH_SIG being set in the kernel. The signatures are checked against the builtin trusted keyring by default, or the secondary trusted keyring if DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING is set. The secondary trusted keyring includes by default the builtin trusted keyring, and it can also gain new certificates at run time if they are signed by a certificate already in the secondary trusted keyring. h](h)}(h(root_hash_sig_key_desc h]h(root_hash_sig_key_desc }(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(hhh]h)}(hXThis is the description of the USER_KEY that the kernel will lookup to get the pkcs7 signature of the roothash. The pkcs7 signature is used to validate the root hash during the creation of the device mapper block device. Verification of roothash depends on the config DM_VERITY_VERIFY_ROOTHASH_SIG being set in the kernel. The signatures are checked against the builtin trusted keyring by default, or the secondary trusted keyring if DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING is set. The secondary trusted keyring includes by default the builtin trusted keyring, and it can also gain new certificates at run time if they are signed by a certificate already in the secondary trusted keyring.h]hXThis is the description of the USER_KEY that the kernel will lookup to get the pkcs7 signature of the roothash. The pkcs7 signature is used to validate the root hash during the creation of the device mapper block device. Verification of roothash depends on the config DM_VERITY_VERIFY_ROOTHASH_SIG being set in the kernel. The signatures are checked against the builtin trusted keyring by default, or the secondary trusted keyring if DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING is set. The secondary trusted keyring includes by default the builtin trusted keyring, and it can also gain new certificates at run time if they are signed by a certificate already in the secondary trusted keyring.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXtry_verify_in_tasklet If verity hashes are in cache and the IO size does not exceed the limit, verify data blocks in bottom half instead of workqueue. This option can reduce IO latency. The size limits can be configured via /sys/module/dm_verity/parameters/use_bh_bytes. The four parameters correspond to limits for IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE and IOPRIO_CLASS_IDLE in turn. For example: ,,, 4096,4096,4096,4096 h](h)}(htry_verify_in_taskleth]htry_verify_in_tasklet}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj)}(hhh]h)}(hXIf verity hashes are in cache and the IO size does not exceed the limit, verify data blocks in bottom half instead of workqueue. This option can reduce IO latency. The size limits can be configured via /sys/module/dm_verity/parameters/use_bh_bytes. The four parameters correspond to limits for IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE and IOPRIO_CLASS_IDLE in turn. For example: ,,, 4096,4096,4096,4096h]hXIf verity hashes are in cache and the IO size does not exceed the limit, verify data blocks in bottom half instead of workqueue. This option can reduce IO latency. The size limits can be configured via /sys/module/dm_verity/parameters/use_bh_bytes. The four parameters correspond to limits for IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE and IOPRIO_CLASS_IDLE in turn. For example: ,,, 4096,4096,4096,4096}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]h ]h"]h$]h&]uh1hhhhhhNhNubeh}(h]construction-parametersah ]h"]construction parametersah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hTheory of operationh]hTheory of operation}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj4hhhhhKubh)}(hdm-verity is meant to be set up as part of a verified boot path. This may be anything ranging from a boot using tboot or trustedgrub to just booting from a known-good device (like a USB drive or CD).h]hdm-verity is meant to be set up as part of a verified boot path. This may be anything ranging from a boot using tboot or trustedgrub to just booting from a known-good device (like a USB drive or CD).}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj4hhubh)}(hXWhen a dm-verity device is configured, it is expected that the caller has been authenticated in some way (cryptographic signatures, etc). After instantiation, all hashes will be verified on-demand during disk access. If they cannot be verified up to the root node of the tree, the root hash, then the I/O will fail. This should detect tampering with any data on the device and the hash data.h]hXWhen a dm-verity device is configured, it is expected that the caller has been authenticated in some way (cryptographic signatures, etc). After instantiation, all hashes will be verified on-demand during disk access. If they cannot be verified up to the root node of the tree, the root hash, then the I/O will fail. This should detect tampering with any data on the device and the hash data.}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj4hhubh)}(hCryptographic hashes are used to assert the integrity of the device on a per-block basis. This allows for a lightweight hash computation on first read into the page cache. Block hashes are stored linearly, aligned to the nearest block size.h]hCryptographic hashes are used to assert the integrity of the device on a per-block basis. This allows for a lightweight hash computation on first read into the page cache. Block hashes are stored linearly, aligned to the nearest block size.}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj4hhubh)}(hIf forward error correction (FEC) support is enabled any recovery of corrupted data will be verified using the cryptographic hash of the corresponding data. This is why combining error correction with integrity checking is essential.h]hIf forward error correction (FEC) support is enabled any recovery of corrupted data will be verified using the cryptographic hash of the corresponding data. This is why combining error correction with integrity checking is essential.}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj4hhubh)}(hhh](h)}(h Hash Treeh]h Hash Tree}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj}hhhhhKubh)}(hEach node in the tree is a cryptographic hash. If it is a leaf node, the hash of some data block on disk is calculated. If it is an intermediary node, the hash of a number of child nodes is calculated.h]hEach node in the tree is a cryptographic hash. If it is a leaf node, the hash of some data block on disk is calculated. If it is an intermediary node, the hash of a number of child nodes is calculated.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj}hhubh)}(hXGEach entry in the tree is a collection of neighboring nodes that fit in one block. The number is determined based on block_size and the size of the selected cryptographic digest algorithm. The hashes are linearly-ordered in this entry and any unaligned trailing space is ignored but included when calculating the parent node.h]hXGEach entry in the tree is a collection of neighboring nodes that fit in one block. The number is determined based on block_size and the size of the selected cryptographic digest algorithm. The hashes are linearly-ordered in this entry and any unaligned trailing space is ignored but included when calculating the parent node.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj}hhubh)}(hThe tree looks something like:h]hThe tree looks something like:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj}hhubh block_quote)}(h4alg = sha256, num_blocks = 32768, block_size = 4096 h]h)}(h3alg = sha256, num_blocks = 32768, block_size = 4096h]h3alg = sha256, num_blocks = 32768, block_size = 4096}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhhhKhj}hhubh)}(hX [ root ] / . . . \ [entry_0] [entry_1] / . . . \ . . . \ [entry_0_0] . . . [entry_0_127] . . . . [entry_1_127] / ... \ / . . . \ / \ blk_0 ... blk_127 blk_16256 blk_16383 blk_32640 . . . blk_32767h]hX [ root ] / . . . \ [entry_0] [entry_1] / . . . \ . . . \ [entry_0_0] . . . [entry_0_127] . . . . [entry_1_127] / ... \ / . . . \ / \ blk_0 ... blk_127 blk_16256 blk_16383 blk_32640 . . . blk_32767}hjsbah}(h]h ]h"]h$]h&]hhuh1hhhhKhj}hhubeh}(h] hash-treeah ]h"] hash treeah$]h&]uh1hhj4hhhhhKubeh}(h]theory-of-operationah ]h"]theory of operationah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hOn-disk formath]hOn-disk format}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hThe verity kernel code does not read the verity metadata on-disk header. It only reads the hash blocks which directly follow the header. It is expected that a user-space tool will verify the integrity of the verity header.h]hThe verity kernel code does not read the verity metadata on-disk header. It only reads the hash blocks which directly follow the header. It is expected that a user-space tool will verify the integrity of the verity header.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hAlternatively, the header can be omitted and the dmsetup parameters can be passed via the kernel command-line in a rooted chain of trust where the command-line is verified.h]hAlternatively, the header can be omitted and the dmsetup parameters can be passed via the kernel command-line in a rooted chain of trust where the command-line is verified.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hDirectly following the header (and with sector number padded to the next hash block boundary) are the hash blocks which are stored a depth at a time (starting from the root), sorted in order of increasing index.h]hDirectly following the header (and with sector number padded to the next hash block boundary) are the hash blocks which are stored a depth at a time (starting from the root), sorted in order of increasing index.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hzThe full specification of kernel parameters and on-disk metadata format is available at the cryptsetup project's wiki pageh]h|The full specification of kernel parameters and on-disk metadata format is available at the cryptsetup project’s wiki page}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h8https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity h]h)}(h7https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerityh]h reference)}(hj?h]h7https://gitlab.com/cryptsetup/cryptsetup/wikis/DMVerity}(hjChhhNhNubah}(h]h ]h"]h$]h&]refurij?uh1jAhj=ubah}(h]h ]h"]h$]h&]uh1hhhhKhj9ubah}(h]h ]h"]h$]h&]uh1jhhhKhjhhubeh}(h]on-disk-formatah ]h"]on-disk formatah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hStatush]hStatus}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjehhhhhKubh)}(hyV (for Valid) is returned if every check performed so far was valid. If any check failed, C (for Corruption) is returned.h]hyV (for Valid) is returned if every check performed so far was valid. If any check failed, C (for Corruption) is returned.}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjehhubeh}(h]statusah ]h"]statusah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hExampleh]hExample}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hSet up a device::h]hSet up a device:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h# dmsetup create vroot --readonly --table \ "0 2097152 verity 1 /dev/sda1 /dev/sda2 4096 4096 262144 1 sha256 "\ "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\ "1234000000000000000000000000000000000000000000000000000000000000"h]h# dmsetup create vroot --readonly --table \ "0 2097152 verity 1 /dev/sda1 /dev/sda2 4096 4096 262144 1 sha256 "\ "4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076 "\ "1234000000000000000000000000000000000000000000000000000000000000"}hjsbah}(h]h ]h"]h$]h&]hhuh1hhhhKhjhhubh)}(hA command line tool veritysetup is available to compute or verify the hash tree or activate the kernel device. This is available from the cryptsetup upstream repository https://gitlab.com/cryptsetup/cryptsetup/ (as a libcryptsetup extension).h](hA command line tool veritysetup is available to compute or verify the hash tree or activate the kernel device. This is available from the cryptsetup upstream repository }(hjhhhNhNubjB)}(h)https://gitlab.com/cryptsetup/cryptsetup/h]h)https://gitlab.com/cryptsetup/cryptsetup/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jAhjubh (as a libcryptsetup extension).}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hCreate hash on the device::h]hCreate hash on the device:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hx# veritysetup format /dev/sda1 /dev/sda2 ... Root hash: 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076h]hx# veritysetup format /dev/sda1 /dev/sda2 ... Root hash: 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076}hjsbah}(h]h ]h"]h$]h&]hhuh1hhhhMhjhhubh)}(hActivate the device::h]hActivate the device:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hs# veritysetup create vroot /dev/sda1 /dev/sda2 \ 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076h]hs# veritysetup create vroot /dev/sda1 /dev/sda2 \ 4392712ba01368efdf14b05c76f9e4df0d53664630b5d48632ed17a137f39076}hjsbah}(h]h ]h"]h$]h&]hhuh1hhhhMhjhhubeh}(h]exampleah ]h"]exampleah$]h&]uh1hhhhhhhhKubeh}(h] dm-verityah ]h"] dm-verityah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjEerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjj1j.jjjjjbj_jjjju nametypes}(jj1jjjbjjuh}(jhj.hjj4jj}j_jjjejju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.