diff options
author | jfrijters <jfrijters> | 2010-04-12 10:38:46 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2010-04-12 10:38:46 +0400 |
commit | 6e4ffb2002916e69ab8eda7a767cf419a066f690 (patch) | |
tree | 93598f31ecf623b0f1120244e3601e41f5054733 | |
parent | c8619421d135de75606559850a2ee678ca6c9933 (diff) |
Prep for .NET 4.0 security model:
- added more SecurityCritical attributes
- added SecuritySafeCritical/TreatAsSafe attributes to Direct-X-Buffer classes
-rw-r--r-- | openjdk/java/io/FileDescriptor.java | 2 | ||||
-rw-r--r-- | openjdk/java/nio/Bits.java | 48 | ||||
-rw-r--r-- | openjdk/map.xml | 469 | ||||
-rw-r--r-- | openjdk/sun/misc/Unsafe.java | 21 | ||||
-rw-r--r-- | runtime/MemberWrapper.cs | 5 | ||||
-rw-r--r-- | runtime/openjdk.cs | 4 |
6 files changed, 548 insertions, 1 deletions
diff --git a/openjdk/java/io/FileDescriptor.java b/openjdk/java/io/FileDescriptor.java index 1d2820d7..7b7f8e26 100644 --- a/openjdk/java/io/FileDescriptor.java +++ b/openjdk/java/io/FileDescriptor.java @@ -64,6 +64,7 @@ public final class FileDescriptor { @ikvm.lang.Property(get = "get_fd") private int fd; + @cli.System.Security.SecurityCriticalAttribute.Annotation private long get_handle() { if (ikvm.internal.Util.WINDOWS) @@ -89,6 +90,7 @@ public final class FileDescriptor { return -1; } + @cli.System.Security.SecurityCriticalAttribute.Annotation private int get_fd() { if (!ikvm.internal.Util.WINDOWS) diff --git a/openjdk/java/nio/Bits.java b/openjdk/java/nio/Bits.java index 8d7e025d..2673ed71 100644 --- a/openjdk/java/nio/Bits.java +++ b/openjdk/java/nio/Bits.java @@ -75,6 +75,7 @@ class Bits { // package-private bb._get(bi + 0)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static char getCharL(long a) { return makeChar(_get(a + 1), _get(a + 0)); @@ -85,6 +86,7 @@ class Bits { // package-private bb._get(bi + 1)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static char getCharB(long a) { return makeChar(_get(a + 0), _get(a + 1)); @@ -94,6 +96,7 @@ class Bits { // package-private return (bigEndian ? getCharB(bb, bi) : getCharL(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static char getChar(long a, boolean bigEndian) { return (bigEndian ? getCharB(a) : getCharL(a)); } @@ -106,6 +109,7 @@ class Bits { // package-private bb._put(bi + 1, char1(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putCharL(long a, char x) { _put(a + 0, char0(x)); _put(a + 1, char1(x)); @@ -116,6 +120,7 @@ class Bits { // package-private bb._put(bi + 1, char0(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putCharB(long a, char x) { _put(a + 0, char1(x)); _put(a + 1, char0(x)); @@ -128,6 +133,7 @@ class Bits { // package-private putCharL(bb, bi, x); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putChar(long a, char x, boolean bigEndian) { if (bigEndian) putCharB(a, x); @@ -147,6 +153,7 @@ class Bits { // package-private bb._get(bi + 0)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static short getShortL(long a) { return makeShort(_get(a + 1), _get(a)); @@ -157,6 +164,7 @@ class Bits { // package-private bb._get(bi + 1)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static short getShortB(long a) { return makeShort(_get(a), _get(a + 1)); @@ -166,6 +174,7 @@ class Bits { // package-private return (bigEndian ? getShortB(bb, bi) : getShortL(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static short getShort(long a, boolean bigEndian) { return (bigEndian ? getShortB(a) : getShortL(a)); } @@ -178,6 +187,7 @@ class Bits { // package-private bb._put(bi + 1, short1(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putShortL(long a, short x) { _put(a, short0(x)); _put(a + 1, short1(x)); @@ -188,6 +198,7 @@ class Bits { // package-private bb._put(bi + 1, short0(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putShortB(long a, short x) { _put(a, short1(x)); _put(a + 1, short0(x)); @@ -200,6 +211,7 @@ class Bits { // package-private putShortL(bb, bi, x); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putShort(long a, short x, boolean bigEndian) { if (bigEndian) putShortB(a, x); @@ -224,6 +236,7 @@ class Bits { // package-private bb._get(bi + 0)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static int getIntL(long a) { return makeInt(_get(a + 3), _get(a + 2), @@ -238,6 +251,7 @@ class Bits { // package-private bb._get(bi + 3)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static int getIntB(long a) { return makeInt(_get(a + 0), _get(a + 1), @@ -249,6 +263,7 @@ class Bits { // package-private return (bigEndian ? getIntB(bb, bi) : getIntL(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static int getInt(long a, boolean bigEndian) { return (bigEndian ? getIntB(a) : getIntL(a)); } @@ -265,6 +280,7 @@ class Bits { // package-private bb._put(bi + 0, int0(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putIntL(long a, int x) { _put(a + 3, int3(x)); _put(a + 2, int2(x)); @@ -279,6 +295,7 @@ class Bits { // package-private bb._put(bi + 3, int0(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putIntB(long a, int x) { _put(a + 0, int3(x)); _put(a + 1, int2(x)); @@ -293,6 +310,7 @@ class Bits { // package-private putIntL(bb, bi, x); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putInt(long a, int x, boolean bigEndian) { if (bigEndian) putIntB(a, x); @@ -327,6 +345,7 @@ class Bits { // package-private bb._get(bi + 0)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static long getLongL(long a) { return makeLong(_get(a + 7), _get(a + 6), @@ -349,6 +368,7 @@ class Bits { // package-private bb._get(bi + 7)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static long getLongB(long a) { return makeLong(_get(a + 0), _get(a + 1), @@ -364,6 +384,7 @@ class Bits { // package-private return (bigEndian ? getLongB(bb, bi) : getLongL(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static long getLong(long a, boolean bigEndian) { return (bigEndian ? getLongB(a) : getLongL(a)); } @@ -388,6 +409,7 @@ class Bits { // package-private bb._put(bi + 0, long0(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putLongL(long a, long x) { _put(a + 7, long7(x)); _put(a + 6, long6(x)); @@ -410,6 +432,7 @@ class Bits { // package-private bb._put(bi + 7, long0(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putLongB(long a, long x) { _put(a + 0, long7(x)); _put(a + 1, long6(x)); @@ -428,6 +451,7 @@ class Bits { // package-private putLongL(bb, bi, x); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putLong(long a, long x, boolean bigEndian) { if (bigEndian) putLongB(a, x); @@ -442,6 +466,7 @@ class Bits { // package-private return Float.intBitsToFloat(getIntL(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static float getFloatL(long a) { return Float.intBitsToFloat(getIntL(a)); } @@ -450,6 +475,7 @@ class Bits { // package-private return Float.intBitsToFloat(getIntB(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static float getFloatB(long a) { return Float.intBitsToFloat(getIntB(a)); } @@ -458,6 +484,7 @@ class Bits { // package-private return (bigEndian ? getFloatB(bb, bi) : getFloatL(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static float getFloat(long a, boolean bigEndian) { return (bigEndian ? getFloatB(a) : getFloatL(a)); } @@ -466,6 +493,7 @@ class Bits { // package-private putIntL(bb, bi, Float.floatToRawIntBits(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putFloatL(long a, float x) { putIntL(a, Float.floatToRawIntBits(x)); } @@ -474,6 +502,7 @@ class Bits { // package-private putIntB(bb, bi, Float.floatToRawIntBits(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putFloatB(long a, float x) { putIntB(a, Float.floatToRawIntBits(x)); } @@ -485,6 +514,7 @@ class Bits { // package-private putFloatL(bb, bi, x); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putFloat(long a, float x, boolean bigEndian) { if (bigEndian) putFloatB(a, x); @@ -499,6 +529,7 @@ class Bits { // package-private return Double.longBitsToDouble(getLongL(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static double getDoubleL(long a) { return Double.longBitsToDouble(getLongL(a)); } @@ -507,6 +538,7 @@ class Bits { // package-private return Double.longBitsToDouble(getLongB(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static double getDoubleB(long a) { return Double.longBitsToDouble(getLongB(a)); } @@ -515,6 +547,7 @@ class Bits { // package-private return (bigEndian ? getDoubleB(bb, bi) : getDoubleL(bb, bi)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static double getDouble(long a, boolean bigEndian) { return (bigEndian ? getDoubleB(a) : getDoubleL(a)); } @@ -523,6 +556,7 @@ class Bits { // package-private putLongL(bb, bi, Double.doubleToRawLongBits(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putDoubleL(long a, double x) { putLongL(a, Double.doubleToRawLongBits(x)); } @@ -531,6 +565,7 @@ class Bits { // package-private putLongB(bb, bi, Double.doubleToRawLongBits(x)); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putDoubleB(long a, double x) { putLongB(a, Double.doubleToRawLongBits(x)); } @@ -542,6 +577,7 @@ class Bits { // package-private putDoubleL(bb, bi, x); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void putDouble(long a, double x, boolean bigEndian) { if (bigEndian) putDoubleB(a, x); @@ -554,10 +590,12 @@ class Bits { // package-private private static final Unsafe unsafe = Unsafe.getUnsafe(); + @cli.System.Security.SecurityCriticalAttribute.Annotation private static byte _get(long a) { return unsafe.getByte(a); } + @cli.System.Security.SecurityCriticalAttribute.Annotation private static void _put(long a, byte b) { unsafe.putByte(a, b); } @@ -670,35 +708,45 @@ class Bits { // package-private // result in memory corruption should be done prior to invocation. // All positions and lengths are specified in bytes. + @cli.System.Security.SecurityCriticalAttribute.Annotation static native void copyFromByteArray(Object src, long srcPos, long dstAddr, long length); + @cli.System.Security.SecurityCriticalAttribute.Annotation static native void copyToByteArray(long srcAddr, Object dst, long dstPos, long length); + @cli.System.Security.SecurityCriticalAttribute.Annotation static void copyFromCharArray(Object src, long srcPos, long dstAddr, long length) { copyFromShortArray(src, srcPos, dstAddr, length); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static void copyToCharArray(long srcAddr, Object dst, long dstPos, long length) { copyToShortArray(srcAddr, dst, dstPos, length); } + @cli.System.Security.SecurityCriticalAttribute.Annotation static native void copyFromShortArray(Object src, long srcPos, long dstAddr, long length); + @cli.System.Security.SecurityCriticalAttribute.Annotation static native void copyToShortArray(long srcAddr, Object dst, long dstPos, long length); + @cli.System.Security.SecurityCriticalAttribute.Annotation static native void copyFromIntArray(Object src, long srcPos, long dstAddr, long length); + @cli.System.Security.SecurityCriticalAttribute.Annotation static native void copyToIntArray(long srcAddr, Object dst, long dstPos, long length); + @cli.System.Security.SecurityCriticalAttribute.Annotation static native void copyFromLongArray(Object src, long srcPos, long dstAddr, long length); + @cli.System.Security.SecurityCriticalAttribute.Annotation static native void copyToLongArray(long srcAddr, Object dst, long dstPos, long length); diff --git a/openjdk/map.xml b/openjdk/map.xml index 7cd25011..f71253b5 100644 --- a/openjdk/map.xml +++ b/openjdk/map.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> <!-- - Copyright (C) 2002-2009 Jeroen Frijters + Copyright (C) 2002-2010 Jeroen Frijters This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -2081,6 +2081,473 @@ <ret /> </body> </method> + <constructor sig="(I)V"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </constructor> + <method name="_get" sig="(I)B"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="_put" sig="(IB)V"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="()B"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)B"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([BII)Ljava.nio.ByteBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="getChar" sig="(J)C"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="putChar" sig="(JC)Ljava.nio.ByteBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="getShort" sig="(J)S"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="putShort" sig="(JS)Ljava.nio.ByteBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="getInt" sig="(J)I"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="putInt" sig="(JI)Ljava.nio.ByteBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="getLong" sig="(J)J"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="putLong" sig="(JJ)Ljava.nio.ByteBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="getFloat" sig="(J)F"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="putFloat" sig="(JF)Ljava.nio.ByteBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="getDouble" sig="(J)D"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="putDouble" sig="(JD)Ljava.nio.ByteBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.ByteBuffer;)Ljava.nio.ByteBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(B)Ljava.nio.ByteBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(IB)Ljava.nio.ByteBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([BII)Ljava.nio.ByteBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.ByteBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectByteBuffer$Deallocator"> + <method name="run" sig="()V"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectByteBufferR"> + <method name="_get" sig="(I)B"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectCharBufferS"> + <method name="get" sig="()C"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)C"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([CII)Ljava.nio.CharBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.CharBuffer;)Ljava.nio.CharBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(C)Ljava.nio.CharBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(IC)Ljava.nio.CharBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([CII)Ljava.nio.CharBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.CharBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectCharBufferU"> + <method name="get" sig="()C"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)C"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([CII)Ljava.nio.CharBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.CharBuffer;)Ljava.nio.CharBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(C)Ljava.nio.CharBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(IC)Ljava.nio.CharBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([CII)Ljava.nio.CharBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.CharBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectDoubleBufferS"> + <method name="get" sig="()D"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)D"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([DII)Ljava.nio.DoubleBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.DoubleBuffer;)Ljava.nio.DoubleBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(D)Ljava.nio.DoubleBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(ID)Ljava.nio.DoubleBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([DII)Ljava.nio.DoubleBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.DoubleBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectDoubleBufferU"> + <method name="get" sig="()D"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)D"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([DII)Ljava.nio.DoubleBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.DoubleBuffer;)Ljava.nio.DoubleBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(D)Ljava.nio.DoubleBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(ID)Ljava.nio.DoubleBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([DII)Ljava.nio.DoubleBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.DoubleBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectFloatBufferS"> + <method name="get" sig="()F"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)F"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([FII)Ljava.nio.FloatBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.FloatBuffer;)Ljava.nio.FloatBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(F)Ljava.nio.FloatBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(IF)Ljava.nio.FloatBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([FII)Ljava.nio.FloatBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.FloatBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectFloatBufferU"> + <method name="get" sig="()F"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)F"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([FII)Ljava.nio.FloatBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.FloatBuffer;)Ljava.nio.FloatBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(F)Ljava.nio.FloatBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(IF)Ljava.nio.FloatBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([FII)Ljava.nio.FloatBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.FloatBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectIntBufferS"> + <method name="get" sig="()I"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)I"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([III)Ljava.nio.IntBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.IntBuffer;)Ljava.nio.IntBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(I)Ljava.nio.IntBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(II)Ljava.nio.IntBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([III)Ljava.nio.IntBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.IntBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectIntBufferU"> + <method name="get" sig="()I"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)I"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([III)Ljava.nio.IntBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.IntBuffer;)Ljava.nio.IntBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(I)Ljava.nio.IntBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(II)Ljava.nio.IntBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([III)Ljava.nio.IntBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.IntBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectLongBufferS"> + <method name="get" sig="()J"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)J"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([JII)Ljava.nio.LongBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.LongBuffer;)Ljava.nio.LongBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(J)Ljava.nio.LongBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(IJ)Ljava.nio.LongBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([JII)Ljava.nio.LongBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.LongBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectLongBufferU"> + <method name="get" sig="()J"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)J"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([JII)Ljava.nio.LongBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.LongBuffer;)Ljava.nio.LongBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(J)Ljava.nio.LongBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(IJ)Ljava.nio.LongBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([JII)Ljava.nio.LongBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.LongBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectShortBufferS"> + <method name="get" sig="()S"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)S"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([SII)Ljava.nio.ShortBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.ShortBuffer;)Ljava.nio.ShortBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(S)Ljava.nio.ShortBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(IS)Ljava.nio.ShortBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([SII)Ljava.nio.ShortBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.ShortBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + </class> + <class name="java.nio.DirectShortBufferU"> + <method name="get" sig="()S"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="(I)S"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="get" sig="([SII)Ljava.nio.ShortBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="put" sig="(Ljava.nio.ShortBuffer;)Ljava.nio.ShortBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(S)Ljava.nio.ShortBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="(IS)Ljava.nio.ShortBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> + <method name="put" sig="([SII)Ljava.nio.ShortBuffer;"> + <!-- we use TreasAsSafe + Critical instead of SafeCritical to workaround PEVerify bug on .NET 2.0/3.5 --> + <attribute type="System.Security.SecurityCriticalAttribute" sig="()V" /> + <attribute type="System.Security.SecurityTreatAsSafeAttribute" sig="()V" /> + </method> + <method name="compact" sig="()Ljava.nio.ShortBuffer;"> + <attribute type="System.Security.SecuritySafeCriticalAttribute" sig="()V" /> + </method> </class> <class name="sun.reflect.Reflection"> <!-- we manually hook up this native method, to prevent inlining and tail-call optimizations --> diff --git a/openjdk/sun/misc/Unsafe.java b/openjdk/sun/misc/Unsafe.java index 8f4c949b..ee105f8d 100644 --- a/openjdk/sun/misc/Unsafe.java +++ b/openjdk/sun/misc/Unsafe.java @@ -834,6 +834,7 @@ public final class Unsafe public native void ensureClassInitialized(Class clazz); @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, SerializationFormatter = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public native Object allocateInstance(Class clazz) throws InstantiationException; public int addressSize() @@ -849,6 +850,7 @@ public final class Unsafe // The really unsafe methods start here. They are all have a LinkDemand for unmanaged code. @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public long allocateMemory(long bytes) { try @@ -863,12 +865,14 @@ public final class Unsafe } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void freeMemory(long address) { Marshal.FreeHGlobal(IntPtr.op_Explicit(address)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void setMemory(long address, long bytes, byte value) { while (bytes-- > 0) @@ -878,6 +882,7 @@ public final class Unsafe } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void copyMemory(long srcAddress, long destAddress, long bytes) { while (bytes-- > 0) @@ -887,96 +892,112 @@ public final class Unsafe } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public byte getByte(long address) { return cli.System.Runtime.InteropServices.Marshal.ReadByte(IntPtr.op_Explicit(address)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void putByte(long address, byte x) { cli.System.Runtime.InteropServices.Marshal.WriteByte(IntPtr.op_Explicit(address), x); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public short getShort(long address) { return cli.System.Runtime.InteropServices.Marshal.ReadInt16(IntPtr.op_Explicit(address)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void putShort(long address, short x) { cli.System.Runtime.InteropServices.Marshal.WriteInt16(IntPtr.op_Explicit(address), x); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public char getChar(long address) { return (char)cli.System.Runtime.InteropServices.Marshal.ReadInt16(IntPtr.op_Explicit(address)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void putChar(long address, char x) { cli.System.Runtime.InteropServices.Marshal.WriteInt16(IntPtr.op_Explicit(address), (short)x); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public int getInt(long address) { return cli.System.Runtime.InteropServices.Marshal.ReadInt32(IntPtr.op_Explicit(address)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void putInt(long address, int x) { cli.System.Runtime.InteropServices.Marshal.WriteInt32(IntPtr.op_Explicit(address), x); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public long getLong(long address) { return cli.System.Runtime.InteropServices.Marshal.ReadInt64(IntPtr.op_Explicit(address)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void putLong(long address, long x) { cli.System.Runtime.InteropServices.Marshal.WriteInt64(IntPtr.op_Explicit(address), x); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public long getAddress(long address) { return cli.System.Runtime.InteropServices.Marshal.ReadIntPtr(IntPtr.op_Explicit(address)).ToInt64(); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void putAddress(long address, long x) { cli.System.Runtime.InteropServices.Marshal.WriteIntPtr(IntPtr.op_Explicit(address), IntPtr.op_Explicit(x)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public float getFloat(long address) { return Float.intBitsToFloat(getInt(address)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void putFloat(long address, float x) { putInt(address, Float.floatToIntBits(x)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public double getDouble(long address) { return Double.longBitsToDouble(getLong(address)); } @SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true) + @cli.System.Security.SecurityCriticalAttribute.Annotation public void putDouble(long address, double x) { putLong(address, Double.doubleToLongBits(x)); diff --git a/runtime/MemberWrapper.cs b/runtime/MemberWrapper.cs index 5c90f152..d3a35c8a 100644 --- a/runtime/MemberWrapper.cs +++ b/runtime/MemberWrapper.cs @@ -62,6 +62,7 @@ namespace IKVM.Internal private string name; private string sig; + [System.Security.SecurityCritical] private sealed class HandleWrapper { internal readonly IntPtr Value; @@ -102,6 +103,7 @@ namespace IKVM.Internal internal IntPtr Cookie { + [System.Security.SecurityCritical] get { lock(this) @@ -115,6 +117,7 @@ namespace IKVM.Internal } } + [System.Security.SecurityCritical] internal static MemberWrapper FromCookieImpl(IntPtr cookie) { return (MemberWrapper)GCHandle.FromIntPtr(cookie).Target; @@ -597,6 +600,7 @@ namespace IKVM.Internal } #endif // !STATIC_COMPILER && !STUB_GENERATOR + [System.Security.SecurityCritical] internal static MethodWrapper FromCookie(IntPtr cookie) { return (MethodWrapper)FromCookieImpl(cookie); @@ -1290,6 +1294,7 @@ namespace IKVM.Internal } #endif // !STATIC_COMPILER && !STUB_GENERATOR + [System.Security.SecurityCritical] internal static FieldWrapper FromCookie(IntPtr cookie) { return (FieldWrapper)FromCookieImpl(cookie); diff --git a/runtime/openjdk.cs b/runtime/openjdk.cs index 9403eb66..4da85a32 100644 --- a/runtime/openjdk.cs +++ b/runtime/openjdk.cs @@ -3965,6 +3965,7 @@ namespace IKVM.NativeCode.java namespace nio { [System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.LinkDemand, UnmanagedCode = true)] + [System.Security.SecurityCritical] static class Bits { public static void copyFromByteArray(object src, long srcPos, long dstAddr, long length) @@ -5296,6 +5297,7 @@ namespace IKVM.NativeCode.sun.awt.shell } } + [System.Security.SecurityCritical] class ShellLink : IDisposable { [ComImport] @@ -5525,6 +5527,7 @@ namespace IKVM.NativeCode.sun.misc [DllImport("kernel32.dll")] private static extern bool SetConsoleCtrlHandler(ConsoleCtrlDelegate e, bool add); + [System.Security.SecurityCritical] private class CriticalCtrlHandler : System.Runtime.ConstrainedExecution.CriticalFinalizerObject { private ConsoleCtrlDelegate consoleCtrlDelegate; @@ -5728,6 +5731,7 @@ namespace IKVM.NativeCode.sun.misc } } + [System.Security.SecurityCritical] public static object allocateInstance(object thisUnsafe, object clazz) { TypeWrapper wrapper = TypeWrapper.FromClass(clazz); |