From 6b612302e14af1348ff758d2256d79ff51a04ceb Mon Sep 17 00:00:00 2001 From: lax1dude Date: Thu, 8 Aug 2024 18:19:20 +1000 Subject: [PATCH] #3718, #3717: Add check for SSE 4.2 and PCLMUL support to native zlib --- native/src/main/c/NativeCompressImpl.c | 5 ++++ native/src/main/c/cpuid_helper.h | 22 ++++++++++++++++++ ..._md_5_bungee_jni_zlib_NativeCompressImpl.h | 8 +++++++ .../java/net/md_5/bungee/jni/NativeCode.java | 21 ++++++++++++++++- .../md_5/bungee/jni/NativeCodeException.java | 6 +++++ .../bungee/jni/zlib/NativeCompressImpl.java | 2 ++ .../net/md_5/bungee/jni/zlib/NativeZlib.java | 8 +++++++ native/src/main/resources/native-compress.so | Bin 117320 -> 117408 bytes .../java/net/md_5/bungee/NativeZlibTest.java | 2 +- .../md_5/bungee/compress/CompressFactory.java | 2 +- 10 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 native/src/main/c/cpuid_helper.h diff --git a/native/src/main/c/NativeCompressImpl.c b/native/src/main/c/NativeCompressImpl.c index 7fb8e6b9..b6b27682 100644 --- a/native/src/main/c/NativeCompressImpl.c +++ b/native/src/main/c/NativeCompressImpl.c @@ -3,6 +3,7 @@ #include #include "shared.h" +#include "cpuid_helper.h" #include "net_md_5_bungee_jni_zlib_NativeCompressImpl.h" typedef unsigned char byte; @@ -26,6 +27,10 @@ jint throwException(JNIEnv *env, const char* message, int err) { return (*env)->Throw(env, throwable); } +JNIEXPORT jboolean JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_checkSupported(JNIEnv* env, jobject obj) { + return (jboolean) checkCompressionNativesSupport(); +} + void JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_reset(JNIEnv* env, jobject obj, jlong ctx, jboolean compress) { z_stream* stream = (z_stream*) ctx; int ret = (compress) ? deflateReset(stream) : inflateReset(stream); diff --git a/native/src/main/c/cpuid_helper.h b/native/src/main/c/cpuid_helper.h new file mode 100644 index 00000000..2394ecd6 --- /dev/null +++ b/native/src/main/c/cpuid_helper.h @@ -0,0 +1,22 @@ +// Header to check for SSE 4.2 support in compression natives +// GCC only! + +#ifndef _INCLUDE_CPUID_HELPER_H +#define _INCLUDE_CPUID_HELPER_H + +#include +#include + +static inline bool checkCompressionNativesSupport() { + unsigned int eax; + unsigned int ebx; + unsigned int ecx; + unsigned int edx; + if(__get_cpuid(1, &eax, &ebx, &ecx, &edx)) { + return (ecx & bit_PCLMUL) != 0 && (ecx & bit_SSE4_2) != 0; + }else { + return false; + } +} + +#endif // _INCLUDE_CPUID_HELPER_H diff --git a/native/src/main/c/net_md_5_bungee_jni_zlib_NativeCompressImpl.h b/native/src/main/c/net_md_5_bungee_jni_zlib_NativeCompressImpl.h index befb7dcc..5c73e131 100644 --- a/native/src/main/c/net_md_5_bungee_jni_zlib_NativeCompressImpl.h +++ b/native/src/main/c/net_md_5_bungee_jni_zlib_NativeCompressImpl.h @@ -15,6 +15,14 @@ extern "C" { JNIEXPORT void JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_initFields (JNIEnv *, jclass); +/* + * Class: net_md_5_bungee_jni_zlib_NativeCompressImpl + * Method: checkSupported + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_net_md_15_bungee_jni_zlib_NativeCompressImpl_checkSupported + (JNIEnv *, jobject); + /* * Class: net_md_5_bungee_jni_zlib_NativeCompressImpl * Method: end diff --git a/native/src/main/java/net/md_5/bungee/jni/NativeCode.java b/native/src/main/java/net/md_5/bungee/jni/NativeCode.java index 62bdaa0e..be4d5b0b 100644 --- a/native/src/main/java/net/md_5/bungee/jni/NativeCode.java +++ b/native/src/main/java/net/md_5/bungee/jni/NativeCode.java @@ -15,14 +15,23 @@ public final class NativeCode private final String name; private final Supplier javaImpl; private final Supplier nativeImpl; + private final boolean enableNativeFlag; + private final boolean extendedSupportCheck; // private boolean loaded; public NativeCode(String name, Supplier javaImpl, Supplier nativeImpl) + { + this( name, javaImpl, nativeImpl, false ); + } + + public NativeCode(String name, Supplier javaImpl, Supplier nativeImpl, boolean extendedSupportCheck) { this.name = name; this.javaImpl = javaImpl; this.nativeImpl = nativeImpl; + this.enableNativeFlag = Boolean.parseBoolean( System.getProperty( "net.md_5.bungee.jni." + name + ".enable", "true" ) ); + this.extendedSupportCheck = extendedSupportCheck; } public T newInstance() @@ -32,7 +41,7 @@ public final class NativeCode public boolean load() { - if ( !loaded && isSupported() ) + if ( enableNativeFlag && !loaded && isSupported() ) { String fullName = "bungeecord-" + name; @@ -59,6 +68,13 @@ public final class NativeCode } System.load( temp.getPath() ); + + if ( extendedSupportCheck ) + { + // Should throw NativeCodeException if incompatible + nativeImpl.get(); + } + loaded = true; } catch ( IOException ex ) { @@ -66,6 +82,9 @@ public final class NativeCode } catch ( UnsatisfiedLinkError ex ) { System.out.println( "Could not load native library: " + ex.getMessage() ); + } catch ( NativeCodeException ex ) + { + System.out.println( "Native library " + name + " is incompatible: " + ex.getMessage() ); } } } diff --git a/native/src/main/java/net/md_5/bungee/jni/NativeCodeException.java b/native/src/main/java/net/md_5/bungee/jni/NativeCodeException.java index 1ac8f590..d264675c 100644 --- a/native/src/main/java/net/md_5/bungee/jni/NativeCodeException.java +++ b/native/src/main/java/net/md_5/bungee/jni/NativeCodeException.java @@ -7,4 +7,10 @@ public class NativeCodeException extends RuntimeException { super( message + " : " + reason ); } + + public NativeCodeException(String message) + { + super( message ); + } + } diff --git a/native/src/main/java/net/md_5/bungee/jni/zlib/NativeCompressImpl.java b/native/src/main/java/net/md_5/bungee/jni/zlib/NativeCompressImpl.java index f78caf18..d91f9b58 100644 --- a/native/src/main/java/net/md_5/bungee/jni/zlib/NativeCompressImpl.java +++ b/native/src/main/java/net/md_5/bungee/jni/zlib/NativeCompressImpl.java @@ -15,6 +15,8 @@ public class NativeCompressImpl static native void initFields(); + native boolean checkSupported(); + native void end(long ctx, boolean compress); native void reset(long ctx, boolean compress); diff --git a/native/src/main/java/net/md_5/bungee/jni/zlib/NativeZlib.java b/native/src/main/java/net/md_5/bungee/jni/zlib/NativeZlib.java index e9fe82b8..96e30777 100644 --- a/native/src/main/java/net/md_5/bungee/jni/zlib/NativeZlib.java +++ b/native/src/main/java/net/md_5/bungee/jni/zlib/NativeZlib.java @@ -15,6 +15,14 @@ public class NativeZlib implements BungeeZlib private boolean compress; private long ctx; + public NativeZlib() + { + if ( !nativeCompress.checkSupported() ) + { + throw new NativeCodeException( "This CPU does not support the required SSE 4.2 and/or PCLMUL extensions!" ); + } + } + @Override public void init(boolean compress, int level) { diff --git a/native/src/main/resources/native-compress.so b/native/src/main/resources/native-compress.so index 2ebbfed6137a110f9e9923e101c85d2ea73f9493..181396f1d8460a48af05e7a3605811b5633e5f60 100755 GIT binary patch delta 10528 zcmZu%30zf0`#$gCUI9fGWxFnMK~!)T7p;x*+&V-lTX&r6L!RR;sx+QOn%n)eD;NJ= znR9H>$0z#?oPT5Ui7|h^Z)4ZZPUK*rZap$>@NI(J6gdRhjvR{I3^^QGrk2PN$dSlx zklP}+M~+7BfZQ3m3vw)Sb?UB3&uRm(7jh!9_l@S?-5%t%BQrLOU33euco&RLV|Uz6 zS+`0Y7?&ujZ2<)3M^(6gH3r<8o%Kyt0M&`aBI-&1~ftqT9v z4bOR8m1ih0UWDDx@HJB6RnL2A`)fK*Ykz5H7d*l;cj!5ou|xSV?Rrq#PwB&OP}{%J zO*YYoAx+z7BD9}jGv>&ENGQ6J)n)fJ$_FTWl(sijbCYS@AD}GP5LhNpJ!yaGF`ZWR zjJ3K$+w=<3@r*foOh;T}GK`BVjFF=|db^!6yrttmtL^`m3&F@VjN)+Ra8nEKbW-Kt zbi*&|hD+a8_K^yVAl-1MtID8{p>a(Qz^*RZ{8GTaM=6aDm0ad1Ex_gPbdwLp-*-pQDp;Z6nv9G-R>eExw z(3@d{h()rrq2rTWeuUi01937_1-st<(YxEX~R>P@ni;I@jk;nQI zUG`5)t8W-?#tB`X(n$K7#%Z?Jw~uXXvI-NtO-1+6Q71F<3$jg4QN@`5QKO;8jZx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>( "native-compress", JavaZlib::new, NativeZlib::new ); + private final NativeCode factory = new NativeCode<>( "native-compress", JavaZlib::new, NativeZlib::new, true ); @Test public void doTest() throws DataFormatException diff --git a/proxy/src/main/java/net/md_5/bungee/compress/CompressFactory.java b/proxy/src/main/java/net/md_5/bungee/compress/CompressFactory.java index 2e0c63d1..e4cbbeb7 100644 --- a/proxy/src/main/java/net/md_5/bungee/compress/CompressFactory.java +++ b/proxy/src/main/java/net/md_5/bungee/compress/CompressFactory.java @@ -8,5 +8,5 @@ import net.md_5.bungee.jni.zlib.NativeZlib; public class CompressFactory { - public static final NativeCode zlib = new NativeCode<>( "native-compress", JavaZlib::new, NativeZlib::new ); + public static final NativeCode zlib = new NativeCode<>( "native-compress", JavaZlib::new, NativeZlib::new, true ); }