VirtualBox

Changeset 76743 in vbox


Ignore:
Timestamp:
Jan 9, 2019 4:28:43 PM (6 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:9180 Fix typos (duplicate GuestEs field in the VMCS map, local LDTR/TR limit/attribute mixup, read/store strictly only the number of MSRs specified in the VMCS, after limit checks ofc, rather than the entire 2 pages every time). Reading the second page could easily lead to a page-fault and therefore is wrong.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r76741 r76743  
    367367        /*     2 */ RT_UOFFSETOF(VMXVVMCS, u32GuestSsLimit),
    368368        /*     3 */ RT_UOFFSETOF(VMXVVMCS, u32GuestDsLimit),
    369         /*     4 */ RT_UOFFSETOF(VMXVVMCS, u32GuestEsLimit),
    370         /*     5 */ RT_UOFFSETOF(VMXVVMCS, u32GuestFsLimit),
    371         /*     6 */ RT_UOFFSETOF(VMXVVMCS, u32GuestGsLimit),
    372         /*     7 */ RT_UOFFSETOF(VMXVVMCS, u32GuestLdtrLimit),
    373         /*     8 */ RT_UOFFSETOF(VMXVVMCS, u32GuestTrLimit),
    374         /*     9 */ RT_UOFFSETOF(VMXVVMCS, u32GuestGdtrLimit),
    375         /*    10 */ RT_UOFFSETOF(VMXVVMCS, u32GuestIdtrLimit),
    376         /*    11 */ RT_UOFFSETOF(VMXVVMCS, u32GuestEsAttr),
    377         /*    12 */ RT_UOFFSETOF(VMXVVMCS, u32GuestCsAttr),
    378         /*    13 */ RT_UOFFSETOF(VMXVVMCS, u32GuestSsAttr),
    379         /*    14 */ RT_UOFFSETOF(VMXVVMCS, u32GuestDsAttr),
    380         /*    15 */ RT_UOFFSETOF(VMXVVMCS, u32GuestFsAttr),
    381         /*    16 */ RT_UOFFSETOF(VMXVVMCS, u32GuestGsAttr),
    382         /*    17 */ RT_UOFFSETOF(VMXVVMCS, u32GuestLdtrAttr),
    383         /*    18 */ RT_UOFFSETOF(VMXVVMCS, u32GuestTrAttr),
    384         /*    19 */ RT_UOFFSETOF(VMXVVMCS, u32GuestIntrState),
    385         /*    20 */ RT_UOFFSETOF(VMXVVMCS, u32GuestActivityState),
    386         /*    21 */ RT_UOFFSETOF(VMXVVMCS, u32GuestSmBase),
    387         /*    22 */ RT_UOFFSETOF(VMXVVMCS, u32GuestSysenterCS),
    388         /*    23 */ RT_UOFFSETOF(VMXVVMCS, u32PreemptTimer),
    389         /* 24-25 */ UINT16_MAX, UINT16_MAX
     369        /*     4 */ RT_UOFFSETOF(VMXVVMCS, u32GuestFsLimit),
     370        /*     5 */ RT_UOFFSETOF(VMXVVMCS, u32GuestGsLimit),
     371        /*     6 */ RT_UOFFSETOF(VMXVVMCS, u32GuestLdtrLimit),
     372        /*     7 */ RT_UOFFSETOF(VMXVVMCS, u32GuestTrLimit),
     373        /*     8 */ RT_UOFFSETOF(VMXVVMCS, u32GuestGdtrLimit),
     374        /*     9 */ RT_UOFFSETOF(VMXVVMCS, u32GuestIdtrLimit),
     375        /*    10 */ RT_UOFFSETOF(VMXVVMCS, u32GuestEsAttr),
     376        /*    11 */ RT_UOFFSETOF(VMXVVMCS, u32GuestCsAttr),
     377        /*    12 */ RT_UOFFSETOF(VMXVVMCS, u32GuestSsAttr),
     378        /*    13 */ RT_UOFFSETOF(VMXVVMCS, u32GuestDsAttr),
     379        /*    14 */ RT_UOFFSETOF(VMXVVMCS, u32GuestFsAttr),
     380        /*    15 */ RT_UOFFSETOF(VMXVVMCS, u32GuestGsAttr),
     381        /*    16 */ RT_UOFFSETOF(VMXVVMCS, u32GuestLdtrAttr),
     382        /*    17 */ RT_UOFFSETOF(VMXVVMCS, u32GuestTrAttr),
     383        /*    18 */ RT_UOFFSETOF(VMXVVMCS, u32GuestIntrState),
     384        /*    19 */ RT_UOFFSETOF(VMXVVMCS, u32GuestActivityState),
     385        /*    20 */ RT_UOFFSETOF(VMXVVMCS, u32GuestSmBase),
     386        /*    21 */ RT_UOFFSETOF(VMXVVMCS, u32GuestSysenterCS),
     387        /*    22 */ RT_UOFFSETOF(VMXVVMCS, u32PreemptTimer),
     388        /* 23-25 */ UINT16_MAX, UINT16_MAX, UINT16_MAX
    390389    },
    391390    /* VMX_VMCS_ENC_WIDTH_32BIT | VMX_VMCS_ENC_TYPE_HOST_STATE: */
     
    20122011    RTGCPHYS const GCPhysAutoMsrArea = pVmcs->u64AddrExitMsrStore.u;
    20132012    int rc = PGMPhysSimpleWriteGCPhys(pVCpu->CTX_SUFF(pVM), GCPhysAutoMsrArea,
    2014                                       pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pAutoMsrArea), VMX_V_AUTOMSR_AREA_SIZE);
     2013                                      pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pAutoMsrArea), cMsrs * sizeof(VMXAUTOMSR));
    20152014    if (RT_SUCCESS(rc))
    20162015    { /* likely */ }
     
    23412340        IEM_VMX_VMEXIT_FAILED_RET(pVCpu, uExitReason, pszFailure, kVmxVDiag_Vmexit_MsrLoadCount);
    23422341
     2342    Assert(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pAutoMsrArea));
    23432343    RTGCPHYS const GCPhysAutoMsrArea = pVmcs->u64AddrExitMsrLoad.u;
    2344     int rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), (void *)&pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pAutoMsrArea),
    2345                                      GCPhysAutoMsrArea, VMX_V_AUTOMSR_AREA_SIZE);
     2344    int rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), (void *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pAutoMsrArea),
     2345                                     GCPhysAutoMsrArea, cMsrs * sizeof(VMXAUTOMSR));
    23462346    if (RT_SUCCESS(rc))
    23472347    {
     
    54225422        Ldtr.u32Limit = pVmcs->u32GuestLdtrLimit;
    54235423        Ldtr.u64Base  = pVmcs->u64GuestLdtrBase.u;
    5424         Ldtr.Attr.u   = pVmcs->u32GuestLdtrLimit;
     5424        Ldtr.Attr.u   = pVmcs->u32GuestLdtrAttr;
    54255425
    54265426        if (!Ldtr.Attr.n.u1Unusable)
     
    54795479        Tr.u32Limit = pVmcs->u32GuestTrLimit;
    54805480        Tr.u64Base  = pVmcs->u64GuestTrBase.u;
    5481         Tr.Attr.u   = pVmcs->u32GuestTrLimit;
     5481        Tr.Attr.u   = pVmcs->u32GuestTrAttr;
    54825482
    54835483        /* Selector. */
     
    68236823
    68246824    RTGCPHYS const GCPhysAutoMsrArea = pVmcs->u64AddrEntryMsrLoad.u;
    6825     int rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), (void *)&pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pAutoMsrArea),
    6826                                      GCPhysAutoMsrArea, VMX_V_AUTOMSR_AREA_SIZE);
     6825    int rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), (void *)pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pAutoMsrArea),
     6826                                     GCPhysAutoMsrArea, cMsrs * sizeof(VMXAUTOMSR));
    68276827    if (RT_SUCCESS(rc))
    68286828    {
    6829         PVMXAUTOMSR pMsr = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pAutoMsrArea);
     6829        PCVMXAUTOMSR pMsr = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pAutoMsrArea);
    68306830        Assert(pMsr);
    68316831        for (uint32_t idxMsr = 0; idxMsr < cMsrs; idxMsr++, pMsr++)
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