Changeset 57254 in vbox
- Timestamp:
- Aug 9, 2015 2:26:51 PM (9 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/Makefile.kmk
r57220 r57254 705 705 | $$(dir $$@) 706 706 $(call MSG_TOOL,Creating,,$@) 707 ifndef VBOX_WITH_HARDENING 708 $(QUIET)$(SED) -e "s;-DVBOX_WITH_HARDENING;;g" --output $@ $< 709 else 710 $(QUIET)$(CP) -f $< $@ 711 endif 707 $(QUIET)$(SED) -e "" \ 708 $(if-expr !defined(VBOX_WITH_HARDENING) ,-e "s;-DVBOX_WITH_HARDENING;;g",) \ 709 $(if-expr ($(VBOX_VERSION_BUILD) % 2) == 0,-e "s;-DVBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV;;g",) \ 710 --output $@ $< 712 711 %$(QUIET2)$(APPEND) -t '$(PATH_TARGET)/vboxdrv-mod-1.dep' \ 713 712 'Support/$(KBUILD_TARGET)/Makefile_VBOX_HARDENED=$(VBOX_WITH_HARDENING)' -
trunk/src/VBox/HostDrivers/Support/darwin/SUPDrv-darwin.cpp
r57252 r57254 645 645 * SMAP check. 646 646 */ 647 #ifdef VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV648 647 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 } 652 663 #endif 653 664 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 #endif664 665 ASMSetFlags(fSavedEfl); 665 666 return rc; -
trunk/src/VBox/HostDrivers/Support/linux/Makefile
r56293 r57254 256 256 KFLAGS := -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 \ 257 257 -DIN_SUP_R0 -DVBOX -DRT_WITH_VBOX -DVBOX_WITH_HARDENING \ 258 -DSUPDRV_WITH_RELEASE_LOGGER\258 -DSUPDRV_WITH_RELEASE_LOGGER -DVBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV \ 259 259 -Wno-declaration-after-statement 260 260 ifdef VBOX_REDHAT_KABI -
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r57108 r57254 67 67 68 68 69 70 69 /******************************************************************************* 71 70 * Defined Constants And Macros * … … 96 95 VBOX_VERSION_BUILD) 97 96 #define VBoxDrvLinuxIOCtl RT_CONCAT(VBoxDrvLinuxIOCtl_,VBoxDrvLinuxVersion) 97 98 98 99 99 /******************************************************************************* … … 650 650 PSUPDRVSESSION pSession = (PSUPDRVSESSION)pFilp->private_data; 651 651 int rc; 652 #if defined(VBOX_STRICT) || defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV) 653 RTCCUINTREG fSavedEfl; 654 655 /* 656 * Refuse all I/O control calls if we've ever detected EFLAGS.AC being cleared. 657 * 658 * This isn't a problem, as there is absolutely nothing in the kernel context that 659 * depend on user context triggering cleanups. That would be pretty wild, right? 660 */ 661 if (RT_UNLIKELY(g_DevExt.cBadContextCalls > 0)) 662 { 663 SUPR0Printf("VBoxDrvDarwinIOCtl: EFLAGS.AC=0 detected %u times, refusing all I/O controls!\n", g_DevExt.cBadContextCalls); 664 return EDEVERR; 665 } 666 667 fSavedEfl = ASMAddFlags(X86_EFL_AC); 668 # else 669 stac(); 670 # endif 652 671 653 672 /* … … 660 679 || uCmd == SUP_IOCTL_FAST_DO_NOP) 661 680 && pSession->fUnrestricted == true)) 662 {663 stac();664 681 rc = supdrvIOCtlFast(uCmd, ulArg, &g_DevExt, pSession); 665 clac(); 666 return rc; 667 } 668 return VBoxDrvLinuxIOCtlSlow(pFilp, uCmd, ulArg, pSession); 669 682 else 683 rc = VBoxDrvLinuxIOCtlSlow(pFilp, uCmd, ulArg, pSession); 670 684 #else /* !HAVE_UNLOCKED_IOCTL */ 671 685 unlock_kernel(); … … 678 692 rc = VBoxDrvLinuxIOCtlSlow(pFilp, uCmd, ulArg, pSession); 679 693 lock_kernel(); 694 #endif /* !HAVE_UNLOCKED_IOCTL */ 695 696 #if defined(VBOX_STRICT) || defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV) 697 /* 698 * Before we restore AC and the rest of EFLAGS, check if the IOCtl handler code 699 * accidentially modified it or some other important flag. 700 */ 701 if (RT_UNLIKELY( (ASMGetFlags() & (X86_EFL_AC | X86_EFL_IF | X86_EFL_DF | X86_EFL_IOPL)) 702 != ((fSavedEfl & (X86_EFL_AC | X86_EFL_IF | X86_EFL_DF | X86_EFL_IOPL)) | X86_EFL_AC) )) 703 { 704 char szTmp[48]; 705 RTStrPrintf(szTmp, sizeof(szTmp), "uCmd=%#x: %#x->%#x!", uCmd, (uint32_t)fSavedEfl, (uint32_t)ASMGetFlags()); 706 supdrvBadContext(&g_DevExt, "SUPDrv-linux.c", __LINE__, szTmp); 707 } 708 ASMSetFlags(fSavedEfl); 709 #else 710 clac(); 711 #endif 680 712 return rc; 681 #endif /* !HAVE_UNLOCKED_IOCTL */682 713 } 683 714 … … 746 777 * Process the IOCtl. 747 778 */ 748 stac();749 779 rc = supdrvIOCtl(uCmd, &g_DevExt, pSession, pHdr, cbBuf); 750 clac();751 780 752 781 /*
Note:
See TracChangeset
for help on using the changeset viewer.