VirtualBox

Ignore:
Timestamp:
Jul 17, 2014 7:02:33 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95068
Message:

VMM: Fixed potential bug in AMD-V NMI injection when interrupt shadowing is in effect, renamed INHIBIT_NMIS to BLOCK_NMIS to match Intel specs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r52065 r52066  
    35243524
    35253525    /*
    3526      * NMIs to the guest are inhibited until the guest executes an IRET. We only
    3527      * bother with virtual-NMI blocking when we have support for virtual NMIs in the
    3528      * CPU, otherwise setting this would block host-NMIs and IRET will not clear the
    3529      * blocking.
     3526     * NMIs to the guest are blocked after an NMI is injected until the guest executes an IRET. We only
     3527     * bother with virtual-NMI blocking when we have support for virtual NMIs in the CPU, otherwise
     3528     * setting this would block host-NMIs and IRET will not clear the blocking.
    35303529     *
    35313530     * See Intel spec. 26.6.1 "Interruptibility state". See @bugref{7445}.
    35323531     */
    3533     if (   VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_NMIS)
     3532    if (   VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS)
    35343533        && (pVCpu->hm.s.vmx.u32PinCtls & VMX_VMCS_CTRL_PIN_EXEC_VIRTUAL_NMI))
    35353534    {
     
    58315830                 * See Intel spec. 30.7.1.2 "Resuming Guest Software after Handling an Exception". See @bugref{7445}.
    58325831                 */
    5833                 Assert(VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_NMIS));
    5834                 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_NMIS);
     5832                Assert(VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS));
     5833                VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
    58355834                enmReflect = VMXREFLECTXCPT_XCPT;
    58365835            }
     
    59155914    {
    59165915        /*
    5917          * Execution of IRET caused this fault when NMI blocking was in effect. We need to reset the block-by-NMI field so
    5918          * that NMIs remain blocked until the IRET execution is completed.
     5916         * Execution of IRET caused this fault when NMI blocking was in effect (i.e we're in the guest NMI handler).
     5917         * We need to reset the block-by-NMI field so that NMIs remain blocked until the IRET execution is completed.
    59195918         * See Intel spec. 30.7.1.2 "Resuming guest software after handling an exception".
    59205919         */
    5921         if (!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_NMIS))
    5922             VMCPU_FF_SET(pVCpu, VMCPU_FF_INHIBIT_NMIS);
     5920        if (!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
     5921            VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
    59235922    }
    59245923
     
    61276126        if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
    61286127            VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS);
    6129         if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_NMIS))
    6130             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_NMIS);
     6128
     6129        if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
     6130            VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
    61316131    }
    61326132    else
     
    61456145
    61466146        if (uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_NMI)
    6147             VMCPU_FF_SET(pVCpu, VMCPU_FF_INHIBIT_NMIS);
    6148         else if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_NMIS))
    6149             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_NMIS);
     6147        {
     6148            if (!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
     6149                VMCPU_FF_SET(pVCpu, VMCPU_FF_BLOCK_NMIS);
     6150        }
     6151        else if (VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS))
     6152            VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_BLOCK_NMIS);
    61506153    }
    61516154}
     
    99329935    }
    99339936
    9934     Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_NMIS));
     9937    Assert(!VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS));
    99359938
    99369939    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette