VirtualBox

Changeset 91963 in vbox for trunk/src


Ignore:
Timestamp:
Oct 21, 2021 3:22:44 PM (3 years ago)
Author:
vboxsync
Message:

VMM/IEM: Nested VMX: bugref:10092 CR3 physical address mask check when EPT paging is enabled (ifdef'd), no functional changes to the old code.

File:
1 edited

Legend:

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

    r91634 r91963  
    59405940
    59415941            /* Check / mask the value. */
    5942             if (uNewCrX & UINT64_C(0xfff0000000000000))
    5943             {
     5942#ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT
     5943            /* See Intel spec. 27.2.2 "EPT Translation Mechanism" footnote. */
     5944            uint64_t const fInvPhysMask = !CPUMIsGuestVmxEptPagingEnabledEx(IEM_GET_CTX(pVCpu))
     5945                                        ? ~(RT_BIT_64(IEM_GET_GUEST_CPU_FEATURES(pVCpu)->cMaxPhysAddrWidth) - 1U)
     5946                                        : (X86_CR3_EPT_PAGE_MASK | X86_PAGE_4K_OFFSET_MASK);
     5947#else
     5948            uint64_t const fInvPhysMask = UINT64_C(0xfff0000000000000);
     5949#endif
     5950            if (uNewCrX & fInvPhysMask)
     5951            {
     5952                /** @todo Should we raise this only for 64-bit mode like Intel claims? AMD is
     5953                 *        very vague in this area. As mentioned above, need testcase on real
     5954                 *        hardware... Sigh. */
    59445955                Log(("Trying to load CR3 with invalid high bits set: %#llx\n", uNewCrX));
    59455956                return iemRaiseGeneralProtectionFault0(pVCpu);
     
    59495960            if (   (pVCpu->cpum.GstCtx.cr4 & X86_CR4_PAE)
    59505961                && (pVCpu->cpum.GstCtx.msrEFER & MSR_K6_EFER_LME))
     5962            {
     5963                /** @todo Redundant? This value has already been validated above. */
    59515964                fValid = UINT64_C(0x000fffffffffffff);
     5965            }
    59525966            else
    59535967                fValid = UINT64_C(0xffffffff);
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