]> git.baikalelectronics.ru Git - kernel.git/commit
dm integrity: conditionally disable "recalculate" feature
authorMikulas Patocka <mpatocka@redhat.com>
Wed, 20 Jan 2021 18:59:11 +0000 (13:59 -0500)
committerMike Snitzer <snitzer@redhat.com>
Thu, 21 Jan 2021 20:05:21 +0000 (15:05 -0500)
commit7f15aed21172fbcddbbaad3a44d17bfc70a81399
treeeb0725e9c82b535733156d6aa9edc53cde1fed89
parentd02792e4e3fdf65dd4b8a28460ce104c8b2ab951
dm integrity: conditionally disable "recalculate" feature

Otherwise a malicious user could (ab)use the "recalculate" feature
that makes dm-integrity calculate the checksums in the background
while the device is already usable. When the system restarts before all
checksums have been calculated, the calculation continues where it was
interrupted even if the recalculate feature is not requested the next
time the dm device is set up.

Disable recalculating if we use internal_hash or journal_hash with a
key (e.g. HMAC) and we don't have the "legacy_recalculate" flag.

This may break activation of a volume, created by an older kernel,
that is not yet fully recalculated -- if this happens, the user should
add the "legacy_recalculate" flag to constructor parameters.

Cc: stable@vger.kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Daniel Glockner <dg@emlix.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Documentation/admin-guide/device-mapper/dm-integrity.rst
drivers/md/dm-integrity.c