fix overly restrictive version match on backup version

This commit is contained in:
bunnie 2022-10-08 15:29:37 +08:00
parent a0791ff092
commit c471ca0fbb
4 changed files with 4 additions and 2 deletions

View file

@ -257,6 +257,7 @@ impl Default for BackupHeaderIpc {
}
pub const BACKUP_VERSION: u32 = 0x00_01_00_01;
pub const BACKUP_VERSION_MASK: u32 = 0xFF_FF_00_00; // mask off bits that are cross-compatible
#[repr(u32)]
#[derive(Copy, Clone, PartialEq, Eq, Debug)]

View file

@ -2645,7 +2645,7 @@ impl<'a> RootKeys {
let backup = &kernel[KERNEL_BACKUP_OFFSET as usize..KERNEL_BACKUP_OFFSET as usize + size_of::<BackupHeader>()];
let mut header = BackupHeader::default();
header.as_mut().copy_from_slice(backup);
if header.version == BACKUP_VERSION {
if (header.version & BACKUP_VERSION_MASK) == (BACKUP_VERSION & BACKUP_VERSION_MASK) {
Some(header)
} else {
None

View file

@ -464,7 +464,7 @@ fn wrapped_main() -> ! {
_ => log::warn!("backup record was found, but it has an improper operation field: {:?}", header.op),
}
}
_ => {}, // no backup header found, continue with boot
_ => log::info!("No backup header found"), // no backup header found, continue with boot
}
// check for gateware updates

View file

@ -582,6 +582,7 @@ def main():
# this list should visit kernels in order from newest to oldest.
URL_LIST = [
'https://ci.betrusted.io/releases/v0.9.9/',
'https://ci.betrusted.io/latest-ci/', # prefer stable, but fallback to latest-ci if the kernels are too old
'https://ci.betrusted.io/releases/v0.9.8/',
'https://ci.betrusted.io/releases/v0.9.7/'
]