.NET Questions regarding JIT compiler/strong-naming security

A reader of my books asked me some .NET Questions regarding JIT compiler/strong-naming security. I thought I’d share his questions and my answers with you:

1.    According to Microsoft documentation the Just In-Time Compiler takes the following attributes of the machine into account when producing the executable code.  Define how these factors alter the output.  For example what is meant by CPU Type, what changes to the OS will affect the output.

·         The version of the .NET Framework.

[JeffRichter] There may be bugs in the JIT that get fixed in a future release or the CLR may add some features that require that the code be produced differently. For example, in Whidbey, the JIT changes has a different way of calling interface methods than it had in Everett because some internal data structures changed.

·         The CPU type (family).

[JeffRichter] The JIT compiler emits code depending on the type of CPU that is in the computer. Obviously code JITted for an x86 CPU will not run on an Itanium (IA64) CPU. But, the JITter can even produce different code for a Pentium 4 versus a Pentium 5.

·         The version of the operating system.

[JeffRichter] The JITter may embed the address of some Win32 APIs in to the native code produced. The address of these APIs could change between different service packs of Windows XP (for example)

·         The exact identity of the assembly (recompilation changes identity).

[JeffRichter] Obviously, if the assembly changes, the code must be re-compiled.

·         The exact identity of all assemblies that the assembly references (recompilation changes identity).

[JeffRichter] The JIT can inline methods contained in one assembly when JIT-compiling a method in another assembly. If the referenced assembly changes, then this may have changed as well and the JITter needs to re-JIT using the new IL code.

·         Security factors.

[JeffRichter] The JIT compiler checks security link demands and inheritance demands when JIT compiling to see if it is allowed to JIT compile.

2.    What guarantees are there that the JIT compiler will produce the exact same executable every time it is run?  How can this be verified?

[JeffRichter] There is no guarantee that this will happen and, in fact, it frequently doesn’t happen. Debug code and release code is completely different, for example.

3.       With Strong named components what security testing has Microsoft done to ensure that another assembly can fake itself out to look like another assembly.

[JeffRichter] Strong-named assemblies are hashed and when the CLR loads them, it verifies the hash to ensure that no bits in the assembly have been changed. If a company’s private key is compromised (leaked), then there is no guarantee of security. Microsoft has tested the has algorithms and has modified strong-name assemblies to test they do not load.

<

p class=”MsoNormal”>

Jeffrey Richter

View Comments

  • Прежде чем прочесть, прошу ответить в опрос Короче, не давно я узнал что всё что я делаю в Microsoft Visual Studio 2003 .NET не будет работать на компе где нету .NET Framework. Типа компилируется в Microsoft Intermediary Language, которое распознаёт только .NET Framework, который при запуске прокраммы запускает JIT (Just-In-Time) compiler который и компилирует в родной язык ОС. Java работает по тому же принципу. Сильно разозлился, стал матерится на фотку Билла Гейтса Потом успокоился, узнал что этот пакет нпходится в интернэте (23МБ) и что он скоро будет на каждом диском с Windows выпущенный Microsoft, и что его можно поставить в установочный пакет в месте с программой.Хочу разузнать у скольких пользователей поставлен .NET Framework и сколько знают что это и откуда взять.Из спецвыпуска Хакера, номер #053, стр. 053-076-3: "Существуют частичные решения проблемы скачивания 24 Мб дистрибутива .NET FW для пользователей. Например, некая фирма RemoteSoft предлагает за абсолютно безумные деньги программу для прилинковки к exe'шнику только тех частей .Net Framework, без которых эта программа не сможет жить. В итоге размер дистрибутива уменьшается эдак до 3-5 Мб, но в фирме люди продуманные, поэтому продают программу по принципу "утром деньги – днем стулья" и даже Trial не предлагают: знают, что русские обязательно поломают ."

Recent Posts

8-Step AWS to Microsoft Azure Migration Strategy

Microsoft Azure and Amazon Web Services (AWS) are two of the most popular cloud platforms.…

5 days ago

How to Navigate Azure Governance

 Cloud management is difficult to do manually, especially if you work with multiple cloud…

2 weeks ago

Why Azure’s Scalability is Your Key to Business Growth & Efficiency

Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…

4 weeks ago

Unlocking the Power of AI in your Software Development Life Cycle (SDLC)

https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…

1 month ago

The Role of FinOps in Accelerating Business Innovation

FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…

1 month ago

Azure Kubernetes Security Best Practices

Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…

2 months ago