Hi Marc, On Tue, May 11, 2021 at 9:14 AM Marc Zyngier <maz@xxxxxxxxxx> wrote: > > Hi Fuad, > > On Tue, 11 May 2021 09:03:40 +0100, > Fuad Tabba <tabba@xxxxxxxxxx> 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@xxxxxxxxxx> 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. Nothing that fails, just code that generates exceptions or emulates instructions at various points. That said, I think it should be straightforward to write a selftest for this. I'll give it a go. /fuad > Thanks, > > M. > > -- > Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm