Check dm-zero availability for bitlk type.

Bitlocker compatible mode uses dm-zero to mask metadata area,
device cannot be activated if dm-zero is not available.

Just add zero target check to device-mapper backend and
if activation fails, print a better error message here.

Fixes: #722
This commit is contained in:
Milan Broz
2022-03-16 12:21:30 +01:00
parent 6534e86c22
commit 559012b6a7
2 changed files with 32 additions and 7 deletions

View File

@@ -1207,7 +1207,7 @@ static int _activate(struct crypt_device *cd,
uint64_t next_start = 0;
uint64_t next_end = 0;
uint64_t last_segment = 0;
uint32_t dmt_flags;
uint32_t dmt_flags = 0;
r = _activate_check(cd, params);
if (r)
@@ -1348,6 +1348,10 @@ static int _activate(struct crypt_device *cd,
log_err(cd, _("Cannot activate device, kernel dm-crypt is missing support for BITLK Elephant diffuser."));
r = -ENOTSUP;
}
if (dm_flags(cd, DM_ZERO, &dmt_flags) < 0) {
log_err(cd, _("Cannot activate device, kernel dm-zero module is missing."));
r = -ENOTSUP;
}
}
out:
dm_targets_free(cd, &dmd);