VirtualBox

Changeset 106401 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Oct 16, 2024 8:56:01 PM (3 months ago)
Author:
vboxsync
Message:

VMM/IEM: Disable control flow guard for the core IEM jump table call loops. bugref:10720

Location:
trunk/src/VBox/VMM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r106380 r106401  
    157157 * Used by TB code when encountering a non-zero status or rcPassUp after a call.
    158158 */
    159 template <bool const a_fWithIrqCheck>
     159template<bool const a_fWithIrqCheck>
    160160IEM_DECL_NATIVE_HLP_DEF(uintptr_t, iemNativeHlpReturnBreakViaLookup,(PVMCPUCC pVCpu, uint8_t idxTbLookup,
    161161                                                                     uint32_t fFlags, RTGCPHYS GCPhysPc))
     
    1006710067 * @param   pTb     The threaded translation to recompile to native.
    1006810068 */
    10069 DECLHIDDEN(PIEMTB) iemNativeRecompile(PVMCPUCC pVCpu, PIEMTB pTb) RT_NOEXCEPT
     10069IEM_DECL_MSC_GUARD_IGNORE DECLHIDDEN(PIEMTB) iemNativeRecompile(PVMCPUCC pVCpu, PIEMTB pTb) RT_NOEXCEPT
    1007010070{
    1007110071#if 0 /* For profiling the native recompiler code. */
  • trunk/src/VBox/VMM/VMMAll/IEMAllThrdRecompiler.cpp

    r106329 r106401  
    28532853 *                      IEMTB_F_INHIBIT_NMI, IEMTB_F_CS_LIM_CHECKS.
    28542854 */
    2855 static VBOXSTRICTRC iemThreadedCompile(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhysPc, uint32_t fExtraFlags) IEM_NOEXCEPT_MAY_LONGJMP
     2855static IEM_DECL_MSC_GUARD_IGNORE VBOXSTRICTRC
     2856iemThreadedCompile(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhysPc, uint32_t fExtraFlags) IEM_NOEXCEPT_MAY_LONGJMP
    28562857{
    28572858    IEMTLBTRACE_TB_COMPILE(pVCpu, GCPhysPc);
     
    35733574 * @param   pTb     The translation block to execute.
    35743575 */
    3575 static VBOXSTRICTRC iemTbExec(PVMCPUCC pVCpu, PIEMTB pTb) IEM_NOEXCEPT_MAY_LONGJMP
     3576static IEM_DECL_MSC_GUARD_IGNORE VBOXSTRICTRC iemTbExec(PVMCPUCC pVCpu, PIEMTB pTb) IEM_NOEXCEPT_MAY_LONGJMP
    35763577{
    35773578    Assert(!(pVCpu->iem.s.GCPhysInstrBuf & (RTGCPHYS)GUEST_PAGE_OFFSET_MASK));
  • trunk/src/VBox/VMM/VMMAll/IEMAllThrdTables.h

    r106061 r106401  
    403403    return iemThreadedRecompilerMcDeferToCImpl0(pVCpu, a_fFlags, a_fGstShwFlush, a_pfnCImpl)
    404404
    405 DECLINLINE(VBOXSTRICTRC)
     405IEM_DECL_MSC_GUARD_IGNORE  DECLINLINE(VBOXSTRICTRC)
    406406iemThreadedRecompilerMcDeferToCImpl0(PVMCPUCC pVCpu, uint32_t fFlags, uint64_t fGstShwFlush, PFNIEMCIMPL0 pfnCImpl)
    407407{
  • trunk/src/VBox/VMM/include/IEMInternal.h

    r106329 r106401  
    29772977
    29782978
     2979/** @def IEM_DECL_MSC_GUARD_IGNORE
     2980 * Disables control flow guards checks inside a method and any function pointers
     2981 * referenced by it. */
     2982#if defined(_MSC_VER) && !defined(IN_RING0)
     2983# define IEM_DECL_MSC_GUARD_IGNORE  __declspec(guard(ignore))
     2984#else
     2985# define IEM_DECL_MSC_GUARD_IGNORE
     2986#endif
     2987
     2988/** @def IEM_DECL_MSC_GUARD_NONE
     2989 * Disables control flow guards checks inside a method and but continue track
     2990 * function pointers references by it. */
     2991#if defined(_MSC_VER) && !defined(IN_RING0)
     2992# define IEM_DECL_MSC_GUARD_NONE    __declspec(guard(nocf))
     2993#else
     2994# define IEM_DECL_MSC_GUARD_NONE
     2995#endif
     2996
     2997
    29792998/** @def IEM_DECL_IMPL_TYPE
    29802999 * For typedef'ing an instruction implementation function.
     
    30053024    a_RetType (__fastcall a_Name) a_ArgList
    30063025# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
    3007     a_RetType __fastcall a_Name a_ArgList RT_NOEXCEPT
     3026    IEM_DECL_MSC_GUARD_IGNORE a_RetType __fastcall a_Name a_ArgList RT_NOEXCEPT
    30083027# define IEM_DECL_IMPL_PROTO(a_RetType, a_Name, a_ArgList) \
    3009     a_RetType __fastcall a_Name a_ArgList RT_NOEXCEPT
     3028    IEM_DECL_MSC_GUARD_IGNORE a_RetType __fastcall a_Name a_ArgList RT_NOEXCEPT
    30103029
    30113030#elif __cplusplus >= 201700 /* P0012R1 support */
     
    30133032    a_RetType (VBOXCALL a_Name) a_ArgList RT_NOEXCEPT
    30143033# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
    3015     DECL_HIDDEN_ONLY(a_RetType) VBOXCALL a_Name a_ArgList RT_NOEXCEPT
     3034    IEM_DECL_MSC_GUARD_IGNORE DECL_HIDDEN_ONLY(a_RetType) VBOXCALL a_Name a_ArgList RT_NOEXCEPT
    30163035# define IEM_DECL_IMPL_PROTO(a_RetType, a_Name, a_ArgList) \
    3017     DECL_HIDDEN_ONLY(a_RetType) VBOXCALL a_Name a_ArgList RT_NOEXCEPT
     3036    IEM_DECL_MSC_GUARD_IGNORE DECL_HIDDEN_ONLY(a_RetType) VBOXCALL a_Name a_ArgList RT_NOEXCEPT
    30183037
    30193038#else
     
    30213040    a_RetType (VBOXCALL a_Name) a_ArgList
    30223041# define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) \
    3023     DECL_HIDDEN_ONLY(a_RetType) VBOXCALL a_Name a_ArgList
     3042    IEM_DECL_MSC_GUARD_IGNORE DECL_HIDDEN_ONLY(a_RetType) VBOXCALL a_Name a_ArgList
    30243043# define IEM_DECL_IMPL_PROTO(a_RetType, a_Name, a_ArgList) \
    3025     DECL_HIDDEN_ONLY(a_RetType) VBOXCALL a_Name a_ArgList
     3044    IEM_DECL_MSC_GUARD_IGNORE DECL_HIDDEN_ONLY(a_RetType) VBOXCALL a_Name a_ArgList
    30263045
    30273046#endif
     
    53945413typedef VBOXSTRICTRC (* PFNIEMOPRM)(PVMCPUCC pVCpu, uint8_t bRm);
    53955414# define FNIEMOP_DEF(a_Name) \
    5396     IEM_STATIC VBOXSTRICTRC a_Name(PVMCPUCC pVCpu) IEM_NOEXCEPT_MAY_LONGJMP
     5415    IEM_STATIC IEM_DECL_MSC_GUARD_IGNORE VBOXSTRICTRC a_Name(PVMCPUCC pVCpu) IEM_NOEXCEPT_MAY_LONGJMP
    53975416# define FNIEMOP_DEF_1(a_Name, a_Type0, a_Name0) \
    5398     IEM_STATIC VBOXSTRICTRC a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0) IEM_NOEXCEPT_MAY_LONGJMP
     5417    IEM_STATIC IEM_DECL_MSC_GUARD_IGNORE VBOXSTRICTRC a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0) IEM_NOEXCEPT_MAY_LONGJMP
    53995418# define FNIEMOP_DEF_2(a_Name, a_Type0, a_Name0, a_Type1, a_Name1) \
    5400     IEM_STATIC VBOXSTRICTRC a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0, a_Type1 a_Name1) IEM_NOEXCEPT_MAY_LONGJMP
     5419    IEM_STATIC IEM_DECL_MSC_GUARD_IGNORE VBOXSTRICTRC a_Name(PVMCPUCC pVCpu, a_Type0 a_Name0, a_Type1 a_Name1) IEM_NOEXCEPT_MAY_LONGJMP
    54015420
    54025421#endif
     
    67266745typedef FNIEMTHREADEDFUNC *PFNIEMTHREADEDFUNC;
    67276746# define IEM_DECL_IEMTHREADEDFUNC_DEF(a_Name) \
    6728     VBOXSTRICTRC a_Name(PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2) IEM_NOEXCEPT_MAY_LONGJMP
     6747    IEM_DECL_MSC_GUARD_IGNORE VBOXSTRICTRC a_Name(PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2) IEM_NOEXCEPT_MAY_LONGJMP
    67296748# define IEM_DECL_IEMTHREADEDFUNC_PROTO(a_Name) \
    6730     VBOXSTRICTRC a_Name(PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2) IEM_NOEXCEPT_MAY_LONGJMP
     6749    IEM_DECL_MSC_GUARD_IGNORE VBOXSTRICTRC a_Name(PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2) IEM_NOEXCEPT_MAY_LONGJMP
    67316750#endif
    67326751
  • trunk/src/VBox/VMM/include/IEMN8veRecompiler.h

    r106319 r106401  
    21492149 * @see FNIEMNATIVERECOMPFUNC  */
    21502150#define IEM_DECL_IEMNATIVERECOMPFUNC_DEF(a_Name) \
    2151     uint32_t VBOXCALL a_Name(PIEMRECOMPILERSTATE pReNative, uint32_t off, PCIEMTHRDEDCALLENTRY pCallEntry)
     2151    IEM_DECL_MSC_GUARD_IGNORE uint32_t VBOXCALL \
     2152    a_Name(PIEMRECOMPILERSTATE pReNative, uint32_t off, PCIEMTHRDEDCALLENTRY pCallEntry)
    21522153
    21532154/** Prototypes a native recompiler function for a threaded function.
     
    21712172 * @see FNIEMNATIVELIVENESSFUNC  */
    21722173#define IEM_DECL_IEMNATIVELIVENESSFUNC_DEF(a_Name) \
    2173     DECLCALLBACK(void) a_Name(PCIEMTHRDEDCALLENTRY pCallEntry, PCIEMLIVENESSENTRY pIncoming, PIEMLIVENESSENTRY pOutgoing)
     2174    IEM_DECL_MSC_GUARD_IGNORE DECLCALLBACK(void) \
     2175    a_Name(PCIEMTHRDEDCALLENTRY pCallEntry, PCIEMLIVENESSENTRY pIncoming, PIEMLIVENESSENTRY pOutgoing)
    21742176
    21752177/** Prototypes a native recompiler liveness analysis function for a threaded function.
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