[PATCH v1 11/12] KVM: arm64: Update vcpu state with live value of VBAR_EL1 on injecting an exception
Fuad Tabba
tabba at google.com
Wed Nov 20 02:52:53 PST 2024
If the injection happens early, when VBAR_EL1 has just been set,
it's value wouldn't be up to date in the vcpu structure,
resulting in it being clobbered before returning to the guest
with the injected exception, which the guest wouldn't be able to
handle properly. Although this probably means that the guest
cannot properly run, this behavior is unexpected and makes
debugging harder.
Signed-off-by: Fuad Tabba <tabba at google.com>
---
arch/arm64/kvm/hyp/nvhe/sys_regs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/kvm/hyp/nvhe/sys_regs.c b/arch/arm64/kvm/hyp/nvhe/sys_regs.c
index 17783c8ddb92..54f23d9fea18 100644
--- a/arch/arm64/kvm/hyp/nvhe/sys_regs.c
+++ b/arch/arm64/kvm/hyp/nvhe/sys_regs.c
@@ -250,6 +250,7 @@ static void inject_undef64(struct kvm_vcpu *vcpu)
*vcpu_pc(vcpu) = read_sysreg_el2(SYS_ELR);
*vcpu_cpsr(vcpu) = read_sysreg_el2(SYS_SPSR);
+ vcpu_write_sys_reg(vcpu, read_sysreg(VBAR_EL1), VBAR_EL1);
kvm_pend_exception(vcpu, EXCEPT_AA64_EL1_SYNC);
--
2.47.0.338.g60cca15819-goog
More information about the linux-arm-kernel
mailing list