VirtualBox

Changeset 104219 in vbox for trunk/src/VBox/VMM/VMMR0


Ignore:
Timestamp:
Apr 8, 2024 6:01:43 AM (11 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
162656
Message:

VMM: bugref:10610 Fixed MSR loading.

File:
1 edited

Legend:

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

    r103289 r104219  
    380380        else
    381381        {
    382             ASMWrMsr(MSR_K8_KERNEL_GS_BASE, pCtx->msrKERNELGSBASE);
    383             ASMWrMsr(MSR_K8_LSTAR,          pCtx->msrLSTAR);
    384             ASMWrMsr(MSR_K6_STAR,           pCtx->msrSTAR);
    385             /* The system call flag mask register isn't as benign and accepting of all
    386                values as the above, so mask it to avoid #GP'ing on corrupted input. */
    387             Assert(!(pCtx->msrSFMASK & ~(uint64_t)UINT32_MAX));
    388             ASMWrMsr(MSR_K8_SF_MASK,        pCtx->msrSFMASK & UINT32_MAX);
     382            /* Avoid raising #GP caused by writing illegal values to these MSRs. */
     383            if (   X86_IS_CANONICAL(pCtx->msrKERNELGSBASE)
     384                && X86_IS_CANONICAL(pCtx->msrLSTAR))
     385            {
     386                ASMWrMsr(MSR_K8_KERNEL_GS_BASE, pCtx->msrKERNELGSBASE);
     387                ASMWrMsr(MSR_K8_LSTAR,          pCtx->msrLSTAR);
     388                ASMWrMsr(MSR_K6_STAR,           pCtx->msrSTAR);
     389                /* The system call flag mask register isn't as benign and accepting of all
     390                   values as the above, so mask it to avoid #GP'ing on corrupted input. */
     391                Assert(!(pCtx->msrSFMASK & ~(uint64_t)UINT32_MAX));
     392                ASMWrMsr(MSR_K8_SF_MASK,        pCtx->msrSFMASK & UINT32_MAX);
     393            }
     394            else
     395                AssertMsgFailed(("Incompatible lazily-loaded guest MSR values\n"));
    389396        }
    390397    }
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