NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/60545: nvmm_x86_vmx: stale exit reason on launch/resume failure
>Number: 60545
>Category: kern
>Synopsis: nvmm_x86_vmx: stale exit reason on launch/resume failure
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Aug 06 01:25:00 +0000 2026
>Originator: Taylor R Campbell
>Release: current
>Organization:
The NmiBSD Virtualization, Inc.
>Environment:
>Description:
If vmx_vmresume or vmx_vmlaunch fails, VMCS_EXIT_REASON is
invalid (left over from the last successful VMRESUME or
VMLAUNCH, probably), and should not be used:
2450 if (launched) {
2451 ret = vmx_vmresume(cpudata->gprs);
2452 } else {
2453 ret = vmx_vmlaunch(cpudata->gprs);
2454 }
2455 cpudata->gcr2 = rcr2();
2456 vmx_htlb_flush_ack(cpudata, machgen);
2457 exitcode = vmx_vmread(VMCS_EXIT_REASON);
2458 exitcode &= __BITS(15,0);
2459 if (exitcode == VMCS_EXITCODE_EXC_NMI) {
2460 /* handle nmi before vmx_sti() */
2461 vmx_exit_exc_nmi(mach, vcpu, exit);
2462 }
2463 vmx_sti();
2464 vmx_vcpu_guest_fpu_leave(vcpu);
2465
2466 if (__predict_false(ret != 0)) {
2467 vmx_exit_invalid(exit, -1);
2468 break;
2469 }
https://nxr.netbsd.org/xref/src/sys/dev/nvmm/x86/nvmm_x86_vmx.c?r=1.96#2450
Reported by maxv.
>How-To-Repeat:
code inspection
>Fix:
Surround the vmx_vmread(VMCS_EXIT_REASON) and use of its result
in:
if (__predict_true(ret == 0)) {
...
}
Home |
Main Index |
Thread Index |
Old Index