* commit '6c3b205c408f92101ddfa053cb134371e951a9a7': Update partition.*.verified even with ro.boot.veritymode set
This commit is contained in:
commit
5f2b3b4be8
1 changed files with 11 additions and 5 deletions
|
@ -859,6 +859,7 @@ out:
|
|||
int fs_mgr_update_verity_state(fs_mgr_verity_state_callback callback)
|
||||
{
|
||||
_Alignas(struct dm_ioctl) char buffer[DM_BUF_SIZE];
|
||||
bool use_state = true;
|
||||
char fstab_filename[PROPERTY_VALUE_MAX + sizeof(FSTAB_PREFIX)];
|
||||
char *mount_point;
|
||||
char propbuf[PROPERTY_VALUE_MAX];
|
||||
|
@ -875,7 +876,10 @@ int fs_mgr_update_verity_state(fs_mgr_verity_state_callback callback)
|
|||
property_get("ro.boot.veritymode", propbuf, "");
|
||||
|
||||
if (*propbuf != '\0') {
|
||||
return 0; /* state is kept by the bootloader */
|
||||
if (fs_mgr_load_verity_state(&mode) == -1) {
|
||||
return -1;
|
||||
}
|
||||
use_state = false; /* state is kept by the bootloader */
|
||||
}
|
||||
|
||||
fd = TEMP_FAILURE_RETRY(open("/dev/device-mapper", O_RDWR | O_CLOEXEC));
|
||||
|
@ -900,9 +904,11 @@ int fs_mgr_update_verity_state(fs_mgr_verity_state_callback callback)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (get_verity_state_offset(&fstab->recs[i], &offset) < 0 ||
|
||||
read_verity_state(fstab->recs[i].verity_loc, offset, &mode) < 0) {
|
||||
continue;
|
||||
if (use_state) {
|
||||
if (get_verity_state_offset(&fstab->recs[i], &offset) < 0 ||
|
||||
read_verity_state(fstab->recs[i].verity_loc, offset, &mode) < 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
mount_point = basename(fstab->recs[i].mount_point);
|
||||
|
@ -916,7 +922,7 @@ int fs_mgr_update_verity_state(fs_mgr_verity_state_callback callback)
|
|||
|
||||
status = &buffer[io->data_start + sizeof(struct dm_target_spec)];
|
||||
|
||||
if (*status == 'C') {
|
||||
if (use_state && *status == 'C') {
|
||||
if (write_verity_state(fstab->recs[i].verity_loc, offset,
|
||||
VERITY_MODE_LOGGING) < 0) {
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue