VirtualBox

Ignore:
Timestamp:
Aug 9, 2015 2:26:51 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102008
Message:

SUPDrv: Enabled AC=1 I/O control checks on Linux and extended the checks to include the interrupt flag, I/O privilege level and the direction flag.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r57252 r57254  
    645645     * SMAP check.
    646646     */
    647 #ifdef VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV
    648647    RTCCUINTREG fSavedEfl = ASMAddFlags(X86_EFL_AC);
    649 #else
    650     RTCCUINTREG fSavedEfl = ASMGetFlags();
    651     ASMSetAC();
     648
     649    int rc = VBoxDrvDarwinIOCtl(Dev, iCmd, pData, fFlags, pProcess);
     650
     651#if defined(VBOX_STRICT) || defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV)
     652    /*
     653     * Before we restore AC and the rest of EFLAGS, check if the IOCtl handler code
     654     * accidentially modified it or some other important flag.
     655     */
     656    if (RT_UNLIKELY(   (ASMGetFlags() & (X86_EFL_AC | X86_EFL_IF | X86_EFL_DF | X86_EFL_IOPL))
     657                    != ((fSavedEfl    & (X86_EFL_AC | X86_EFL_IF | X86_EFL_DF | X86_EFL_IOPL)) | X86_EFL_AC) ))
     658    {
     659        char szTmp[48];
     660        RTStrPrintf(szTmp, sizeof(szTmp), "iCmd=%#x: %#x->%#x!", iCmd, (uint32_t)fSavedEfl, (uint32_t)ASMGetFlags());
     661        supdrvBadContext(&g_DevExt, "SUPDrv-darwin.cpp",  __LINE__, szTmp);
     662    }
    652663#endif
    653664
    654     int rc = VBoxDrvDarwinIOCtl(Dev, iCmd, pData, fFlags, pProcess);
    655 
    656 #if defined(VBOX_STRICT) || defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV)
    657     if (RT_UNLIKELY(!(ASMGetFlags() & X86_EFL_AC)))
    658     {
    659         char szTmp[32];
    660         RTStrPrintf(szTmp, sizeof(szTmp), "iCmd=%#x!", iCmd);
    661         supdrvBadContext(&g_DevExt, "SUPDrv-darwin.cpp",  __LINE__, szTmp);
    662     }
    663 #endif
    664665    ASMSetFlags(fSavedEfl);
    665666    return rc;
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