[Mono-bugs] [Bug 74036][Nor] New - [PATCH] MCS doesn't union unrestricted permission correctly in a PermissionSet
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Wed, 23 Mar 2005 19:22:57 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by sebastien@ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=74036
--- shadow/74036 2005-03-23 19:22:57.000000000 -0500
+++ shadow/74036.tmp.3049 2005-03-23 19:22:57.000000000 -0500
@@ -0,0 +1,166 @@
+Bug#: 74036
+Product: Mono: Compilers
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: sebastien@ximian.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: [PATCH] MCS doesn't union unrestricted permission correctly in a PermissionSet
+
+Description of Problem:
+MCS doesn't union unrestricted permission correctly in a PermissionSet.
+
+
+Steps to reproduce the problem:
+1. Compile the sample
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+
+[EnvironmentPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+[FileIOPermission (SecurityAction.PermitOnly, Unrestricted = true)]
+class Program {
+
+ static void Main ()
+ {
+ EnvironmentPermission ep = new EnvironmentPermission
+(PermissionState.Unrestricted);
+ FileIOPermission fiop = new FileIOPermission
+(PermissionState.Unrestricted);
+ PermissionSet ps = new PermissionSet (PermissionState.None);
+ ps.AddPermission (ep);
+ ps.AddPermission (fiop);
+ Console.WriteLine (ps);
+ }
+}
+
+
+2. Execute it
+
+% mono unionunrestricted.exe
+<PermissionSet class="System.Security.PermissionSet"
+ version="1">
+ <IPermission class="System.Security.Permissions.EnvironmentPermission,
+mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ version="1"
+ Unrestricted="true"/>
+ <IPermission class="System.Security.Permissions.FileIOPermission,
+mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
+ version="1"
+ Unrestricted="true"/>
+</PermissionSet>
+
+
+3. The resulting permission set is union-ed correctly. Now disassemble the
+assembly with monodis
+
+
+Actual Results:
+...
+ .permissionset permitonly = (
+ 3C 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 // <.P.e.r.m.i.s.s.
+ 69 00 6F 00 6E 00 53 00 65 00 74 00 20 00 63 00 // i.o.n.S.e.t. .c.
+ 6C 00 61 00 73 00 73 00 3D 00 22 00 53 00 79 00 // l.a.s.s.=.".S.y.
+ 73 00 74 00 65 00 6D 00 2E 00 53 00 65 00 63 00 // s.t.e.m...S.e.c.
+ 75 00 72 00 69 00 74 00 79 00 2E 00 50 00 65 00 // u.r.i.t.y...P.e.
+ 72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
+ 53 00 65 00 74 00 22 00 0A 00 20 00 20 00 20 00 // S.e.t."... . . .
+ 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 // . . . . . . . .
+ 20 00 20 00 20 00 20 00 76 00 65 00 72 00 73 00 // . . . .v.e.r.s.
+ 69 00 6F 00 6E 00 3D 00 22 00 31 00 22 00 0A 00 // i.o.n.=.".1."...
+ 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 // . . . . . . . .
+ 20 00 20 00 20 00 20 00 20 00 20 00 20 00 55 00 // . . . . . . .U.
+ 6E 00 72 00 65 00 73 00 74 00 72 00 69 00 63 00 // n.r.e.s.t.r.i.c.
+ 74 00 65 00 64 00 3D 00 22 00 74 00 72 00 75 00 // t.e.d.=.".t.r.u.
+ 65 00 22 00 2F 00 3E 00 0A 00 ) // e."./.>...
+...
+
+
+Expected Results:
+...
+ .permissionset permitonly = (
+ 3C 00 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 // <.P.e.r.m.i.s.s.
+ 69 00 6F 00 6E 00 53 00 65 00 74 00 20 00 63 00 // i.o.n.S.e.t. .c.
+ 6C 00 61 00 73 00 73 00 3D 00 22 00 53 00 79 00 // l.a.s.s.=.".S.y.
+ 73 00 74 00 65 00 6D 00 2E 00 53 00 65 00 63 00 // s.t.e.m...S.e.c.
+ 75 00 72 00 69 00 74 00 79 00 2E 00 50 00 65 00 // u.r.i.t.y...P.e.
+ 72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
+ 53 00 65 00 74 00 22 00 0A 00 20 00 20 00 20 00 // S.e.t."... . . .
+ 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 // . . . . . . . .
+ 20 00 20 00 20 00 20 00 76 00 65 00 72 00 73 00 // . . . .v.e.r.s.
+ 69 00 6F 00 6E 00 3D 00 22 00 31 00 22 00 3E 00 // i.o.n.=.".1.".>.
+ 0A 00 20 00 20 00 20 00 3C 00 49 00 50 00 65 00 // .. . . .<.I.P.e.
+ 72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
+ 20 00 63 00 6C 00 61 00 73 00 73 00 3D 00 22 00 // .c.l.a.s.s.=.".
+ 53 00 79 00 73 00 74 00 65 00 6D 00 2E 00 53 00 // S.y.s.t.e.m...S.
+ 65 00 63 00 75 00 72 00 69 00 74 00 79 00 2E 00 // e.c.u.r.i.t.y...
+ 50 00 65 00 72 00 6D 00 69 00 73 00 73 00 69 00 // P.e.r.m.i.s.s.i.
+ 6F 00 6E 00 73 00 2E 00 45 00 6E 00 76 00 69 00 // o.n.s...E.n.v.i.
+ 72 00 6F 00 6E 00 6D 00 65 00 6E 00 74 00 50 00 // r.o.n.m.e.n.t.P.
+ 65 00 72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 // e.r.m.i.s.s.i.o.
+ 6E 00 2C 00 20 00 6D 00 73 00 63 00 6F 00 72 00 // n.,. .m.s.c.o.r.
+ 6C 00 69 00 62 00 2C 00 20 00 56 00 65 00 72 00 // l.i.b.,. .V.e.r.
+ 73 00 69 00 6F 00 6E 00 3D 00 31 00 2E 00 30 00 // s.i.o.n.=.1...0.
+ 2E 00 35 00 30 00 30 00 30 00 2E 00 30 00 2C 00 // ..5.0.0.0...0.,.
+ 20 00 43 00 75 00 6C 00 74 00 75 00 72 00 65 00 // .C.u.l.t.u.r.e.
+ 3D 00 6E 00 65 00 75 00 74 00 72 00 61 00 6C 00 // =.n.e.u.t.r.a.l.
+ 2C 00 20 00 50 00 75 00 62 00 6C 00 69 00 63 00 // ,. .P.u.b.l.i.c.
+ 4B 00 65 00 79 00 54 00 6F 00 6B 00 65 00 6E 00 // K.e.y.T.o.k.e.n.
+ 3D 00 62 00 37 00 37 00 61 00 35 00 63 00 35 00 // =.b.7.7.a.5.c.5.
+ 36 00 31 00 39 00 33 00 34 00 65 00 30 00 38 00 // 6.1.9.3.4.e.0.8.
+ 39 00 22 00 0A 00 20 00 20 00 20 00 20 00 20 00 // 9."... . . . . .
+ 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 // . . . . . . . .
+ 20 00 20 00 20 00 76 00 65 00 72 00 73 00 69 00 // . . .v.e.r.s.i.
+ 6F 00 6E 00 3D 00 22 00 31 00 22 00 0A 00 20 00 // o.n.=.".1."... .
+ 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 // . . . . . . . .
+ 20 00 20 00 20 00 20 00 20 00 20 00 20 00 55 00 // . . . . . . .U.
+ 6E 00 72 00 65 00 73 00 74 00 72 00 69 00 63 00 // n.r.e.s.t.r.i.c.
+ 74 00 65 00 64 00 3D 00 22 00 74 00 72 00 75 00 // t.e.d.=.".t.r.u.
+ 65 00 22 00 2F 00 3E 00 0A 00 20 00 20 00 20 00 // e."./.>... . . .
+ 3C 00 49 00 50 00 65 00 72 00 6D 00 69 00 73 00 // <.I.P.e.r.m.i.s.
+ 73 00 69 00 6F 00 6E 00 20 00 63 00 6C 00 61 00 // s.i.o.n. .c.l.a.
+ 73 00 73 00 3D 00 22 00 53 00 79 00 73 00 74 00 // s.s.=.".S.y.s.t.
+ 65 00 6D 00 2E 00 53 00 65 00 63 00 75 00 72 00 // e.m...S.e.c.u.r.
+ 69 00 74 00 79 00 2E 00 50 00 65 00 72 00 6D 00 // i.t.y...P.e.r.m.
+ 69 00 73 00 73 00 69 00 6F 00 6E 00 73 00 2E 00 // i.s.s.i.o.n.s...
+ 46 00 69 00 6C 00 65 00 49 00 4F 00 50 00 65 00 // F.i.l.e.I.O.P.e.
+ 72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
+ 2C 00 20 00 6D 00 73 00 63 00 6F 00 72 00 6C 00 // ,. .m.s.c.o.r.l.
+ 69 00 62 00 2C 00 20 00 56 00 65 00 72 00 73 00 // i.b.,. .V.e.r.s.
+ 69 00 6F 00 6E 00 3D 00 31 00 2E 00 30 00 2E 00 // i.o.n.=.1...0...
+ 35 00 30 00 30 00 30 00 2E 00 30 00 2C 00 20 00 // 5.0.0.0...0.,. .
+ 43 00 75 00 6C 00 74 00 75 00 72 00 65 00 3D 00 // C.u.l.t.u.r.e.=.
+ 6E 00 65 00 75 00 74 00 72 00 61 00 6C 00 2C 00 // n.e.u.t.r.a.l.,.
+ 20 00 50 00 75 00 62 00 6C 00 69 00 63 00 4B 00 // .P.u.b.l.i.c.K.
+ 65 00 79 00 54 00 6F 00 6B 00 65 00 6E 00 3D 00 // e.y.T.o.k.e.n.=.
+ 62 00 37 00 37 00 61 00 35 00 63 00 35 00 36 00 // b.7.7.a.5.c.5.6.
+ 31 00 39 00 33 00 34 00 65 00 30 00 38 00 39 00 // 1.9.3.4.e.0.8.9.
+ 22 00 0A 00 20 00 20 00 20 00 20 00 20 00 20 00 // "... . . . . . .
+ 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 // . . . . . . . .
+ 20 00 20 00 76 00 65 00 72 00 73 00 69 00 6F 00 // . .v.e.r.s.i.o.
+ 6E 00 3D 00 22 00 31 00 22 00 0A 00 20 00 20 00 // n.=.".1."... . .
+ 20 00 20 00 20 00 20 00 20 00 20 00 20 00 20 00 // . . . . . . . .
+ 20 00 20 00 20 00 20 00 20 00 20 00 55 00 6E 00 // . . . . . .U.n.
+ 72 00 65 00 73 00 74 00 72 00 69 00 63 00 74 00 // r.e.s.t.r.i.c.t.
+ 65 00 64 00 3D 00 22 00 74 00 72 00 75 00 65 00 // e.d.=.".t.r.u.e.
+ 22 00 2F 00 3E 00 0A 00 3C 00 2F 00 50 00 65 00 // "./.>...<./.P.e.
+ 72 00 6D 00 69 00 73 00 73 00 69 00 6F 00 6E 00 // r.m.i.s.s.i.o.n.
+ 53 00 65 00 74 00 3E 00 0A 00 ) // S.e.t.>...
+...
+
+How often does this happen?
+Always
+
+
+Additional Information:
+See patch