Home Dashboard Directory Help
Search

Instability in .NET Virtual Machine and possible security threat. by Adam_Bienias


Status: 

Closed
 as Deferred Help for as Deferred


4
0
Sign in
to vote
Type: Bug
ID: 787278
Opened: 5/20/2013 5:26:25 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

There's a stability issue in a .NET dynamically generated code. I've attached a small project generating 1 new type with 1 field and 1 method. Placing a breakpoint in ClassField.Initialize method, and trying evaluate in Debug Watch window "this" pointer will result in an error "Cannot obtain value of local or argument '<this>'". In a much larger project if ClassField.Initialize contains plenty of code allocating objects in memory, it will cause whole program to crash after a random period of time in a totaly random places (perhaps Garbage Collector is messing up memory).

The program actually contains a bug which causes this behaviour. In a generated code, there's an Opcode "LDFLDA", instead of "LDFLD". Changing to "LDFLD" fixes the problem, however VM should detect this during method generation to avoid any future instability.
Details
Sign in to post a comment.
Posted by Microsoft on 7/2/2013 at 3:06 PM
Thank you for reporting this issue and using Visual Studio 2012. We'll consider this for a future release of Visual Studio while prioritizing it against other bugs with customer feedback.

If you are interested in adding a verifier into your code the Dynamic Method class documentation has some information in it under the Verification section (http://msdn.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx). If the verifier is turned on for the code attached then you would see an exception thrown “System.Security.VerificationException: Operation could destabilize the runtime”.

Thanks
Carl Brochu | Visual Studio Team
Posted by Microsoft on 5/23/2013 at 10:58 PM
Thanks for your response.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Adam_Bienias on 5/21/2013 at 2:55 PM
I've attached manualy (as Feedback tool was reporting some error while sending) files produced by Feedback Tool. Please note, that crash is from my large project (not the one I've send you) because it's to random to reproduce. Captured crash occured in a GC.Collect() call (see screenshot attached) as "System.ExecutionEngineException".

As an additional note, I was able to reproduce the crash on VS2010 (same .NET 4.5 VM) on a different computer.
Posted by Microsoft on 5/20/2013 at 11:11 PM
Thanks for your feedback. In order to efficiently investigate and reproduce this issue, we are requesting additional information outlined below.

Could you please give us a dump file and call stack so that we can conduct further research?

Visual Studio now has an extension called Microsoft Visual Studio 2012 Feedback Tool, available on the VS gallery(http://visualstudiogallery.msdn.microsoft.com/f8a5aac8-0418-4f88-9d34-bdbe2c4cfe72).

The extension allows you to
1. upload files,
2. collect trace and dump files
3. collect steps while you're repro'ing the issue, as well as
4. SQM logs about VS extensions installed
5. System details (in DxDiag output)

Please submit this information to us within 4 business days. We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 5/20/2013 at 5:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
DynamicCodeBug.zip (restricted) 5/20/2013 -
ScreenShot.jpg (restricted) 5/21/2013 -
VsInfo.xml (restricted) 5/21/2013 -
AutomaticCrashDump5024.dmp (restricted) 5/21/2013 -
ReproSteps.zip (restricted) 5/21/2013 -