diff options
-rw-r--r-- | src/vm/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/vm/crossgen/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/vm/pefingerprint.cpp | 66 | ||||
-rw-r--r-- | src/vm/pefingerprint.h | 37 | ||||
-rw-r--r-- | src/vm/peimage.h | 1 | ||||
-rw-r--r-- | src/vm/peimagelayout.cpp | 18 |
6 files changed, 0 insertions, 124 deletions
diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt index f6396795b0..b7b9d2259f 100644 --- a/src/vm/CMakeLists.txt +++ b/src/vm/CMakeLists.txt @@ -224,7 +224,6 @@ set(VM_SOURCES_WKS nativeoverlapped.cpp objectlist.cpp olevariant.cpp - pefingerprint.cpp pendingload.cpp profattach.cpp profattachclient.cpp diff --git a/src/vm/crossgen/CMakeLists.txt b/src/vm/crossgen/CMakeLists.txt index 8c706885b8..fe1f7a38c9 100644 --- a/src/vm/crossgen/CMakeLists.txt +++ b/src/vm/crossgen/CMakeLists.txt @@ -58,7 +58,6 @@ set(VM_CROSSGEN_SOURCES ../dllimport.cpp ../dllimportcallback.cpp ../pefile.cpp - ../pefingerprint.cpp ../peimage.cpp ../peimagelayout.cpp ../pendingload.cpp diff --git a/src/vm/pefingerprint.cpp b/src/vm/pefingerprint.cpp deleted file mode 100644 index b02e8a30bb..0000000000 --- a/src/vm/pefingerprint.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// -------------------------------------------------------------------------------- -// PEFingerprint.cpp -// - -// -// -// Dev11 note on timing of torn state detection: -// -// This implementation of PEFingerprint contains a known flaw: The MVID/SNHash/TPBand -// torn state test only occurs after the file is already opened and made available -// for the runtime to use. In fact, we don't do it until someone asks for a Commit -// on the fingerprint. -// -// This is clearly a perversion of the design: however, it was not feasible -// to do the check beforehand within the current codebase without incurring -// severe performance costs or major code surgery. -// -// For Dev11, however, we accept this because of two things: -// -// - GAC assemblies are installed through gacutil.exe which always timestamps -// the assembly based on the time of install. Thus, timestamp collisions -// inside the GAC should not happen unless someone manually tampers with the GAC. -// Since we do verify the timestamp and lock the file before opening it, -// it is not a problem that the actual mvid/snhash check happens later than it should. -// -------------------------------------------------------------------------------- - - - -#include "common.h" -#include "pefile.h" -#include "pefingerprint.h" - - - - - -//================================================================================== -// This holder must be wrapped around any code that opens an IL image. -// It will verify that the actual fingerprint doesn't conflict with the stored -// assumptions in the PEFingerprint. (If it does, the holder constructor throws -// a torn state exception.) -// -// It is a holder because it needs to keep a file handle open to prevent -// anyone from overwriting the IL after the check has been done. Once -// you've opened the "real" handle to the IL (i.e. LoadLibrary/CreateFile), -// you can safely destruct the holder. -//================================================================================== -PEFingerprintVerificationHolder::PEFingerprintVerificationHolder(PEImage *owner) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - MODE_ANY; - SO_INTOLERANT; - INJECT_FAULT(COMPlusThrowOM();); - } - CONTRACTL_END - - return; -} - - diff --git a/src/vm/pefingerprint.h b/src/vm/pefingerprint.h deleted file mode 100644 index 8db8df729a..0000000000 --- a/src/vm/pefingerprint.h +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. -// -------------------------------------------------------------------------------- -// PEFingerprint.h -// - -// -------------------------------------------------------------------------------- - -#ifndef PEFINGERPRINT_H_ -#define PEFINGERPRINT_H_ - - - - -//================================================================================== -// This holder must be wrapped around any code that opens an IL image. -// It will verify that the actual fingerprint doesn't conflict with the stored -// assumptions in the PEFingerprint. (If it does, the holder constructor throws -// a torn state exception.) -// -// It is a holder because it needs to keep a file handle open to prevent -// anyone from overwriting the IL after the check has been done. Once -// you've opened the "real" handle to the IL (i.e. LoadLibrary/CreateFile), -// you can safely destruct the holder. -//================================================================================== -class PEFingerprintVerificationHolder -{ - public: - PEFingerprintVerificationHolder(PEImage *owner); - - private: - FileHandleHolder m_fileHandle; -}; - - -#endif //PEFINGERPRINT diff --git a/src/vm/peimage.h b/src/vm/peimage.h index e77a474c2d..a767c70342 100644 --- a/src/vm/peimage.h +++ b/src/vm/peimage.h @@ -19,7 +19,6 @@ #include "peimagelayout.h" #include "sstring.h" #include "holder.h" -#include "pefingerprint.h" class SimpleRWLock; // -------------------------------------------------------------------------------- diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp index 2096a9bcb8..034b30ed38 100644 --- a/src/vm/peimagelayout.cpp +++ b/src/vm/peimagelayout.cpp @@ -8,7 +8,6 @@ #include "common.h" #include "peimagelayout.h" #include "peimagelayout.inl" -#include "pefingerprint.h" #ifndef DACCESS_COMPILE PEImageLayout* PEImageLayout::CreateFlat(const void *flat, COUNT_T size,PEImage* pOwner) @@ -270,9 +269,6 @@ RawImageLayout::RawImageLayout(const void *flat, COUNT_T size,PEImage* pOwner) m_pOwner=pOwner; m_Layout=LAYOUT_FLAT; - PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it. - - if (size) { HandleHolder mapping(WszCreateFileMapping(INVALID_HANDLE_VALUE, NULL, @@ -303,9 +299,6 @@ RawImageLayout::RawImageLayout(const void *mapped, PEImage* pOwner, BOOL bTakeOw m_pOwner=pOwner; m_Layout=LAYOUT_MAPPED; - PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it. - - if (bTakeOwnership) { #ifndef FEATURE_PAL @@ -333,9 +326,6 @@ ConvertedImageLayout::ConvertedImageLayout(PEImageLayout* source) m_Layout=LAYOUT_LOADED; m_pOwner=source->m_pOwner; _ASSERTE(!source->IsMapped()); - - PEFingerprintVerificationHolder verifyHolder(source->m_pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it. - if (!source->HasNTHeaders()) EEFileLoadException::Throw(GetPath(), COR_E_BADIMAGEFORMAT); @@ -381,8 +371,6 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner) // If mapping was requested, try to do SEC_IMAGE mapping LOG((LF_LOADER, LL_INFO100, "PEImage: Opening OS mapped %S (hFile %p)\n", (LPCWSTR) GetPath(), hFile)); - PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it. - #ifndef FEATURE_PAL @@ -532,9 +520,6 @@ LoadedImageLayout::LoadedImageLayout(PEImage* pOwner, BOOL bNTSafeLoad, BOOL bTh m_Layout=LAYOUT_LOADED; m_pOwner=pOwner; - PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it. - - DWORD dwFlags = GetLoadWithAlteredSearchPathFlag(); if (bNTSafeLoad) dwFlags|=DONT_RESOLVE_DLL_REFERENCES; @@ -569,9 +554,6 @@ FlatImageLayout::FlatImageLayout(HANDLE hFile, PEImage* pOwner) m_pOwner=pOwner; LOG((LF_LOADER, LL_INFO100, "PEImage: Opening flat %S\n", (LPCWSTR) GetPath())); - PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it. - - COUNT_T size = SafeGetFileSize(hFile, NULL); if (size == 0xffffffff && GetLastError() != NOERROR) { |