Skip to content

Commit d4879a0

Browse files
committed
x86: force no-kvmclock on cmdline if secret_free=True
kvm-clock is incompatible with direct map removal for now. This is because kvm-clock tries to access guest memory through the direct map. Additionally, it does not handle failures during guest-attempted activations of kvm-clock gracefully (e.g. it cannot/does not communicate these back to the guest). This means a guest will unconditionally assume that if it wrote to the kvm-clock MSR to activate kvm-clock, it will work. But if KVM internally fails to activate kvm-clock, KVM will never write the information the guest expects into guest memory, resulting in the guest reading garbage data (generally, zeros), resulting in division by zero panics in the guest. Hence, explicitly tells guests that they shouldn't even try to enable kvm-clock, if they value their lives. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
1 parent cef107f commit d4879a0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/vmm/src/builder.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ pub fn build_microvm_for_boot(
233233

234234
let secret_free = vm_resources.machine_config.secret_free;
235235

236+
#[cfg(target_arch = "x86_64")]
237+
if secret_free {
238+
boot_cmdline.insert_str("no-kvmclock")?;
239+
}
240+
236241
let (mut vmm, mut vcpus) = create_vmm_and_vcpus(
237242
instance_info,
238243
event_manager,

0 commit comments

Comments
 (0)