Skip to content

Commit a09ffa5

Browse files
kalyazinclaude
andcommitted
feat(snapshot-editor): print saved MSR index/data
The derived Debug of a vcpu's saved_msrs shows only the kvm_msrs headers, not the entries (a FAM array). Print each saved MSR's index and data so tooling can read values from a snapshot — e.g. MSR_LSTAR (entry_SYSCALL_64), used to recover the KASLR image slide of a restored guest for source-level debugging. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Nikita Kalyazin <nikita.kalyazin@e2b.dev>
1 parent 823ea57 commit a09ffa5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/snapshot-editor/src/info.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ fn info_vcpu_states(snapshot: &Snapshot<MicrovmState>) -> Result<(), InfoVmState
6666
for (i, state) in snapshot.data.vcpu_states.iter().enumerate() {
6767
println!("vcpu {i}:");
6868
println!("{state:#?}");
69+
// The derived Debug of `saved_msrs` only shows the kvm_msrs headers, not
70+
// the entries (a FAM array). Print index/data so tooling can read MSR
71+
// values (e.g. LSTAR, to recover the KASLR slide from a snapshot).
72+
#[cfg(target_arch = "x86_64")]
73+
for entry in state.saved_msrs.iter().flat_map(|m| m.as_slice()) {
74+
println!(" msr index={:#x} data={:#x}", entry.index, entry.data);
75+
}
6976
}
7077
Ok(())
7178
}

0 commit comments

Comments
 (0)