diff options
author | Jan Vorlicek <jan.vorlicek@volny.cz> | 2021-06-12 10:54:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-12 10:54:58 +0300 |
commit | cc6d3147ff1f10d2ee2b0751cf799fc4cc1abbae (patch) | |
tree | 6f152bfc4ba7880faff9b2189e25d6b85743771a /src/coreclr/inc | |
parent | 2a011f802b83051d1381f7800131ca5734b4c59e (diff) |
Unify macOS ARM64 write protection holders with W^X ones (#54067)
* Unify macOS ARM64 write protection holders with W^X ones
This change removes the original holders that were added for changing
memory protection for executable code and moves the actual switching to
the recently added W^X holders.
The unixexports files don't support target specific symbols. So I needed
to export a dummy version of the PAL_JitWriteProtect for macOS x64.
Diffstat (limited to 'src/coreclr/inc')
-rw-r--r-- | src/coreclr/inc/executableallocator.h | 11 | ||||
-rw-r--r-- | src/coreclr/inc/loaderheap.h | 8 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/coreclr/inc/executableallocator.h b/src/coreclr/inc/executableallocator.h index 6a2cecda085..c71f613dbe5 100644 --- a/src/coreclr/inc/executableallocator.h +++ b/src/coreclr/inc/executableallocator.h @@ -30,7 +30,13 @@ class ExecutableWriterHolder void Unmap() { - // TODO: this will be added with the double mapped allocator addition + if (m_addressRX != NULL) + { + // TODO: mapping / unmapping for targets using double memory mapping will be added with the double mapped allocator addition +#if defined(HOST_OSX) && defined(HOST_ARM64) + PAL_JitWriteProtect(false); +#endif + } } public: @@ -57,6 +63,9 @@ public: { m_addressRX = addressRX; m_addressRW = addressRX; +#if defined(HOST_OSX) && defined(HOST_ARM64) + PAL_JitWriteProtect(true); +#endif } ~ExecutableWriterHolder() diff --git a/src/coreclr/inc/loaderheap.h b/src/coreclr/inc/loaderheap.h index 2dc156572b4..ac0669a5586 100644 --- a/src/coreclr/inc/loaderheap.h +++ b/src/coreclr/inc/loaderheap.h @@ -554,10 +554,6 @@ private: { WRAPPER_NO_CONTRACT; -#if defined(HOST_OSX) && defined(HOST_ARM64) - auto jitWriteEnableHolder = PAL_JITWriteEnable(true); -#endif // defined(HOST_OSX) && defined(HOST_ARM64) - void *pResult; TaggedMemAllocPtr tmap; @@ -634,10 +630,6 @@ public: { WRAPPER_NO_CONTRACT; -#if defined(HOST_OSX) && defined(HOST_ARM64) - auto jitWriteEnableHolder = PAL_JITWriteEnable(true); -#endif // defined(HOST_OSX) && defined(HOST_ARM64) - CRITSEC_Holder csh(m_CriticalSection); |