VirtualBox

Changeset 79106 in vbox


Ignore:
Timestamp:
Jun 12, 2019 11:18:43 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Nested VMX: bugref:9180 Take into account MSR permission merging when verifying permissions in hmR0VmxCheckAutoLoadStoreMsrs.

File:
1 edited

Legend:

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

    r79102 r79106  
    23272327 * VMCS are correct.
    23282328 *
    2329  * @param   pVCpu       The cross context virtual CPU structure.
    2330  * @param   pVmcsInfo   The VMCS info. object.
    2331  */
    2332 static void hmR0VmxCheckAutoLoadStoreMsrs(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     2329 * @param   pVCpu           The cross context virtual CPU structure.
     2330 * @param   pVmcsInfo       The VMCS info. object.
     2331 * @param   fIsNstGstVmcs   Whether this is a nested-guest VMCS.
     2332 */
     2333static void hmR0VmxCheckAutoLoadStoreMsrs(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs)
    23332334{
    23342335    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    23972398            else
    23982399            {
    2399                 AssertMsgReturnVoid((fMsrpm & VMXMSRPM_ALLOW_RD_WR) == VMXMSRPM_ALLOW_RD_WR,
    2400                                     ("u32Msr=%#RX32 cMsrs=%u No passthru read/write!\n", pGuestMsrLoad->u32Msr, cMsrs));
     2400                if (!fIsNstGstVmcs)
     2401                {
     2402                    AssertMsgReturnVoid((fMsrpm & VMXMSRPM_ALLOW_RD_WR) == VMXMSRPM_ALLOW_RD_WR,
     2403                                        ("u32Msr=%#RX32 cMsrs=%u No passthru read/write!\n", pGuestMsrLoad->u32Msr, cMsrs));
     2404                }
     2405                else
     2406                {
     2407                    /*
     2408                     * A nested-guest VMCS must -also- allow read/write passthrough for the MSR for us to
     2409                     * execute a nested-guest with MSR passthrough.
     2410                     *
     2411                     * Check if the nested-guest MSR bitmap allows passthrough, and if so, assert that we
     2412                     * allow passthrough too.
     2413                     */
     2414                    void const *pvMsrBitmapNstGst = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap);
     2415                    Assert(pvMsrBitmapNstGst);
     2416                    uint32_t const fMsrpmNstGst = CPUMGetVmxMsrPermission(pvMsrBitmapNstGst, pGuestMsrLoad->u32Msr);
     2417                    AssertMsgReturnVoid(fMsrpm == fMsrpmNstGst,
     2418                                        ("u32Msr=%#RX32 cMsrs=%u Permission mismatch fMsrpm=%#x fMsrpmNstGst=%#x!\n",
     2419                                         pGuestMsrLoad->u32Msr, cMsrs, fMsrpm, fMsrpmNstGst));
     2420                }
    24012421            }
    24022422        }
     
    1084310863#ifdef VBOX_STRICT
    1084410864    Assert(pVCpu->hm.s.vmx.fUpdatedHostAutoMsrs);
    10845     hmR0VmxCheckAutoLoadStoreMsrs(pVCpu, pVmcsInfo);
     10865    hmR0VmxCheckAutoLoadStoreMsrs(pVCpu, pVmcsInfo, pVmxTransient->fIsNestedGuest);
    1084610866    hmR0VmxCheckHostEferMsr(pVCpu, pVmcsInfo);
    1084710867    AssertRC(hmR0VmxCheckVmcsCtls(pVCpu, pVmcsInfo));
Note: See TracChangeset for help on using the changeset viewer.

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