nativeoverlapped.cpp
objectlist.cpp
olevariant.cpp
- pefingerprint.cpp
pendingload.cpp
profattach.cpp
profattachclient.cpp
../dllimport.cpp
../dllimportcallback.cpp
../pefile.cpp
- ../pefingerprint.cpp
../peimage.cpp
../peimagelayout.cpp
../pendingload.cpp
+++ /dev/null
-// 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;
-}
-
-
+++ /dev/null
-// 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
#include "peimagelayout.h"
#include "sstring.h"
#include "holder.h"
-#include "pefingerprint.h"
class SimpleRWLock;
// --------------------------------------------------------------------------------
#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)
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,
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
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);
// 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
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;
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)
{