From 843f38d382b1ca2f6f4ae2ef7c35933e6319ffbb Mon Sep 17 00:00:00 2001 From: Patrik Torstensson Date: Thu, 22 Mar 2018 18:18:04 -0700 Subject: dm verity: add 'check_at_most_once' option to only validate hashes once This allows platforms that are CPU/memory contrained to verify data blocks only the first time they are read from the data device, rather than every time. As such, 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. This option introduces a bitset that is used to check if a block has been validated before or not. A block can be validated more than once as there is no thread protection for the bitset. These changes were developed and tested on entry-level Android Go devices. Signed-off-by: Patrik Torstensson Signed-off-by: Mike Snitzer --- drivers/md/dm-verity.h | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/md/dm-verity.h') diff --git a/drivers/md/dm-verity.h b/drivers/md/dm-verity.h index 69f9a298f8c9..3441c10b840c 100644 --- a/drivers/md/dm-verity.h +++ b/drivers/md/dm-verity.h @@ -63,6 +63,7 @@ struct dm_verity { sector_t hash_level_block[DM_VERITY_MAX_LEVELS]; struct dm_verity_fec *fec; /* forward error correction */ + unsigned long *validated_blocks; /* bitset blocks validated */ }; struct dm_verity_io { -- cgit v1.2.3