Commit 50011c2
committed
KVM: VMX: Refresh available regs and IDT vectoring info before NMI handling
Reset the mask of available "registers" and refresh the IDT vectoring
info snapshot in vmx_vcpu_enter_exit(), before KVM potentially handles a
an NMI VM-Exit. One of the "registers" that KVM VMX lazily loads is the
vmcs.VM_EXIT_INTR_INFO field, which is holds the vector+type on "exception
or NMI" VM-Exits, i.e. is needed to identify NMIs. Clearing the available
registers bitmask after handling NMIs results in KVM querying info from
the last VM-Exit that read vmcs.VM_EXIT_INTR_INFO, and leads to both
missed NMIs and spurious NMIs in the host.
Opportunistically grab vmcs.IDT_VECTORING_INFO_FIELD early in the VM-Exit
path too, e.g. to guard against similar consumption of stale data. The
field is read on every "normal" VM-Exit, and there's no point in delaying
the inevitable.
Reported-by: Like Xu <like.xu.linux@gmail.com>
Fixes: 11df586 ("KVM: VMX: Handle NMI VM-Exits in noinstr region")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230825014532.2846714-1-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>1 parent 9ca0c1a commit 50011c2
1 file changed
Lines changed: 11 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7209 | 7209 | | |
7210 | 7210 | | |
7211 | 7211 | | |
| 7212 | + | |
| 7213 | + | |
| 7214 | + | |
7212 | 7215 | | |
7213 | 7216 | | |
7214 | 7217 | | |
7215 | | - | |
| 7218 | + | |
7216 | 7219 | | |
7217 | | - | |
7218 | | - | |
| 7220 | + | |
| 7221 | + | |
| 7222 | + | |
| 7223 | + | |
| 7224 | + | |
| 7225 | + | |
7219 | 7226 | | |
7220 | 7227 | | |
7221 | 7228 | | |
| |||
7224 | 7231 | | |
7225 | 7232 | | |
7226 | 7233 | | |
| 7234 | + | |
7227 | 7235 | | |
7228 | 7236 | | |
7229 | 7237 | | |
| |||
7345 | 7353 | | |
7346 | 7354 | | |
7347 | 7355 | | |
7348 | | - | |
7349 | | - | |
7350 | 7356 | | |
7351 | 7357 | | |
7352 | 7358 | | |
| |||
7363 | 7369 | | |
7364 | 7370 | | |
7365 | 7371 | | |
7366 | | - | |
7367 | | - | |
7368 | 7372 | | |
7369 | 7373 | | |
7370 | 7374 | | |
7371 | 7375 | | |
7372 | 7376 | | |
7373 | 7377 | | |
7374 | | - | |
7375 | | - | |
7376 | | - | |
7377 | 7378 | | |
7378 | 7379 | | |
7379 | 7380 | | |
| |||
0 commit comments