mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 03:10:08 +01:00
Force test to read device to detect corrupted blocks.
(If udev scanning is switched off, there is no real activity on device yet.)
This commit is contained in:
@@ -1772,6 +1772,8 @@ static void VerityTest(void)
|
|||||||
/* hash fail */
|
/* hash fail */
|
||||||
root_hash[1] = ~root_hash[1];
|
root_hash[1] = ~root_hash[1];
|
||||||
OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, root_hash, 32, CRYPT_ACTIVATE_READONLY));
|
OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, root_hash, 32, CRYPT_ACTIVATE_READONLY));
|
||||||
|
/* Be sure there was some read activity to mark device corrupted. */
|
||||||
|
_system("blkid " DMDIR CDEVICE_1, 0);
|
||||||
OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
|
OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
|
||||||
EQ_(CRYPT_ACTIVATE_READONLY|CRYPT_ACTIVATE_CORRUPTED, cad.flags);
|
EQ_(CRYPT_ACTIVATE_READONLY|CRYPT_ACTIVATE_CORRUPTED, cad.flags);
|
||||||
OK_(crypt_deactivate(cd, CDEVICE_1));
|
OK_(crypt_deactivate(cd, CDEVICE_1));
|
||||||
@@ -1780,6 +1782,7 @@ static void VerityTest(void)
|
|||||||
/* data fail */
|
/* data fail */
|
||||||
OK_(crypt_set_data_device(cd, DEVICE_1));
|
OK_(crypt_set_data_device(cd, DEVICE_1));
|
||||||
OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, root_hash, 32, CRYPT_ACTIVATE_READONLY));
|
OK_(crypt_activate_by_volume_key(cd, CDEVICE_1, root_hash, 32, CRYPT_ACTIVATE_READONLY));
|
||||||
|
_system("blkid " DMDIR CDEVICE_1, 0);
|
||||||
OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
|
OK_(crypt_get_active_device(cd, CDEVICE_1, &cad));
|
||||||
EQ_(CRYPT_ACTIVATE_READONLY|CRYPT_ACTIVATE_CORRUPTED, cad.flags);
|
EQ_(CRYPT_ACTIVATE_READONLY|CRYPT_ACTIVATE_CORRUPTED, cad.flags);
|
||||||
OK_(crypt_deactivate(cd, CDEVICE_1));
|
OK_(crypt_deactivate(cd, CDEVICE_1));
|
||||||
|
|||||||
Reference in New Issue
Block a user