Merge "fs_mgr: support upstream dm-verity without error correction"
am: 907ec7daa7
* commit '907ec7daa761624012476e540d8fe473b67b94bf':
fs_mgr: support upstream dm-verity without error correction
This commit is contained in:
commit
2d4ec2e663
1 changed files with 36 additions and 6 deletions
|
|
@ -254,7 +254,7 @@ static bool format_verity_table(char *buf, const size_t bufsize,
|
||||||
res = snprintf(buf, bufsize, "%s 2 " VERITY_TABLE_OPT_IGNZERO " %s", params->table,
|
res = snprintf(buf, bufsize, "%s 2 " VERITY_TABLE_OPT_IGNZERO " %s", params->table,
|
||||||
mode_flag);
|
mode_flag);
|
||||||
} else {
|
} else {
|
||||||
res = strlcpy(buf, params->table, bufsize);
|
res = snprintf(buf, bufsize, "%s 1 " VERITY_TABLE_OPT_IGNZERO, params->table);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res < 0 || (size_t)res >= bufsize) {
|
if (res < 0 || (size_t)res >= bufsize) {
|
||||||
|
|
@ -944,13 +944,43 @@ int fs_mgr_setup_verity(struct fstab_rec *fstab)
|
||||||
|
|
||||||
// load the verity mapping table
|
// load the verity mapping table
|
||||||
if (load_verity_table(io, mount_point, verity.data_size, fd, ¶ms,
|
if (load_verity_table(io, mount_point, verity.data_size, fd, ¶ms,
|
||||||
format_verity_table) < 0 &&
|
format_verity_table) == 0) {
|
||||||
// try the legacy format for backwards compatibility
|
goto loaded;
|
||||||
load_verity_table(io, mount_point, verity.data_size, fd, ¶ms,
|
|
||||||
format_legacy_verity_table) < 0) {
|
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params.ecc.valid) {
|
||||||
|
// kernel may not support error correction, try without
|
||||||
|
INFO("Disabling error correction for %s\n", mount_point);
|
||||||
|
params.ecc.valid = false;
|
||||||
|
|
||||||
|
if (load_verity_table(io, mount_point, verity.data_size, fd, ¶ms,
|
||||||
|
format_verity_table) == 0) {
|
||||||
|
goto loaded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// try the legacy format for backwards compatibility
|
||||||
|
if (load_verity_table(io, mount_point, verity.data_size, fd, ¶ms,
|
||||||
|
format_legacy_verity_table) == 0) {
|
||||||
|
goto loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.mode != VERITY_MODE_EIO) {
|
||||||
|
// as a last resort, EIO mode should always be supported
|
||||||
|
INFO("Falling back to EIO mode for %s\n", mount_point);
|
||||||
|
params.mode = VERITY_MODE_EIO;
|
||||||
|
|
||||||
|
if (load_verity_table(io, mount_point, verity.data_size, fd, ¶ms,
|
||||||
|
format_legacy_verity_table) == 0) {
|
||||||
|
goto loaded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ERROR("Failed to load verity table for %s\n", mount_point);
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
loaded:
|
||||||
|
|
||||||
// activate the device
|
// activate the device
|
||||||
if (resume_verity_table(io, mount_point, fd) < 0) {
|
if (resume_verity_table(io, mount_point, fd) < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue