From 348075e2077a9217f62bb956e54257ba2ce76716 Mon Sep 17 00:00:00 2001 From: Laurent Goujon Date: Thu, 17 Oct 2024 10:19:49 -0700 Subject: [PATCH] Fix native libraries relocation Native libraries used by conscrypt and grpc/netty are not relocated to a different name although their counterpart java classes are. This may cause a conflict with applications using the same dependencies but possibly different versions up to a JVM crash. Modify maven-shade-plugin relocation configuration to rename the libraries using snowflake shade base: * relocate grpc/netty tcnative and epoll libraries (note that Netty java loader detects relocation automatically as long as the base is the same for the java classes and the native library (minus dot '.' being replaced with underscore '_')) * relocate conscrypt native library and change the prefix used to find the library in NativeCryptoJni class --- FIPS/pom.xml | 28 ++++++++++++++++++++++++++++ parent-pom.xml | 1 + pom.xml | 28 ++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/FIPS/pom.xml b/FIPS/pom.xml index 0b874551d..b8efd8c05 100644 --- a/FIPS/pom.xml +++ b/FIPS/pom.xml @@ -510,6 +510,22 @@ io.grpc ${shadeBase}.grpc + + META-INF.native.io_grpc_netty_shaded_netty_tcnative + META-INF.native.${shadeNativeBase}_grpc_netty_shaded_netty_tcnative + + + META-INF.native.libio_grpc_netty_shaded_netty_tcnative + META-INF.native.lib${shadeNativeBase}_grpc_netty_shaded_netty_tcnative + + + META-INF.native.io_grpc_netty_shaded_netty_transport_native_epoll + META-INF.native.${shadeNativeBase}_grpc_netty_shaded_netty_transport_native_epoll + + + META-INF.native.libio_grpc_netty_shaded_netty_transport_native_epoll + META-INF.native.lib${shadeNativeBase}_grpc_netty_shaded_netty_transport_native_epoll + org.checkerframework ${shadeBase}.org.checkerframework @@ -526,6 +542,18 @@ org.conscrypt ${shadeBase}.org.conscrypt + + conscrypt_openjdk_jni + ${shadeNativeBase}_conscrypt_openjdk_jni + + + META-INF.native.conscrypt_openjdk_jni + META-INF.native.${shadeNativeBase}_conscrypt_openjdk_jni + + + META-INF.native.libconscrypt_openjdk_jni + META-INF.native.lib${shadeNativeBase}_conscrypt_openjdk_jni + opencensus ${shadeBase}.opencensus diff --git a/parent-pom.xml b/parent-pom.xml index d69c49cbf..1e5aac29c 100644 --- a/parent-pom.xml +++ b/parent-pom.xml @@ -75,6 +75,7 @@ UTF-8 net/snowflake/client/jdbc/internal net.snowflake.client.jdbc.internal + net_snowflake_client_jdbc_internal 2.0.13 5.1.4 net.snowflake.client.category.AllTestCategory diff --git a/pom.xml b/pom.xml index 45e57505b..0f34e2953 100644 --- a/pom.xml +++ b/pom.xml @@ -943,6 +943,22 @@ io.grpc ${shadeBase}.grpc + + META-INF.native.io_grpc_netty_shaded_netty_tcnative + META-INF.native.${shadeNativeBase}_grpc_netty_shaded_netty_tcnative + + + META-INF.native.libio_grpc_netty_shaded_netty_tcnative + META-INF.native.lib${shadeNativeBase}_grpc_netty_shaded_netty_tcnative + + + META-INF.native.io_grpc_netty_shaded_netty_transport_native_epoll + META-INF.native.${shadeNativeBase}_grpc_netty_shaded_netty_transport_native_epoll + + + META-INF.native.libio_grpc_netty_shaded_netty_transport_native_epoll + META-INF.native.lib${shadeNativeBase}_grpc_netty_shaded_netty_transport_native_epoll + org.checkerframework ${shadeBase}.org.checkerframework @@ -959,6 +975,18 @@ org.conscrypt ${shadeBase}.org.conscrypt + + conscrypt_openjdk_jni + ${shadeNativeBase}_conscrypt_openjdk_jni + + + META-INF.native.conscrypt_openjdk_jni + META-INF.native.${shadeNativeBase}_conscrypt_openjdk_jni + + + META-INF.native.libconscrypt_openjdk_jni + META-INF.native.lib${shadeNativeBase}_conscrypt_openjdk_jni + opencensus ${shadeBase}.opencensus