VirtualBox

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
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