VirtualBox

Changeset 82818 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 22, 2020 10:49:51 AM (5 years ago)
Author:
vboxsync
Message:

SUPDrv/darwin: Adjusted SMAP feature detection and handling to honor VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV. bugref:9627

Location:
trunk/src/VBox/HostDrivers/Support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/Makefile.kmk

    r82741 r82818  
    644644  VBoxDrv_ASDEFS         += VBOX_WITH_HARDENING
    645645 endif
    646  if ($(VBOX_VERSION_BUILD) % 2) == 1
     646 ifdef VBOX_WITH_RAM_IN_KERNEL
     647  VBoxDrv_DEFS           += VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV IPRT_WITHOUT_EFLAGS_AC_PRESERVING
     648 else if ($(VBOX_VERSION_BUILD) % 2) == 1
    647649  VBoxDrv_DEFS           += VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV IPRT_WITH_EFLAGS_AC_PRESERVING
    648650 endif
  • trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp

    r76553 r82818  
    111111static int              VBoxDrvDarwinClose(dev_t Dev, int fFlags, int fDevType, struct proc *pProcess);
    112112static int              VBoxDrvDarwinIOCtl(dev_t Dev, u_long iCmd, caddr_t pData, int fFlags, struct proc *pProcess);
     113#ifndef VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV
    113114static int              VBoxDrvDarwinIOCtlSMAP(dev_t Dev, u_long iCmd, caddr_t pData, int fFlags, struct proc *pProcess);
     115#endif
    114116static int              VBoxDrvDarwinIOCtlSlow(PSUPDRVSESSION pSession, u_long iCmd, caddr_t pData, struct proc *pProcess);
    115117
     
    264266#endif
    265267
     268/** SUPKERNELFEATURES_XXX */
     269static uint32_t         g_fKernelFeatures = 0;
    266270
    267271/**
     
    300304                if (vboxdrvDarwinCpuHasSMAP())
    301305                {
     306                    g_fKernelFeatures |= SUPKERNELFEATURES_SMAP;
     307#ifndef VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV
    302308                    LogRel(("disabling SMAP for VBoxDrvDarwinIOCtl\n"));
    303309                    g_DevCW.d_ioctl = VBoxDrvDarwinIOCtlSMAP;
     310#endif
    304311                }
    305312
     
    726733
    727734
     735#ifndef VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV
    728736/**
    729737 * Alternative Device I/O Control entry point on hosts with SMAP support.
     
    746754    int rc = VBoxDrvDarwinIOCtl(Dev, iCmd, pData, fFlags, pProcess);
    747755
    748 #if defined(VBOX_STRICT) || defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV)
     756# if defined(VBOX_STRICT) || defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV)
    749757    /*
    750758     * Before we restore AC and the rest of EFLAGS, check if the IOCtl handler code
     
    758766        supdrvBadContext(&g_DevExt, "SUPDrv-darwin.cpp",  __LINE__, szTmp);
    759767    }
    760 #endif
     768# endif
    761769
    762770    ASMSetFlags(fSavedEfl);
    763771    return rc;
    764772}
     773#endif /* VBOX_WITHOUT_EFLAGS_AC_SET_IN_VBOXDRV */
    765774
    766775
     
    19932002SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void)
    19942003{
    1995     uint32_t fFlags = 0;
    1996     if (g_DevCW.d_ioctl == VBoxDrvDarwinIOCtlSMAP)
    1997         fFlags |= SUPKERNELFEATURES_SMAP;
    1998     else
    1999         Assert(!(ASMGetCR4() & X86_CR4_SMAP));
    2000     return fFlags;
     2004    return g_fKernelFeatures;
    20012005}
    20022006
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