diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2017-10-09 22:07:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-09 22:07:54 +0200 |
commit | 0a8bd5554a736de337ca6c24eba3de3ec0decfd1 (patch) | |
tree | 6ecb79d3e7f64233d52dcebf5cd0ec239479fc6e | |
parent | ee8da341641e69acd232cc5d873b05605671a61e (diff) | |
download | coreclr-0a8bd5554a736de337ca6c24eba3de3ec0decfd1.tar.gz coreclr-0a8bd5554a736de337ca6c24eba3de3ec0decfd1.tar.bz2 coreclr-0a8bd5554a736de337ca6c24eba3de3ec0decfd1.zip |
Fix zap and ready to run disabling (#14389)
* Fix zap and ready to run disabling
While the COMPlus_ZapDisable and COMPlus_ReadyToRun config settings
can be used to disable using crossgened / ready to run images, loading
IL from such images fails.
This change foxes that.
* Reflect PR feedback
Remove ReadyToRunInfo::IsReadyToRunEnabled from Module::Initialize again
and move the same check in the ReadyToRunInfo::Initialize before we
start checking the PE file properties.
-rw-r--r-- | src/vm/peimagelayout.cpp | 4 | ||||
-rw-r--r-- | src/vm/readytoruninfo.cpp | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp index 94810a0e61..2096a9bcb8 100644 --- a/src/vm/peimagelayout.cpp +++ b/src/vm/peimagelayout.cpp @@ -445,7 +445,7 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner) // if (!HasNativeHeader()) // ThrowHR(COR_E_BADIMAGEFORMAT); - if (HasNativeHeader()) + if (HasNativeHeader() && g_fAllowNativeImages) { if (!IsNativeMachineFormat()) ThrowHR(COR_E_BADIMAGEFORMAT); @@ -501,7 +501,7 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner) if (!HasCorHeader()) ThrowHR(COR_E_BADIMAGEFORMAT); - if (HasNativeHeader() || HasReadyToRunHeader()) + if ((HasNativeHeader() || HasReadyToRunHeader()) && g_fAllowNativeImages) { //Do base relocation for PE, if necessary. if (!IsNativeMachineFormat()) diff --git a/src/vm/readytoruninfo.cpp b/src/vm/readytoruninfo.cpp index 5ac1eb114d..bcb8e8364d 100644 --- a/src/vm/readytoruninfo.cpp +++ b/src/vm/readytoruninfo.cpp @@ -456,6 +456,13 @@ PTR_ReadyToRunInfo ReadyToRunInfo::Initialize(Module * pModule, AllocMemTracker PEFile * pFile = pModule->GetFile(); + if (!IsReadyToRunEnabled()) + { + // Log message is ignored in this case. + DoLog(NULL); + return NULL; + } + // Ignore ReadyToRun for introspection-only loads if (pFile->IsIntrospectionOnly()) { @@ -476,13 +483,6 @@ PTR_ReadyToRunInfo ReadyToRunInfo::Initialize(Module * pModule, AllocMemTracker return NULL; } - if (!IsReadyToRunEnabled()) - { - // Log message is ignored in this case. - DoLog(NULL); - return NULL; - } - if (CORProfilerDisableAllNGenImages() || CORProfilerUseProfileImages()) { DoLog("Ready to Run disabled - profiler disabled native images"); |