Commit 5e5cde58 authored by Fuad Tabba's avatar Fuad Tabba
Browse files

BACKPORT: FROMGIT: KVM: arm64: Sync protected guest VBAR_EL1 on injecting an undef exception

In pKVM, a race condition can occur if a guest updates its VBAR_EL1
register and, before a vCPU exit synchronizes this change, the
hypervisor needs to inject an undefined exception into a protected
guest.

In this scenario, the vCPU still holds the stale VBAR_EL1 value from
before the guest's update. When pKVM injects the exception, it ends up
using the stale value.

Explicitly read the live value of VBAR_EL1 from the guest and update the
vCPU value immediately before pending the exception. This ensures the
vCPU's value is the same as the guest's and that the exception will be
handled at the correct address upon resuming the guest.

Bug: 357781595
(cherry picked from commit 798eb597
 https://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git

 fixes)
[tabba@ patch already exists, but was reading hyp's VBAR in hVHE]
Reported-by: default avatarKeir Fraser <keirf@google.com>
Change-Id: I85a6106392e4af581f1cb57813f3fc1acd6b0463
Signed-off-by: default avatarFuad Tabba <tabba@google.com>
Link: https://lore.kernel.org/r/20250807120133.871892-3-tabba@google.com


Signed-off-by: default avatarOliver Upton <oliver.upton@linux.dev>
parent 9da964bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment