Author: kumpera
Date: 2007-12-13 16:26:33 -0500 (Thu, 13 Dec 2007)
New Revision: 91253
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/pedump.c
trunk/mono/mono/metadata/verify.c
trunk/mono/mono/metadata/verify.h
Log:
2007-12-13 Rodrigo Kumpera <[EMAIL PROTECTED]>
* verify.h: new flags to support fail fast of unverifiable code and
do non-strict verification. Non-strict verification is required to
have MS runtime compatibility. There are a huge amount of unverifiable
code that it accepts as verifiable. The strict mode verifies the code
as the specs says.
Non-strict mode will be required in cases where code needs to be
accepted as verifiable but fails under strict mode.
* pedump.c: added support to fail fast and non-strict verification.
* verify.c: added support for both fail fast and non-strict
verification.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-12-13 21:14:39 UTC (rev 91252)
+++ trunk/mono/mono/metadata/ChangeLog 2007-12-13 21:26:33 UTC (rev 91253)
@@ -1,3 +1,18 @@
+2007-12-13 Rodrigo Kumpera <[EMAIL PROTECTED]>
+
+ * verify.h: new flags to support fail fast of unverifiable code and
+ do non-strict verification. Non-strict verification is required to
+ have MS runtime compatibility. There are a huge amount of unverifiable
+ code that it accepts as verifiable. The strict mode verifies the code
+ as the specs says.
+ Non-strict mode will be required in cases where code needs to be
+ accepted as verifiable but fails under strict mode.
+
+ * pedump.c: added support to fail fast and non-strict verification.
+
+ * verify.c: added support for both fail fast and non-strict
verification.
+
+
2007-12-12 Rodrigo Kumpera <[EMAIL PROTECTED]>
* verify.c (is_correct_endfinally): added.
Modified: trunk/mono/mono/metadata/pedump.c
===================================================================
--- trunk/mono/mono/metadata/pedump.c 2007-12-13 21:14:39 UTC (rev 91252)
+++ trunk/mono/mono/metadata/pedump.c 2007-12-13 21:26:33 UTC (rev 91253)
@@ -398,8 +398,8 @@
MonoImage *image;
char *file = NULL;
char *flags = NULL;
- const char *flag_desc [] = {"error", "warn", "cls", "all", "code",
NULL};
- guint flag_vals [] = {MONO_VERIFY_ERROR, MONO_VERIFY_WARNING,
MONO_VERIFY_CLS, MONO_VERIFY_ALL, MONO_VERIFY_ALL + 1};
+ const char *flag_desc [] = {"error", "warn", "cls", "all", "code",
"fail-on-verifiable", "non-strict", NULL};
+ guint flag_vals [] = {MONO_VERIFY_ERROR, MONO_VERIFY_WARNING,
MONO_VERIFY_CLS, MONO_VERIFY_ALL, MONO_VERIFY_ALL + 1, MONO_VERIFY_FAIL_FAST,
MONO_VERIFY_NON_STRICT};
int i;
for (i = 1; i < argc; i++){
Modified: trunk/mono/mono/metadata/verify.c
===================================================================
--- trunk/mono/mono/metadata/verify.c 2007-12-13 21:14:39 UTC (rev 91252)
+++ trunk/mono/mono/metadata/verify.c 2007-12-13 21:26:33 UTC (rev 91253)
@@ -33,6 +33,9 @@
#endif
//////////////////////////////////////////////////////////////////
+#define IS_STRICT_MODE(ctx) (((ctx)->level & MONO_VERIFY_NON_STRICT) == 0)
+#define IS_FAIL_FAST_MODE(ctx) (((ctx)->level & MONO_VERIFY_FAIL_FAST) ==
MONO_VERIFY_FAIL_FAST)
+
#define ADD_VERIFY_INFO(__ctx, __msg, __status) \
do { \
MonoVerifyInfo *vinfo = g_new (MonoVerifyInfo, 1); \
@@ -52,6 +55,8 @@
if ((__ctx)->verifiable) { \
ADD_VERIFY_INFO(__ctx, __msg,
MONO_VERIFY_NOT_VERIFIABLE); \
(__ctx)->verifiable = 0; \
+ if (IS_FAIL_FAST_MODE (__ctx)) \
+ (__ctx)->valid = 0; \
} \
} while (0)
@@ -81,6 +86,7 @@
int max_stack;
int verifiable;
int valid;
+ int level;
int code_size;
ILCodeDesc *code;
@@ -3180,6 +3186,7 @@
ctx.max_args = ctx.signature->param_count + ctx.signature->hasthis;
ctx.max_stack = ctx.header->max_stack;
ctx.verifiable = ctx.valid = 1;
+ ctx.level = level;
ctx.code = g_new0 (ILCodeDesc, ctx.header->code_size);
ctx.code_size = ctx.header->code_size;
Modified: trunk/mono/mono/metadata/verify.h
===================================================================
--- trunk/mono/mono/metadata/verify.h 2007-12-13 21:14:39 UTC (rev 91252)
+++ trunk/mono/mono/metadata/verify.h 2007-12-13 21:26:33 UTC (rev 91253)
@@ -13,6 +13,22 @@
MONO_VERIFY_WARNING,
MONO_VERIFY_CLS = 4,
MONO_VERIFY_ALL = 7,
+
+ /*OR it with other flags*/
+
+ /* Abort the verification if the code is not verifiable.
+ * The standard behavior is to abort if the code is not valid.
+ * */
+ MONO_VERIFY_FAIL_FAST = 16,
+
+
+ /* Perform less verification of the code. This flag should be used
+ * if one wants the verifier to be more compatible to the MS runtime.
+ * Mind that this is not to be more compatible with MS peverify, but
+ * with the runtime itself, that has a less strict verifier.
+ */
+ MONO_VERIFY_NON_STRICT = 32,
+
/* Status signaling code that is not verifiable.*/
MONO_VERIFY_NOT_VERIFIABLE = 8
} MonoVerifyStatus;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches