OSDN Git Service

BACKPORT: dm verity: add 'check_at_most_once' option to only validate hashes once
authorPatrik Torstensson <totte@google.com>
Fri, 23 Mar 2018 01:18:04 +0000 (18:18 -0700)
committerGreg Kroah-Hartman <gregkh@google.com>
Mon, 23 Apr 2018 14:30:08 +0000 (14:30 +0000)
commited3b23f4d993c8b4bf79a718e6c5da788a12208e
treefbb4c460e925532c68aa7034bf7fe2365614abdf
parenta9c753efb3b7339d4b333bb99bcea76060336aaf
BACKPORT: 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.

(change to use vzalloc/vfree)
(change per_bio_data_size variable)

Bug: 72664474
Change-Id: I2db2db26c7897c78407789de2cc4cff3587c84bb
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
(cherry picked from commit 843f38d382b1ca2f6f4ae2ef7c35933e6319ffbb)
Signed-off-by: Patrik Torstensson <totte@google.com>
Documentation/device-mapper/verity.txt
drivers/md/dm-verity-target.c
drivers/md/dm-verity.h