History

KVM: arm64: Fix hypercall bitmap writeback when vcpus have already run

We generally want to disallow hypercall bitmaps being changed once vcpus have already run. But we must allow the write if the written value is unchanged so that userspace can rewrite the register file on reboot, for example. Without this, a QEMU-based VM will fail to reboot correctly. The original code was correct, and it is me that introduced the regression.

Marc Zyngier committed 4 years ago

Commit 528ada21 parent 2cde51f1 file · +2 −1Browse files

Unified · Split

arch/arm64/kvm/hypercalls.c+2−1
@@ -379,7 +379,8 @@ static int kvm_arm_set_fw_reg_bmap(struct kvm_vcpu *vcpu, u64 reg_id, u64 val) · 378 unmodified lines
379379
380380 mutex_lock(&kvm->lock);
381381
382− if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags)) {
382+ if (test_bit(KVM_ARCH_FLAG_HAS_RAN_ONCE, &kvm->arch.flags) &&
383+ val != *fw_reg_bmap) {
383384 ret = -EBUSY;
384385 goto out;
385386 }