Skip to main content

build_initrd_crc_diagnostic

Function build_initrd_crc_diagnostic 

Source
pub(crate) fn build_initrd_crc_diagnostic(
    p: &ShimParams,
    first_computed_crc: u32,
) -> ArrayString<384>
Expand description

Dump diagnostics when initrd CRC32 does not match the build-time value.

Contents:

  • base / size / expected (build-time) / got (first read) CRCs.
  • got2 — a second CRC re-computed immediately from the same virtual range. If got2 != got, initrd memory is not being read consistently (typical symptom of stale/mismatched cache lines after the SNP shared -> private transition, rather than data being wrong in memory).
  • head / tail — first and last 16 bytes as hex, to fingerprint what is actually in memory.
  • eighths — CRC32 of eight roughly-equal slices of the initrd. This is a coarse “which region diverges” locator that is cheap to compute and stable across boots, so it can be compared with a known-good build without needing a per-page dump (which would blow the log budget for real-sized initrds).