Browse Source

Enforce W^X on macro jit

pull/3092/head
lizzie 4 weeks ago
committed by crueter
parent
commit
73ba54bd29
  1. 12
      src/video_core/macro/macro_jit_x64.cpp

12
src/video_core/macro/macro_jit_x64.cpp

@ -44,10 +44,20 @@ std::bitset<32> PersistentCallerSavedRegs() {
return PERSISTENT_REGISTERS & Common::X64::ABI_ALL_CALLER_SAVED; return PERSISTENT_REGISTERS & Common::X64::ABI_ALL_CALLER_SAVED;
} }
/// @brief Must enforce W^X constraints, as we yet don't havea global "NO_EXECUTE" support flag
/// the speed loss is minimal, and in fact may be negligible, however for your peace of mind
/// I simply included known OSes whom had W^X issues
#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
static const auto default_cg_mode = Xbyak::DontSetProtectRWE;
#else
static const auto default_cg_mode = nullptr; //Allow RWE
#endif
class MacroJITx64Impl final : public Xbyak::CodeGenerator, public CachedMacro { class MacroJITx64Impl final : public Xbyak::CodeGenerator, public CachedMacro {
public: public:
explicit MacroJITx64Impl(Engines::Maxwell3D& maxwell3d_, const std::vector<u32>& code_) explicit MacroJITx64Impl(Engines::Maxwell3D& maxwell3d_, const std::vector<u32>& code_)
: CodeGenerator{MAX_CODE_SIZE}, code{code_}, maxwell3d{maxwell3d_} {
: Xbyak::CodeGenerator(MAX_CODE_SIZE, default_cg_mode)
, code{code_}, maxwell3d{maxwell3d_} {
Compile(); Compile();
} }

Loading…
Cancel
Save