sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget:/translations/zh_CN/admin-guide/device-mapper/dm-integritymodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/zh_TW/admin-guide/device-mapper/dm-integritymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/it_IT/admin-guide/device-mapper/dm-integritymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/ja_JP/admin-guide/device-mapper/dm-integritymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/ko_KR/admin-guide/device-mapper/dm-integritymodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget:/translations/sp_SP/admin-guide/device-mapper/dm-integritymodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(h dm-integrityh]h dm-integrity}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhT/var/lib/git/docbuild/linux/Documentation/admin-guide/device-mapper/dm-integrity.rsthKubh paragraph)}(hThe dm-integrity target emulates a block device that has additional per-sector tags that can be used for storing integrity information.h]hThe dm-integrity target emulates a block device that has additional per-sector tags that can be used for storing integrity information.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hA general problem with storing integrity tags with every sector is that writing the sector and the integrity tag must be atomic - i.e. in case of crash, either both sector and integrity tag or none of them is written.h]hA general problem with storing integrity tags with every sector is that writing the sector and the integrity tag must be atomic - i.e. in case of crash, either both sector and integrity tag or none of them is written.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hTo guarantee write atomicity, the dm-integrity target uses journal, it writes sector data and integrity tags into a journal, commits the journal and then copies the data and integrity tags to their respective location.h]hTo guarantee write atomicity, the dm-integrity target uses journal, it writes sector data and integrity tags into a journal, commits the journal and then copies the data and integrity tags to their respective location.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXThe dm-integrity target can be used with the dm-crypt target - in this situation the dm-crypt target creates the integrity data and passes them to the dm-integrity target via bio_integrity_payload attached to the bio. In this mode, the dm-crypt and dm-integrity targets provide authenticated disk encryption - if the attacker modifies the encrypted device, an I/O error is returned instead of random data.h]hXThe dm-integrity target can be used with the dm-crypt target - in this situation the dm-crypt target creates the integrity data and passes them to the dm-integrity target via bio_integrity_payload attached to the bio. In this mode, the dm-crypt and dm-integrity targets provide authenticated disk encryption - if the attacker modifies the encrypted device, an I/O error is returned instead of random data.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hThe dm-integrity target can also be used as a standalone target, in this mode it calculates and verifies the integrity tag internally. In this mode, the dm-integrity target can be used to detect silent data corruption on the disk or in the I/O path.h]hThe dm-integrity target can also be used as a standalone target, in this mode it calculates and verifies the integrity tag internally. In this mode, the dm-integrity target can be used to detect silent data corruption on the disk or in the I/O path.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXThere's an alternate mode of operation where dm-integrity uses a bitmap instead of a journal. If a bit in the bitmap is 1, the corresponding region's data and integrity tags are not synchronized - if the machine crashes, the unsynchronized regions will be recalculated. The bitmap mode is faster than the journal mode, because we don't have to write the data twice, but it is also less reliable, because if data corruption happens when the machine crashes, it may not be detected.h]hXThere’s an alternate mode of operation where dm-integrity uses a bitmap instead of a journal. If a bit in the bitmap is 1, the corresponding region’s data and integrity tags are not synchronized - if the machine crashes, the unsynchronized regions will be recalculated. The bitmap mode is faster than the journal mode, because we don’t have to write the data twice, but it is also less reliable, because if data corruption happens when the machine crashes, it may not be detected.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hWhen loading the target for the first time, the kernel driver will format the device. But it will only format the device if the superblock contains zeroes. If the superblock is neither valid nor zeroed, the dm-integrity target can't be loaded.h]hWhen loading the target for the first time, the kernel driver will format the device. But it will only format the device if the superblock contains zeroes. If the superblock is neither valid nor zeroed, the dm-integrity target can’t be loaded.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hhhhubh)}(hX/Accesses to the on-disk metadata area containing checksums (aka tags) are buffered using dm-bufio. When an access to any given metadata area occurs, each unique metadata area gets its own buffer(s). The buffer size is capped at the size of the metadata area, but may be smaller, thereby requiring multiple buffers to represent the full metadata area. A smaller buffer size will produce a smaller resulting read/write operation to the metadata area for small reads/writes. The metadata is still read even in a full write to the data covered by a single buffer.h]hX/Accesses to the on-disk metadata area containing checksums (aka tags) are buffered using dm-bufio. When an access to any given metadata area occurs, each unique metadata area gets its own buffer(s). The buffer size is capped at the size of the metadata area, but may be smaller, thereby requiring multiple buffers to represent the full metadata area. A smaller buffer size will produce a smaller resulting read/write operation to the metadata area for small reads/writes. The metadata is still read even in a full write to the data covered by a single buffer.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK)hhhhubh)}(h%To use the target for the first time:h]h%To use the target for the first time:}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK2hhhhubhenumerated_list)}(hhh](h list_item)}(h$overwrite the superblock with zeroesh]h)}(hj@h]h$overwrite the superblock with zeroes}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hj>ubah}(h]h ]h"]h$]h&]uh1j<hj9hhhhhNubj=)}(h[load the dm-integrity target with one-sector size, the kernel driver will format the deviceh]h)}(h[load the dm-integrity target with one-sector size, the kernel driver will format the deviceh]h[load the dm-integrity target with one-sector size, the kernel driver will format the device}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK5hjUubah}(h]h ]h"]h$]h&]uh1j<hj9hhhhhNubj=)}(hunload the dm-integrity targeth]h)}(hjoh]hunload the dm-integrity target}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK7hjmubah}(h]h ]h"]h$]h&]uh1j<hj9hhhhhNubj=)}(h:read the "provided_data_sectors" value from the superblockh]h)}(hjh]h>read the “provided_data_sectors” value from the superblock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hjubah}(h]h ]h"]h$]h&]uh1j<hj9hhhhhNubj=)}(hIload the dm-integrity target with the target size "provided_data_sectors"h]h)}(hIload the dm-integrity target with the target size "provided_data_sectors"h]hMload the dm-integrity target with the target size “provided_data_sectors”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK9hjubah}(h]h ]h"]h$]h&]uh1j<hj9hhhhhNubj=)}(hoif you want to use dm-integrity with dm-crypt, load the dm-crypt target with the size "provided_data_sectors" h]h)}(hmif you want to use dm-integrity with dm-crypt, load the dm-crypt target with the size "provided_data_sectors"h]hqif you want to use dm-integrity with dm-crypt, load the dm-crypt target with the size “provided_data_sectors”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK;hjubah}(h]h ]h"]h$]h&]uh1j<hj9hhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1j7hhhhhhhK4ubh)}(hTarget arguments:h]hTarget arguments:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK?hhhhubj8)}(hhh](j=)}(hthe underlying block device h]h)}(hthe underlying block deviceh]hthe underlying block device}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjubah}(h]h ]h"]h$]h&]uh1j<hjhhhhhNubj=)}(hrthe number of reserved sector at the beginning of the device - the dm-integrity won't read of write these sectors h]h)}(hqthe number of reserved sector at the beginning of the device - the dm-integrity won't read of write these sectorsh]hsthe number of reserved sector at the beginning of the device - the dm-integrity won’t read of write these sectors}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKChjubah}(h]h ]h"]h$]h&]uh1j<hjhhhhhNubj=)}(hcthe size of the integrity tag (if "-" is used, the size is taken from the internal-hash algorithm) h]h)}(hbthe size of the integrity tag (if "-" is used, the size is taken from the internal-hash algorithm)h]hfthe size of the integrity tag (if “-” is used, the size is taken from the internal-hash algorithm)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKFhjubah}(h]h ]h"]h$]h&]uh1j<hjhhhhhNubj=)}(hXmode: D - direct writes (without journal) in this mode, journaling is not used and data sectors and integrity tags are written separately. In case of crash, it is possible that the data and integrity tag doesn't match. J - journaled writes data and integrity tags are written to the journal and atomicity is guaranteed. In case of crash, either both data and tag or none of them are written. The journaled mode degrades write throughput twice because the data have to be written twice. B - bitmap mode - data and metadata are written without any synchronization, the driver maintains a bitmap of dirty regions where data and metadata don't match. This mode can only be used with internal hash. R - recovery mode - in this mode, journal is not replayed, checksums are not checked and writes to the device are not allowed. This mode is useful for data recovery if the device cannot be activated in any of the other standard modes. I - inline mode - in this mode, dm-integrity will store integrity data directly in the underlying device sectors. The underlying device must have an integrity profile that allows storing user integrity data and provides enough space for the selected integrity tag. h](h)}(hmode:h]hmode:}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhj/ubh block_quote)}(hXDD - direct writes (without journal) in this mode, journaling is not used and data sectors and integrity tags are written separately. In case of crash, it is possible that the data and integrity tag doesn't match. J - journaled writes data and integrity tags are written to the journal and atomicity is guaranteed. In case of crash, either both data and tag or none of them are written. The journaled mode degrades write throughput twice because the data have to be written twice. B - bitmap mode - data and metadata are written without any synchronization, the driver maintains a bitmap of dirty regions where data and metadata don't match. This mode can only be used with internal hash. R - recovery mode - in this mode, journal is not replayed, checksums are not checked and writes to the device are not allowed. This mode is useful for data recovery if the device cannot be activated in any of the other standard modes. I - inline mode - in this mode, dm-integrity will store integrity data directly in the underlying device sectors. The underlying device must have an integrity profile that allows storing user integrity data and provides enough space for the selected integrity tag. h]hdefinition_list)}(hhh](hdefinition_list_item)}(hD - direct writes (without journal) in this mode, journaling is not used and data sectors and integrity tags are written separately. In case of crash, it is possible that the data and integrity tag doesn't match.h](hterm)}(h#D - direct writes (without journal)h]h#D - direct writes (without journal)}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKNhjNubh definition)}(hhh]h)}(hin this mode, journaling is not used and data sectors and integrity tags are written separately. In case of crash, it is possible that the data and integrity tag doesn't match.h]hin this mode, journaling is not used and data sectors and integrity tags are written separately. In case of crash, it is possible that the data and integrity tag doesn’t match.}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhjdubah}(h]h ]h"]h$]h&]uh1jbhjNubeh}(h]h ]h"]h$]h&]uh1jLhhhKNhjIubjM)}(hX J - journaled writes data and integrity tags are written to the journal and atomicity is guaranteed. In case of crash, either both data and tag or none of them are written. The journaled mode degrades write throughput twice because the data have to be written twice.h](jS)}(hJ - journaled writesh]hJ - journaled writes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKThjubjc)}(hhh]h)}(hdata and integrity tags are written to the journal and atomicity is guaranteed. In case of crash, either both data and tag or none of them are written. The journaled mode degrades write throughput twice because the data have to be written twice.h]hdata and integrity tags are written to the journal and atomicity is guaranteed. In case of crash, either both data and tag or none of them are written. The journaled mode degrades write throughput twice because the data have to be written twice.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKQhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKThjIubjM)}(hB - bitmap mode - data and metadata are written without any synchronization, the driver maintains a bitmap of dirty regions where data and metadata don't match. This mode can only be used with internal hash.h](jS)}(h;B - bitmap mode - data and metadata are written without anyh]h;B - bitmap mode - data and metadata are written without any}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKXhjubjc)}(hhh]h)}(hsynchronization, the driver maintains a bitmap of dirty regions where data and metadata don't match. This mode can only be used with internal hash.h]hsynchronization, the driver maintains a bitmap of dirty regions where data and metadata don’t match. This mode can only be used with internal hash.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKXhjIubjM)}(hR - recovery mode - in this mode, journal is not replayed, checksums are not checked and writes to the device are not allowed. This mode is useful for data recovery if the device cannot be activated in any of the other standard modes.h](jS)}(h:R - recovery mode - in this mode, journal is not replayed,h]h:R - recovery mode - in this mode, journal is not replayed,}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhK]hjubjc)}(hhh]h)}(hchecksums are not checked and writes to the device are not allowed. This mode is useful for data recovery if the device cannot be activated in any of the other standard modes.h]hchecksums are not checked and writes to the device are not allowed. This mode is useful for data recovery if the device cannot be activated in any of the other standard modes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhK]hjIubjM)}(hX I - inline mode - in this mode, dm-integrity will store integrity data directly in the underlying device sectors. The underlying device must have an integrity profile that allows storing user integrity data and provides enough space for the selected integrity tag. h](jS)}(hAI - inline mode - in this mode, dm-integrity will store integrityh]hAI - inline mode - in this mode, dm-integrity will store integrity}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKchjubjc)}(hhh]h)}(hdata directly in the underlying device sectors. The underlying device must have an integrity profile that allows storing user integrity data and provides enough space for the selected integrity tag.h]hdata directly in the underlying device sectors. The underlying device must have an integrity profile that allows storing user integrity data and provides enough space for the selected integrity tag.}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK`hj ubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKchjIubeh}(h]h ]h"]h$]h&]uh1jGhjCubah}(h]h ]h"]h$]h&]uh1jAhhhKKhj/ubeh}(h]h ]h"]h$]h&]uh1j<hjhhhhhNubj=)}(h#the number of additional arguments h]h)}(h"the number of additional argumentsh]h"the number of additional arguments}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKehjOubah}(h]h ]h"]h$]h&]uh1j<hjhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1j7hhhhhhhKAubh)}(hAdditional arguments:h]hAdditional arguments:}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKghhhhubjH)}(hhh](jM)}(hjournal_sectors:number The size of journal, this argument is used only if formatting the device. If the device is already formatted, the value from the superblock is used. h](jS)}(hjournal_sectors:numberh]hjournal_sectors:number}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKlhj~ubjc)}(hhh]h)}(hThe size of journal, this argument is used only if formatting the device. If the device is already formatted, the value from the superblock is used.h]hThe size of journal, this argument is used only if formatting the device. If the device is already formatted, the value from the superblock is used.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKjhjubah}(h]h ]h"]h$]h&]uh1jbhj~ubeh}(h]h ]h"]h$]h&]uh1jLhhhKlhj{ubjM)}(hinterleave_sectors:number (default 32768) The number of interleaved sectors. This values is rounded down to a power of two. If the device is already formatted, the value from the superblock is used. h](jS)}(h)interleave_sectors:number (default 32768)h]h)interleave_sectors:number (default 32768)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKqhjubjc)}(hhh]h)}(hThe number of interleaved sectors. This values is rounded down to a power of two. If the device is already formatted, the value from the superblock is used.h]hThe number of interleaved sectors. This values is rounded down to a power of two. If the device is already formatted, the value from the superblock is used.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKqhj{hhubjM)}(hmmeta_device:device Don't interleave the data and metadata on the device. Use a separate device for metadata. h](jS)}(hmeta_device:deviceh]hmeta_device:device}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKuhjubjc)}(hhh]h)}(hYDon't interleave the data and metadata on the device. Use a separate device for metadata.h]h[Don’t interleave the data and metadata on the device. Use a separate device for metadata.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKthjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKuhj{hhubjM)}(hbuffer_sectors:number (default 128) The number of sectors in one metadata buffer. The value is rounded down to a power of two. h](jS)}(h#buffer_sectors:number (default 128)h]h#buffer_sectors:number (default 128)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKyhj ubjc)}(hhh]h)}(hZThe number of sectors in one metadata buffer. The value is rounded down to a power of two.h]hZThe number of sectors in one metadata buffer. The value is rounded down to a power of two.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKxhjubah}(h]h ]h"]h$]h&]uh1jbhj ubeh}(h]h ]h"]h$]h&]uh1jLhhhKyhj{hhubjM)}(hjournal_watermark:number (default 50) The journal watermark in percents. When the size of the journal exceeds this watermark, the thread that flushes the journal will be started. h](jS)}(h%journal_watermark:number (default 50)h]h%journal_watermark:number (default 50)}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhK~hj:ubjc)}(hhh]h)}(hThe journal watermark in percents. When the size of the journal exceeds this watermark, the thread that flushes the journal will be started.h]hThe journal watermark in percents. When the size of the journal exceeds this watermark, the thread that flushes the journal will be started.}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK|hjLubah}(h]h ]h"]h$]h&]uh1jbhj:ubeh}(h]h ]h"]h$]h&]uh1jLhhhK~hj{hhubjM)}(hcommit_time:number (default 10000) Commit time in milliseconds. When this time passes, the journal is written. The journal is also written immediately if the FLUSH request is received. h](jS)}(h"commit_time:number (default 10000)h]h"commit_time:number (default 10000)}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjiubjc)}(hhh]h)}(hCommit time in milliseconds. When this time passes, the journal is written. The journal is also written immediately if the FLUSH request is received.h]hCommit time in milliseconds. When this time passes, the journal is written. The journal is also written immediately if the FLUSH request is received.}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj{ubah}(h]h ]h"]h$]h&]uh1jbhjiubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hXinternal_hash:algorithm(:key) (the key is optional) Use internal hash or crc. When this argument is used, the dm-integrity target won't accept integrity tags from the upper target, but it will automatically generate and verify the integrity tags. You can use a crc algorithm (such as crc32), then integrity target will protect the data against accidental corruption. You can also use a hmac algorithm (for example "hmac(sha256):0123456789abcdef"), in this mode it will provide cryptographic authentication of the data without encryption. When this argument is not used, the integrity tags are accepted from an upper layer target, such as dm-crypt. The upper layer target should check the validity of the integrity tags. h](jS)}(h5internal_hash:algorithm(:key) (the key is optional)h]h5internal_hash:algorithm(:key) (the key is optional)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh](h)}(hUse internal hash or crc. When this argument is used, the dm-integrity target won't accept integrity tags from the upper target, but it will automatically generate and verify the integrity tags.h]hUse internal hash or crc. When this argument is used, the dm-integrity target won’t accept integrity tags from the upper target, but it will automatically generate and verify the integrity tags.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hX"You can use a crc algorithm (such as crc32), then integrity target will protect the data against accidental corruption. You can also use a hmac algorithm (for example "hmac(sha256):0123456789abcdef"), in this mode it will provide cryptographic authentication of the data without encryption.h]hX&You can use a crc algorithm (such as crc32), then integrity target will protect the data against accidental corruption. You can also use a hmac algorithm (for example “hmac(sha256):0123456789abcdef”), in this mode it will provide cryptographic authentication of the data without encryption.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hWhen this argument is not used, the integrity tags are accepted from an upper layer target, such as dm-crypt. The upper layer target should check the validity of the integrity tags.h]hWhen this argument is not used, the integrity tags are accepted from an upper layer target, such as dm-crypt. The upper layer target should check the validity of the integrity tags.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(herecalculate Recalculate the integrity tags automatically. It is only valid when using internal hash. h](jS)}(h recalculateh]h recalculate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh]h)}(hXRecalculate the integrity tags automatically. It is only valid when using internal hash.h]hXRecalculate the integrity tags automatically. It is only valid when using internal hash.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hX3journal_crypt:algorithm(:key) (the key is optional) Encrypt the journal using given algorithm to make sure that the attacker can't read the journal. You can use a block cipher here (such as "cbc(aes)") or a stream cipher (for example "chacha20" or "ctr(aes)"). The journal contains history of last writes to the block device, an attacker reading the journal could see the last sector numbers that were written. From the sector numbers, the attacker can infer the size of files that were written. To protect against this situation, you can encrypt the journal. h](jS)}(h5journal_crypt:algorithm(:key) (the key is optional)h]h5journal_crypt:algorithm(:key) (the key is optional)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh](h)}(hEncrypt the journal using given algorithm to make sure that the attacker can't read the journal. You can use a block cipher here (such as "cbc(aes)") or a stream cipher (for example "chacha20" or "ctr(aes)").h]hEncrypt the journal using given algorithm to make sure that the attacker can’t read the journal. You can use a block cipher here (such as “cbc(aes)”) or a stream cipher (for example “chacha20” or “ctr(aes)”).}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$ubh)}(hX*The journal contains history of last writes to the block device, an attacker reading the journal could see the last sector numbers that were written. From the sector numbers, the attacker can infer the size of files that were written. To protect against this situation, you can encrypt the journal.h]hX*The journal contains history of last writes to the block device, an attacker reading the journal could see the last sector numbers that were written. From the sector numbers, the attacker can infer the size of files that were written. To protect against this situation, you can encrypt the journal.}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj$ubeh}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hXjournal_mac:algorithm(:key) (the key is optional) Protect sector numbers in the journal from accidental or malicious modification. To protect against accidental modification, use a crc algorithm, to protect against malicious modification, use a hmac algorithm with a key. This option is not needed when using internal-hash because in this mode, the integrity of journal entries is checked when replaying the journal. Thus, modified sector number would be detected at this stage. h](jS)}(h5journal_mac:algorithm(:key) (the key is optional)h]h5journal_mac:algorithm(:key) (the key is optional)}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjOubjc)}(hhh](h)}(hProtect sector numbers in the journal from accidental or malicious modification. To protect against accidental modification, use a crc algorithm, to protect against malicious modification, use a hmac algorithm with a key.h]hProtect sector numbers in the journal from accidental or malicious modification. To protect against accidental modification, use a crc algorithm, to protect against malicious modification, use a hmac algorithm with a key.}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjaubh)}(hThis option is not needed when using internal-hash because in this mode, the integrity of journal entries is checked when replaying the journal. Thus, modified sector number would be detected at this stage.h]hThis option is not needed when using internal-hash because in this mode, the integrity of journal entries is checked when replaying the journal. Thus, modified sector number would be detected at this stage.}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjaubeh}(h]h ]h"]h$]h&]uh1jbhjOubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hblock_size:number (default 512) The size of a data block in bytes. The larger the block size the less overhead there is for per-block integrity metadata. Supported values are 512, 1024, 2048 and 4096 bytes. h](jS)}(hblock_size:number (default 512)h]hblock_size:number (default 512)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh]h)}(hThe size of a data block in bytes. The larger the block size the less overhead there is for per-block integrity metadata. Supported values are 512, 1024, 2048 and 4096 bytes.h]hThe size of a data block in bytes. The larger the block size the less overhead there is for per-block integrity metadata. Supported values are 512, 1024, 2048 and 4096 bytes.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hsectors_per_bit:number In the bitmap mode, this parameter specifies the number of 512-byte sectors that corresponds to one bitmap bit. h](jS)}(hsectors_per_bit:numberh]hsectors_per_bit:number}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh]h)}(hoIn the bitmap mode, this parameter specifies the number of 512-byte sectors that corresponds to one bitmap bit.h]hoIn the bitmap mode, this parameter specifies the number of 512-byte sectors that corresponds to one bitmap bit.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hbitmap_flush_interval:number The bitmap flush interval in milliseconds. The metadata buffers are synchronized when this interval expires. h](jS)}(hbitmap_flush_interval:numberh]hbitmap_flush_interval:number}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh]h)}(hlThe bitmap flush interval in milliseconds. The metadata buffers are synchronized when this interval expires.h]hlThe bitmap flush interval in milliseconds. The metadata buffers are synchronized when this interval expires.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hallow_discards Allow block discard requests (a.k.a. TRIM) for the integrity device. Discards are only allowed to devices using internal hash. h](jS)}(hallow_discardsh]hallow_discards}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh]h)}(h~Allow block discard requests (a.k.a. TRIM) for the integrity device. Discards are only allowed to devices using internal hash.h]h~Allow block discard requests (a.k.a. TRIM) for the integrity device. Discards are only allowed to devices using internal hash.}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj+ubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hfix_padding Use a smaller padding of the tag area that is more space-efficient. If this option is not present, large padding is used - that is for compatibility with older kernels. h](jS)}(h fix_paddingh]h fix_padding}(hjLhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjHubjc)}(hhh]h)}(hUse a smaller padding of the tag area that is more space-efficient. If this option is not present, large padding is used - that is for compatibility with older kernels.h]hUse a smaller padding of the tag area that is more space-efficient. If this option is not present, large padding is used - that is for compatibility with older kernels.}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjZubah}(h]h ]h"]h$]h&]uh1jbhjHubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hXfix_hmac Improve security of internal_hash and journal_mac: - the section number is mixed to the mac, so that an attacker can't copy sectors from one journal section to another journal section - the superblock is protected by journal_mac - a 16-byte salt stored in the superblock is mixed to the mac, so that the attacker can't detect that two disks have the same hmac key and also to disallow the attacker to move sectors from one disk to another h](jS)}(hfix_hmach]hfix_hmac}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjwubjc)}(hhh](h)}(h2Improve security of internal_hash and journal_mac:h]h2Improve security of internal_hash and journal_mac:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh bullet_list)}(hhh](j=)}(hthe section number is mixed to the mac, so that an attacker can't copy sectors from one journal section to another journal sectionh]h)}(hthe section number is mixed to the mac, so that an attacker can't copy sectors from one journal section to another journal sectionh]hthe section number is mixed to the mac, so that an attacker can’t copy sectors from one journal section to another journal section}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(h*the superblock is protected by journal_mach]h)}(hjh]h*the superblock is protected by journal_mac}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(ha 16-byte salt stored in the superblock is mixed to the mac, so that the attacker can't detect that two disks have the same hmac key and also to disallow the attacker to move sectors from one disk to another h]h)}(ha 16-byte salt stored in the superblock is mixed to the mac, so that the attacker can't detect that two disks have the same hmac key and also to disallow the attacker to move sectors from one disk to anotherh]ha 16-byte salt stored in the superblock is mixed to the mac, so that the attacker can’t detect that two disks have the same hmac key and also to disallow the attacker to move sectors from one disk to another}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j<hjubeh}(h]h ]h"]h$]h&]bullet-uh1jhhhKhjubeh}(h]h ]h"]h$]h&]uh1jbhjwubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubjM)}(hlegacy_recalculate Allow recalculating of volumes with HMAC keys. This is disabled by default for security reasons - an attacker could modify the volume, set recalc_sector to zero, and the kernel would not detect the modification. h](jS)}(hlegacy_recalculateh]hlegacy_recalculate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh]h)}(hAllow recalculating of volumes with HMAC keys. This is disabled by default for security reasons - an attacker could modify the volume, set recalc_sector to zero, and the kernel would not detect the modification.h]hAllow recalculating of volumes with HMAC keys. This is disabled by default for security reasons - an attacker could modify the volume, set recalc_sector to zero, and the kernel would not detect the modification.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhj{hhubeh}(h]h ]h"]h$]h&]uh1jGhhhhhhhNubh)}(hXlThe journal mode (D/J), buffer_sectors, journal_watermark, commit_time and allow_discards can be changed when reloading the target (load an inactive table and swap the tables with suspend and resume). The other arguments should not be changed when reloading the target because the layout of disk data depend on them and the reloaded target would be non-functional.h]hXlThe journal mode (D/J), buffer_sectors, journal_watermark, commit_time and allow_discards can be changed when reloading the target (load an inactive table and swap the tables with suspend and resume). The other arguments should not be changed when reloading the target because the layout of disk data depend on them and the reloaded target would be non-functional.}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXFor example, on a device using the default interleave_sectors of 32768, a block_size of 512, and an internal_hash of crc32c with a tag size of 4 bytes, it will take 128 KiB of tags to track a full data area, requiring 256 sectors of metadata per data area. With the default buffer_sectors of 128, that means there will be 2 buffers per metadata area, or 2 buffers per 16 MiB of data.h]hXFor example, on a device using the default interleave_sectors of 32768, a block_size of 512, and an internal_hash of crc32c with a tag size of 4 bytes, it will take 128 KiB of tags to track a full data area, requiring 256 sectors of metadata per data area. With the default buffer_sectors of 128, that means there will be 2 buffers per metadata area, or 2 buffers per 16 MiB of data.}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h Status line:h]h Status line:}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubj8)}(hhh](j=)}(h"the number of integrity mismatchesh]h)}(hj^h]h"the number of integrity mismatches}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj\ubah}(h]h ]h"]h$]h&]uh1j<hjYhhhhhNubj=)}(hMprovided data sectors - that is the number of sectors that the user could useh]h)}(hMprovided data sectors - that is the number of sectors that the user could useh]hMprovided data sectors - that is the number of sectors that the user could use}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjsubah}(h]h ]h"]h$]h&]uh1j<hjYhhhhhNubj=)}(hFthe current recalculating position (or '-' if we didn't recalculate) h]h)}(hDthe current recalculating position (or '-' if we didn't recalculate)h]hJthe current recalculating position (or ‘-’ if we didn’t recalculate)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j<hjYhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1j7hhhhhhhKubh)}(h)The layout of the formatted block device:h]h)The layout of the formatted block device:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubj)}(hhh](j=)}(hreserved sectors (they are not used by this target, they can be used for storing LUKS metadata or for other purpose), the size of the reserved area is specified in the target arguments h]jH)}(hhh]jM)}(hreserved sectors (they are not used by this target, they can be used for storing LUKS metadata or for other purpose), the size of the reserved area is specified in the target arguments h](jS)}(hreserved sectorsh]hreserved sectors}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh]h)}(h(they are not used by this target, they can be used for storing LUKS metadata or for other purpose), the size of the reserved area is specified in the target argumentsh]h(they are not used by this target, they can be used for storing LUKS metadata or for other purpose), the size of the reserved area is specified in the target arguments}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhjubah}(h]h ]h"]h$]h&]uh1jGhjubah}(h]h ]h"]h$]h&]uh1j<hjhhhNhNubj=)}(hXQsuperblock (4kiB) * magic string - identifies that the device was formatted * version * log2(interleave sectors) * integrity tag size * the number of journal sections * provided data sectors - the number of sectors that this target provides (i.e. the size of the device minus the size of all metadata and padding). The user of this target should not send bios that access data beyond the "provided data sectors" limit. * flags SB_FLAG_HAVE_JOURNAL_MAC - a flag is set if journal_mac is used SB_FLAG_RECALCULATING - recalculating is in progress SB_FLAG_DIRTY_BITMAP - journal area contains the bitmap of dirty blocks * log2(sectors per block) * a position where recalculating finishedh]jH)}(hhh]jM)}(hXsuperblock (4kiB) * magic string - identifies that the device was formatted * version * log2(interleave sectors) * integrity tag size * the number of journal sections * provided data sectors - the number of sectors that this target provides (i.e. the size of the device minus the size of all metadata and padding). The user of this target should not send bios that access data beyond the "provided data sectors" limit. * flags SB_FLAG_HAVE_JOURNAL_MAC - a flag is set if journal_mac is used SB_FLAG_RECALCULATING - recalculating is in progress SB_FLAG_DIRTY_BITMAP - journal area contains the bitmap of dirty blocks * log2(sectors per block) * a position where recalculating finishedh](jS)}(hsuperblock (4kiB)h]hsuperblock (4kiB)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhMhjubjc)}(hhh]j)}(hhh](j=)}(h7magic string - identifies that the device was formattedh]h)}(hjh]h7magic string - identifies that the device was formatted}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(hversionh]h)}(hj4h]hversion}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj2ubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(hlog2(interleave sectors)h]h)}(hjKh]hlog2(interleave sectors)}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjIubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(hintegrity tag sizeh]h)}(hjbh]hintegrity tag size}(hjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj`ubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(hthe number of journal sectionsh]h)}(hjyh]hthe number of journal sections}(hj{hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(hprovided data sectors - the number of sectors that this target provides (i.e. the size of the device minus the size of all metadata and padding). The user of this target should not send bios that access data beyond the "provided data sectors" limit.h]h)}(hprovided data sectors - the number of sectors that this target provides (i.e. the size of the device minus the size of all metadata and padding). The user of this target should not send bios that access data beyond the "provided data sectors" limit.h]hprovided data sectors - the number of sectors that this target provides (i.e. the size of the device minus the size of all metadata and padding). The user of this target should not send bios that access data beyond the “provided data sectors” limit.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(hflags SB_FLAG_HAVE_JOURNAL_MAC - a flag is set if journal_mac is used SB_FLAG_RECALCULATING - recalculating is in progress SB_FLAG_DIRTY_BITMAP - journal area contains the bitmap of dirty blocksh]jH)}(hhh]jM)}(hflags SB_FLAG_HAVE_JOURNAL_MAC - a flag is set if journal_mac is used SB_FLAG_RECALCULATING - recalculating is in progress SB_FLAG_DIRTY_BITMAP - journal area contains the bitmap of dirty blocksh](jS)}(hflagsh]hflags}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhMhjubjc)}(hhh]jH)}(hhh](jM)}(h?SB_FLAG_HAVE_JOURNAL_MAC - a flag is set if journal_mac is usedh](jS)}(hSB_FLAG_HAVE_JOURNAL_MACh]hSB_FLAG_HAVE_JOURNAL_MAC}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhKhjubjc)}(hhh]j)}(hhh]j=)}(h$a flag is set if journal_mac is usedh]h)}(hjh]h$a flag is set if journal_mac is used}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1j<hjubah}(h]h ]h"]h$]h&]jjuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhKhjubjM)}(h4SB_FLAG_RECALCULATING - recalculating is in progressh](jS)}(hSB_FLAG_RECALCULATINGh]hSB_FLAG_RECALCULATING}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhMhj ubjc)}(hhh]j)}(hhh]j=)}(hrecalculating is in progressh]h)}(hj h]hrecalculating is in progress}(hj" hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j<hj ubah}(h]h ]h"]h$]h&]jjuh1jhhhMhj ubah}(h]h ]h"]h$]h&]uh1jbhj ubeh}(h]h ]h"]h$]h&]uh1jLhhhMhjubjM)}(hISB_FLAG_DIRTY_BITMAP - journal area contains the bitmap of dirty blocksh](jS)}(hSB_FLAG_DIRTY_BITMAPh]hSB_FLAG_DIRTY_BITMAP}(hjK hhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhMhjG ubjc)}(hhh]j)}(hhh]j=)}(h0journal area contains the bitmap of dirty blocksh]h)}(h0journal area contains the bitmap of dirty blocksh]h0journal area contains the bitmap of dirty blocks}(hjc hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj_ ubah}(h]h ]h"]h$]h&]uh1j<hj\ ubah}(h]h ]h"]h$]h&]jjuh1jhhhMhjY ubah}(h]h ]h"]h$]h&]uh1jbhjG ubeh}(h]h ]h"]h$]h&]uh1jLhhhMhjubeh}(h]h ]h"]h$]h&]uh1jGhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhMhjubah}(h]h ]h"]h$]h&]uh1jGhjubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(hlog2(sectors per block)h]h)}(hj h]hlog2(sectors per block)}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j<hjubj=)}(h'a position where recalculating finishedh]h)}(hj h]h'a position where recalculating finished}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j<hjubeh}(h]h ]h"]h$]h&]j*uh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1jbhjubeh}(h]h ]h"]h$]h&]uh1jLhhhMhjubah}(h]h ]h"]h$]h&]uh1jGhjubah}(h]h ]h"]h$]h&]uh1j<hjhhhNhNubj=)}(hXjournal The journal is divided into sections, each section contains: * metadata area (4kiB), it contains journal entries - every journal entry contains: * logical sector (specifies where the data and tag should be written) * last 8 bytes of data * integrity tag (the size is specified in the superblock) - every metadata sector ends with * mac (8-bytes), all the macs in 8 metadata sectors form a 64-byte value. It is used to store hmac of sector numbers in the journal section, to protect against a possibility that the attacker tampers with sector numbers in the journal. * commit id * data area (the size is variable; it depends on how many journal entries fit into the metadata area) - every sector in the data area contains: * data (504 bytes of data, the last 8 bytes are stored in the journal entry) * commit id To test if the whole journal section was written correctly, every 512-byte sector of the journal ends with 8-byte commit id. If the commit id matches on all sectors in a journal section, then it is assumed that the section was written correctly. If the commit id doesn't match, the section was written partially and it should not be replayed. h]jH)}(hhh]jM)}(hXjournal The journal is divided into sections, each section contains: * metadata area (4kiB), it contains journal entries - every journal entry contains: * logical sector (specifies where the data and tag should be written) * last 8 bytes of data * integrity tag (the size is specified in the superblock) - every metadata sector ends with * mac (8-bytes), all the macs in 8 metadata sectors form a 64-byte value. It is used to store hmac of sector numbers in the journal section, to protect against a possibility that the attacker tampers with sector numbers in the journal. * commit id * data area (the size is variable; it depends on how many journal entries fit into the metadata area) - every sector in the data area contains: * data (504 bytes of data, the last 8 bytes are stored in the journal entry) * commit id To test if the whole journal section was written correctly, every 512-byte sector of the journal ends with 8-byte commit id. If the commit id matches on all sectors in a journal section, then it is assumed that the section was written correctly. If the commit id doesn't match, the section was written partially and it should not be replayed. h](jS)}(hjournalh]hjournal}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhM*hj ubjc)}(hhh](h)}(h ubj=)}(h commit id h]h)}(h commit idh]h commit id}(hj] hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM#hjY ubah}(h]h ]h"]h$]h&]uh1j<hj> ubeh}(h]h ]h"]h$]h&]jj uh1jhhhM!hj: ubah}(h]h ]h"]h$]h&]uh1jAhhhM!hj( ubeh}(h]h ]h"]h$]h&]uh1j<hj% ubah}(h]h ]h"]h$]h&]jjuh1jhhhMhj! ubah}(h]h ]h"]h$]h&]uh1jAhhhMhj ubeh}(h]h ]h"]h$]h&]uh1j<hj ubeh}(h]h ]h"]h$]h&]jj uh1jhhhM hj ubh)}(hXVTo test if the whole journal section was written correctly, every 512-byte sector of the journal ends with 8-byte commit id. If the commit id matches on all sectors in a journal section, then it is assumed that the section was written correctly. If the commit id doesn't match, the section was written partially and it should not be replayed.h]hXXTo test if the whole journal section was written correctly, every 512-byte sector of the journal ends with 8-byte commit id. If the commit id matches on all sectors in a journal section, then it is assumed that the section was written correctly. If the commit id doesn’t match, the section was written partially and it should not be replayed.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM%hj ubeh}(h]h ]h"]h$]h&]uh1jbhj ubeh}(h]h ]h"]h$]h&]uh1jLhhhM*hj ubah}(h]h ]h"]h$]h&]uh1jGhj ubah}(h]h ]h"]h$]h&]uh1j<hjhhhNhNubj=)}(hXone or more runs of interleaved tags and data. Each run contains: * tag area - it contains integrity tags. There is one tag for each sector in the data area. The size of this area is always 4KiB or greater. * data area - it contains data sectors. The number of data sectors in one run must be a power of two. log2 of this value is stored in the superblock.h]jH)}(hhh]jM)}(hXone or more runs of interleaved tags and data. Each run contains: * tag area - it contains integrity tags. There is one tag for each sector in the data area. The size of this area is always 4KiB or greater. * data area - it contains data sectors. The number of data sectors in one run must be a power of two. log2 of this value is stored in the superblock.h](jS)}(h.one or more runs of interleaved tags and data.h]h.one or more runs of interleaved tags and data.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jRhhhM3hj ubjc)}(hhh](h)}(hEach run contains:h]hEach run contains:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM-hj ubjB)}(hX** tag area - it contains integrity tags. There is one tag for each sector in the data area. The size of this area is always 4KiB or greater. * data area - it contains data sectors. The number of data sectors in one run must be a power of two. log2 of this value is stored in the superblock.h]j)}(hhh](j=)}(htag area - it contains integrity tags. There is one tag for each sector in the data area. The size of this area is always 4KiB or greater.h]h)}(htag area - it contains integrity tags. There is one tag for each sector in the data area. The size of this area is always 4KiB or greater.h]htag area - it contains integrity tags. There is one tag for each sector in the data area. The size of this area is always 4KiB or greater.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM/hj ubah}(h]h ]h"]h$]h&]uh1j<hj ubj=)}(hdata area - it contains data sectors. The number of data sectors in one run must be a power of two. log2 of this value is stored in the superblock.h]h)}(hdata area - it contains data sectors. The number of data sectors in one run must be a power of two. log2 of this value is stored in the superblock.h]hdata area - it contains data sectors. The number of data sectors in one run must be a power of two. log2 of this value is stored in the superblock. }(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM2hj ubah}(h]h ]h"]h$]h&]uh1j<hj ubeh}(h]h ]h"]h$]h&]jj uh1jhhhM/hj ubah}(h]h ]h"]h$]h&]uh1jAhhhM/hj ubeh}(h]h ]h"]h$]h&]uh1jbhj ubeh}(h]h ]h"]h$]h&]uh1jLhhhM3hj ubah}(h]h ]h"]h$]h&]uh1jGhj ubah}(h]h ]h"]h$]h&]uh1j<hjhhhNhNubeh}(h]h ]h"]h$]h&]jj uh1jhhhKhhhhubeh}(h] dm-integrityah ]h"] dm-integrityah$]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_handlerjw error_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}jQ jN s nametypes}jQ sh}jN hs 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.