[PATCH 2/2] KVM: arm64: Commit pending PC adjustemnts before returning to userspace
Marc Zyngier
maz at kernel.org
Tue May 11 01:14:28 PDT 2021
Hi Fuad,
On Tue, 11 May 2021 09:03:40 +0100,
Fuad Tabba <tabba at google.com> wrote:
>
> Hi Marc,
>
> > KVM: arm64: Commit pending PC adjustemnts before returning to userspace
>
> s/adjustments/adjustments
Looks like Gmail refuses to let you mimic my spelling mistakes! :D
>
> On Mon, May 10, 2021 at 10:49 AM Marc Zyngier <maz at kernel.org> wrote:
> >
> > KVM currently updates PC (and the corresponding exception state)
> > using a two phase approach: first by setting a set of flags,
> > then by converting these flags into a state update when the vcpu
> > is about to enter the guest.
> >
> > However, this creates a disconnect with userspace if the vcpu thread
> > returns there with any exception/PC flag set. In this case, the exposed
> > context is wrong, as userpsace doesn't have access to these flags
> > (they aren't architectural). It also means that these flags are
> > preserved across a reset, which isn't expected.
> >
> > To solve this problem, force an explicit synchronisation of the
> > exception state on vcpu exit to userspace. As an optimisation
> > for nVHE systems, only perform this when there is something pending.
>
> I've tested this with a few nvhe and vhe tests that exercise both
> __kvm_adjust_pc call paths (__kvm_vcpu_run and
> kvm_arch_vcpu_ioctl_run), and the tests ran as expected. I'll do the
> same for v2 when you send it out.
Ah, that's interesting. Do you have tests that actually fail when
hitting this bug? Given that this is pretty subtle, it'd be good to
have a way to make sure it doesn't crop up again.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
More information about the linux-arm-kernel
mailing list