ANDROID: KVM: arm64: Fix corrupted PSTATE during guest debug
When running non-protected guests for which the host has enabled
hardware-assisted debugging, pKVM "flushes" PSTATE and MDSCR_EL1 from
the host-controlled vCPU struct to its internal struct before actually
running the vCPU. However, on guest exit, it was failing to record
("sync") any change that the guest might have made to those registers.
As a result, the following vCPU flush discards those changes and the
following vCPU run happens with potentially corrupted registers. This
is particularly noticeable during Linux boot when guest updates to
PSTATE.{I,BTYPE} are lost.
Instead, sync PSTATE and MDSCR if they were flushed before the vCPU run.
Bug: 389970357
Fixes: 0a1f3a1f ("ANDROID: KVM: arm64: Monitor Debug support for non-protected guests")
Change-Id: Idaf68516782dc3cd284f6a4e65f8c89cbad7d273
Signed-off-by:
Pierre-Clément Tosi <ptosi@google.com>
Loading