Re: [PATCH v2] KVM: X86: Fix exception untrigger on ret to user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/07/21 01:06, stsp wrote:
What I ask is how SHOULD the
KVM_SET_REGS and KVM_SET_SREGS
behave when someone (mistakenly)
calls them with the exception pending.
Should they return an error
instead of canceling exception?

In theory, KVM_SET_REGS and KVM_SET_SREGS should do nothing but set the value of the registers. They not should clear either vcpu->arch.exception.pending or vcpu->arch.exception.injected. I'm wary of changing that and breaking users of KVM, though.

In this case the problem is that, with a pending exception, you should not inject the interrupt (doesn't matter if it's with KVM_SET_REGS or KVM_INTERRUPT). Raising a page fault is part of executing the previous instruction, and interrupts are only recognized at instruction boundaries. Therefore, you need to test ready_for_interrupt_injection, and possibly use request_interrupt_window, before calling KVM_SET_REGS.

The patch you identified as the culprit does have a bug, but that's fixed in kvm_cpu_accept_dm_intr as I suggested in the other thread.

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux