Repository navigation
fix: read legacy v9 snapshots in the nested KVM runtime - #27
Hygge-Gezelligheid wants to merge 5 commits into
Conversation
0fd7672 to
721f057
Compare
…hots Decode the historical x86_64 v9 layout into current VM state and accept the unchanged ARM v9 layout while retaining current-format writes. Share validated loading with recovery and inspection tools, and query KVM nested-state support before capture. Cover conversion and rejection with regression tests and an authentic v9 fixture. Signed-off-by: Yicheng Lin <linyc25@mails.tsinghua.edu.cn>
721f057 to
1ba4038
Compare
95c9c96 to
6ccf130
Compare
| if cfg!(target_arch = "x86_64") { | ||
| let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").expect("Missing target architecture"); | ||
| if target_arch == "x86_64" { |
There was a problem hiding this comment.
Why do we need this change? Was there an issue with the previous cfg!?
There was a problem hiding this comment.
I added this to support the x86_64-to-aarch64 cross-compilation workflow I used for preparing the release. It makes build.rs select the mock kernel by the target architecture rather than the build host.
Since we can build the ARM artifacts natively, this build-workflow adaptation doesn’t need to be included in this PR. I’ll drop this change and use native ARM builds.
|
Two additional points:
Note that MSR_VM_HSAVE_PA and MSR_VM_CR are not listed in KVM_GET_MSR_INDEX_LIST,so add it to whitelist like MSR_IA32_XSS may not work. |
Align package, API and changelog versions at 1.15.1-patch-v2. Signed-off-by: Yicheng Lin <linyc25@mails.tsinghua.edu.cn>
IA32_XSS controls which supervisor XSTATE components (CET_U, CET_S, PT, HDC, etc.) are valid for XSAVES/XRSTORS. Without it the guest kernel's context-switch path triggers #GP when it encounters supervisor components in a process's XSAVE buffer that don't match the (now zeroed) XSS register: Bad FPU state detected at restore_fpregs_from_fpstate, \ reinitializing FPU registers. KVM unconditionally includes IA32_XSS in its msrs_to_save_base[] list (it's not CPUID-gated), but Firecracker's serializable MSR allowlist previously excluded it. Add it so snapshots round-trip any guest relying on supervisor XSTATE features. Signed-off-by: Jack Thomson <jackabt@amazon.com> (cherry picked from commit 4905775) Backport the MSR allowlist change and document it in the release changelog. Validated against the AgentENV lifecycle failure on AMD EPYC 9V45: unmodified runtime fails; the XSS candidate passes all 21 active Rust integration tests with the same Linux 6.18 kernel. Signed-off-by: Yicheng Lin <linyc25@mails.tsinghua.edu.cn>
Keep SVM nested-state headers so snapshot restore preserves both GIF values. Cover SVM headers and the existing VMX cases with a focused regression test.
6ccf130 to
7088964
Compare
I confirm two issues with the experiment:
|
LGTM. |
fa75825 to
d6c517a
Compare
huang-jl
left a comment
There was a problem hiding this comment.
Looks good overall, though I do not reviewed the details closely.
Rebuild the ongoing MSR save set from captured state and guest CPUID, retaining baseline indices and deduplicating additions without reordering. Select VM_CR and HSAVE_PA when the guest exposes SVM, since KVM does not fully enumerate the SVM state registers. Include VIRT_SPEC_CTRL in the serialization whitelist to retain the guest SSBD setting. Add focused whitelist, CPUID-selection and repeated-restore regressions.
d6c517a to
9b08a50
Compare
Allow the nested-KVM runtime to restore legacy v9 snapshots and continue saving v1000 state.
Changes
1.15.1-patch-v2.490577590dc9ddd59ba8b9f13868cd56d0c3f9c2.Validation
Compatibility and release
Compatibility is old-to-new: v9 input files remain unchanged, and old runtimes cannot read v1000. Nested-KVM hardware validation covers Intel and AMD; the ARM hardware tests cover ordinary KVM.
Release:
v1.15.1-patch-v2. Both runtime archives were built natively on their respective architectures from95c9c9653ae3ed1517a312fd39a22bedc6586e01, matching the release tag. The PR and release source trees differ only insrc/cpu-template-helper/build.rs; native builds select the same architecture-specific mock kernel. Each containsfirecrackerandcpu-template-helper; prebuilt Linux 6.18 kernels are available for both architectures. Installations retaining historical pre-fault patch-v2 binaries must replace that same-version cache.Companion integration and nested test tools: AgentENV #358.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.