[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]Something is broken here, and I don't know what :)
From: |
Gopal V |
Subject: |
Re: [DotGNU]Something is broken here, and I don't know what :) |
Date: |
Sun, 11 Aug 2002 22:18:27 +0530 |
User-agent: |
Mutt/1.2.5i |
Hmmm... a .NET.IL domain ;-)
If memory serves me right, Michael Stolovitzsky wrote:
> Could anyone briefly explain me what are the possible origins of
> "System.Security.VerificationException: Could not verify the code" and what
> is the security verification intended to do?
This exception is thrown when the input IL codes fails the bytecode verifier.
a simple example would be a stack underflow (in IL) Other issues like
typesafety and stack states are checked during verification. I'll explain
more on why pnet uses a verifier (to avoid making this mail looooong)...
As we were talking on IRC , the interface bug is what caused this error
I'm posting a simplified version of this bug ..
I hope you have got an idea of how to debug such an issue ?....
Uncomment the /*#define IL_VERIFY_DEBUG*/ in pnet/engine/verify.c:543
make in the engine dir and try running the ilverify program .
In this case ilverify does not report any bugs ???? ... But ilrun throws
the exception and the VERIFY_ERROR reports the line number and source file
in which it was thrown .. here verify_var.c:294
SingleLinkedList::.ctor [2076] - stloc.0 at verify_var.c:294
Uncaught exception: System.Security.VerificationException: Could not verify the
code
at T..ctor() in test.cs:32
at MainClass.Main() in test.cs:46
I inspected the verify_var.c code and found that the error was actually in
the AssignCompatible() function in verify.c:426
/* Is the type a regular class or an interface? */
if(!ILClass_IsInterface(classInfo))
{
/* Regular class: the value must inherit from the type */
if(ILClassInheritsFrom(classInfo2, classInfo))
{
return 1;
}
/* If "classInfo2" is an interface, then the conversion
is OK if "type" is "System.Object", because all
interfaces inherit from "System.Object", even though
the metadata doesn't explicitly say so */
if(ILClass_IsInterface(classInfo2))
{
return ILTypeIsObjectClass(type);
}
/*fprintf(stdout,"<%s> => <0x%08X>\n",ILClass_Name(classInfo),
ILClassGetAttrs(classInfo));*/
/* The conversion is not OK */
return 0;
}
Eventhough IEnumerator is an interface , ILClass_IsInterface() fails,
further debugging (fprintf) revealed that the Attrs was 0x00000000 instead
of containng 0x00000020 (IL_META_TYPEDEF_INTERFACE)
So there is that bug (and how I debugged it) in detail ...
Sorry , I couldn't find a way to fix it :-(
Gopal
--
The difference between insanity and genius is measured by success
Xenumerator.cs
Description: Text document