VirtualBox

Changeset 93256 in vbox


Ignore:
Timestamp:
Jan 17, 2022 12:14:27 AM (3 years ago)
Author:
vboxsync
Message:

/Config.kmk: Enable /GS for VBOXR3HARDENEDEXE when /guard is also enabled. bugref:10162

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r93255 r93256  
    63146314 TEMPLATE_VBOXR3HARDENEDEXE_SDKS          = VBOX_NTDLL $(TEMPLATE_VBOXR3EXE_SDKS)
    63156315 TEMPLATE_VBOXR3HARDENEDEXE_SDKS.x86      = VBOX_WIN_INT64
    6316  TEMPLATE_VBOXR3HARDENEDEXE_LIBS.x86      = \
    6317         $(PATH_TOOL_$(TEMPLATE_VBOXR3HARDENEDEXE_TOOL.win.x86)_LIB)/chkstk.obj
    6318  TEMPLATE_VBOXR3HARDENEDEXE_CXXFLAGS      = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -GS-
    6319  TEMPLATE_VBOXR3HARDENEDEXE_CXXFLAGS.debug= $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)) -GS- #-O2 -Oy-
    6320  TEMPLATE_VBOXR3HARDENEDEXE_PCHFLAGS      = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_PCHFLAGS)) -GS-
    6321  TEMPLATE_VBOXR3HARDENEDEXE_PCHFLAGS.debug= $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_PCHFLAGS.debug)) -GS- #-O2 -Oy-
    6322  TEMPLATE_VBOXR3HARDENEDEXE_CFLAGS        = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CFLAGS)) -GS-
    6323  TEMPLATE_VBOXR3HARDENEDEXE_CFLAGS.debug  = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CFLAGS.debug)) -GS- -O2 -Oy-
     6316 ifneq ($(VBOX_VCC_LD_GUARD_CF),)
     6317  TEMPLATE_VBOXR3HARDENEDEXE_CXXFLAGS       = $(filter-out -RTC% -GZ,$(TEMPLATE_VBOXR3EXE_CXXFLAGS))
     6318  TEMPLATE_VBOXR3HARDENEDEXE_CXXFLAGS.debug = $(filter-out -RTC% -GZ,$(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)) #-O2 -Oy-
     6319  TEMPLATE_VBOXR3HARDENEDEXE_PCHFLAGS       = $(filter-out -RTC% -GZ,$(TEMPLATE_VBOXR3EXE_PCHFLAGS))
     6320  TEMPLATE_VBOXR3HARDENEDEXE_PCHFLAGS.debug = $(filter-out -RTC% -GZ,$(TEMPLATE_VBOXR3EXE_PCHFLAGS.debug)) #-O2 -Oy-
     6321  TEMPLATE_VBOXR3HARDENEDEXE_CFLAGS         = $(filter-out -RTC% -GZ,$(TEMPLATE_VBOXR3EXE_CFLAGS))
     6322  TEMPLATE_VBOXR3HARDENEDEXE_CFLAGS.debug   = $(filter-out -RTC% -GZ,$(TEMPLATE_VBOXR3EXE_CFLAGS.debug)) -O2 -Oy-
     6323 else
     6324  TEMPLATE_VBOXR3HARDENEDEXE_CXXFLAGS       = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CXXFLAGS)) -GS-
     6325  TEMPLATE_VBOXR3HARDENEDEXE_CXXFLAGS.debug = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CXXFLAGS.debug)) -GS- #-O2 -Oy-
     6326  TEMPLATE_VBOXR3HARDENEDEXE_PCHFLAGS       = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_PCHFLAGS)) -GS-
     6327  TEMPLATE_VBOXR3HARDENEDEXE_PCHFLAGS.debug = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_PCHFLAGS.debug)) -GS- #-O2 -Oy-
     6328  TEMPLATE_VBOXR3HARDENEDEXE_CFLAGS         = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CFLAGS)) -GS-
     6329  TEMPLATE_VBOXR3HARDENEDEXE_CFLAGS.debug   = $(filter-out -RTC% -GZ -GS,$(TEMPLATE_VBOXR3EXE_CFLAGS.debug)) -GS- -O2 -Oy-
     6330 endif
    63246331 TEMPLATE_VBOXR3HARDENEDEXE_LDFLAGS       = $(TEMPLATE_VBOXR3EXE_LDFLAGS) \
    63256332        /DISALLOWLIB:msvcrt$(VBOX_VCC_CRT_TYPE).lib \
  • trunk/src/VBox/HostDrivers/Support/Makefile.kmk

    r93254 r93256  
    438438  ifneq ($(VBOX_VCC_LD_GUARD_CF),)
    439439   SUPR3HardenedStatic_SOURCES.win += \
     440        $(SUPR3HardenedStatic_0_OUTDIR)/loadcfg.obj
     441   # These are for the /guard option.
     442   SUPR3HardenedStatic_SOURCES.win += \
    440443        $(SUPR3HardenedStatic_0_OUTDIR)/loadcfg.obj \
    441444        $(SUPR3HardenedStatic_0_OUTDIR)/gs_cookie.obj \
     
    443446        $(SUPR3HardenedStatic_0_OUTDIR)/guard_dispatch.obj \
    444447        $(SUPR3HardenedStatic_0_OUTDIR)/guard_xfg_dispatch.obj
     448   # These next ones are for supporting the /GS option.  We skip gs_report.obj as it
     449   # import lots from kernel32 and we're better of reporting the problem ourselves.
     450   SUPR3HardenedStatic_SOURCES.win += \
     451        $(SUPR3HardenedStatic_0_OUTDIR)/amdsecgs.obj \
     452        $(SUPR3HardenedStatic_0_OUTDIR)/gshandler.obj
    445453
    446454$$(SUPR3HardenedStatic_0_OUTDIR)/loadcfg.obj \
     
    449457$$(SUPR3HardenedStatic_0_OUTDIR)/guard_dispatch.obj \
    450458$$(SUPR3HardenedStatic_0_OUTDIR)/guard_xfg_dispatch.obj \
     459$$(SUPR3HardenedStatic_0_OUTDIR)/amdsecgs.obj \
     460$$(SUPR3HardenedStatic_0_OUTDIR)/gs_report.obj \
     461$$(SUPR3HardenedStatic_0_OUTDIR)/gshandler.obj \
    451462        : \
    452463                $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/libcmt.lib | $$(dir $$@)
  • trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp

    r93115 r93256  
    485485}
    486486
     487
     488/**
     489 * Called when there is some /GS (or maybe /RTCsu) related stack problem.
     490 *
     491 * We don't want the CRT version living in gshandle.obj, as it uses a lot of
     492 * kernel32 imports, we want to report this error ourselves.
     493 */
     494extern "C" __declspec(noreturn guard(nosspro) guard(nossepi))
     495void __cdecl __report_rangecheckfailure(void)
     496{
     497    supR3HardenedFatal("__report_rangecheckfailure called from %p", ASMReturnAddress());
     498}
     499
     500
     501/**
     502 * Called when there is some /GS problem has been detected.
     503 *
     504 * We don't want the CRT version living in gshandle.obj, as it uses a lot of
     505 * kernel32 imports, we want to report this error ourselves.
     506 */
     507extern "C" __declspec(noreturn guard(nosspro) guard(nossepi))
     508#ifdef RT_ARCH_X86
     509void __cdecl __report_gsfailure(void)
     510#else
     511void __report_gsfailure(uintptr_t uCookie)
     512#endif
     513{
     514#ifdef RT_ARCH_X86
     515    supR3HardenedFatal("__report_gsfailure called from %p", ASMReturnAddress());
     516#else
     517    supR3HardenedFatal("__report_gsfailure called from %p, cookie=%p", ASMReturnAddress(), uCookie);
     518#endif
     519}
    487520
    488521
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