GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — jni util 0.0.12 by normanmaurer · Pull Request #1039 · netty/netty-tcnative Conversation
Member
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation: We should use weak references to hold global references to our own classes as otherwise it will be not possible to unload the classloader. Modifications: Use weak references for the classes in JNI. Result: No more classloader leaks. Related to netty/netty#13480 Motivation: -DOPENSSL_C11_ATOMIC is not needed anymore for BoringSSL as it uses atomics by default now. Modifications: Remove -DOPENSSL_C11_ATOMIC Result: Cleanup Motivation: Docker images can be quite large, lets try to cleanup things we not need. Modifications: Cleanup things during docker image creation Remove docker layer caching Remove action that free disk space Result: Docker image needs less disk-space Motivation: There was a new maven release Modifications: Upgrade to 3.9.4 Result: Use latest maven release via maven wrapper Motivation: We should use the latest maven-settings-action to fix warnings Modifications: Update maven-settings-action to 2.8.0 Result: No more warnings Motiviation: In the past we removed the usage of apr by static linking against stdc++. While at first this seemed like a good idea it has proven to introduce problems on various platforms. Because of these problems we should better revert the changes and just link against apr again. Modifications: - Revert "Fix memory leak when creating and destroying a lot of context (#790)" fd8fb2a. - Revert "Fix possible corruption / segfault when using atomics (#774)" 11ff708. - Revert "Fix segfault which was caused by not creating the ticket_keys_new atomic (#772)" 196f935. - Revert "Fix format usage" eecaaa8. - Revert "Link libstdc++ statically on linux" a288f03. - Revert "rename functions for consistency" 7ee7804. - Revert "Remove dependency on apr by using c++11 / c++14 features" 8740651. - Update APR version Result: Fixes #798 , #789 Motivation: We should run our testsuite with '-Xcheck:jni' to ensure we catch bugs in our JNI code which could later cause issues like crashes Modifications: - Add -Xcheck:jni Result: Testsuite will be able to catch more JNI bugs Motivation: We dont need to patch APR anymore as the new version we are using is not suffering from the original problem Modifications: Remove build step that patches APR on macOS Result: Build works again on macOS Motivation: There were various updates to the github actions Modifications: Update github actions Result: Cleanup Motivation: We should update the action to eliminate warnings during action run Modifications: Update action to use latest version Result: No more warnings #821) ### Motivation: As discussed in [issue](#799), considering the growing demand for FIPS compliance in security-sensitive environments, an official netty-tcnative release supporting FIPS validation would greatly benefit the open-source community. This would simplify integration and provide a reliable, community-supported solution. ### Setup Configurations: Tools: cmake 3.20, ninja build 1.10.0, clang-12, golang, java 11, maven 3.6.3, libapr1, automake, autoconf, libtool, libunwind-dev, pkg-config Fips validated BoringSSL commit used is 853ca1ea1168dff08011e5d42d94609cc0ca2e27 ### Build Steps: - Run Maven ``` mvn clean install -f boringssl-static/pom.xml -Pfips-boringssl-static ``` - While build is running you should see in logs: ``` ... Boringssl is fips compliant ... ``` - After build steps are completed you should see Jars eg. ``` .m2/repository/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final.jar .m2/repository/io/netty/netty-tcnative-boringssl-static/2.0.61.Final/netty-tcnative-boringssl-static-2.0.61.Final-linux-x86_64.jar ``` ### Modifications: - Added pom profile `fips-boringssl-static` for fips compliant ### Tested on: Tested on linux AMD and ARM machine, which are supported as per FIPS security document attached in reference. Output: https://drive.google.com/file/d/1eAFUIrHLbB7xiTpxHPs__N3Ha_Ltli76/view?usp=sharing ### Reference: Guidance on how to build FIPS validated modules: https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp4407.pdf --------- Co-authored-by: Norman Maurer <[email protected]> Motivation: The name of the config param changed when we updated the version Modifications: Use correct name Result: Release works again on windows …le (#836) Motivation: boringssl-static profile `mac-intel-cross-compile` incorrectly sets arch resulting in `osx-osx-x86_64` build classifier. It also wrongfully sets the native lib name to `libnetty_tcnative_osx_osx_64`, making `netty-handler` unable to find it If the intention of this profile was to build cross platform (from linux to mac), then `os.detected.name` can be overridden to still produce the similar result. ```xml <os.detected.name>osx</os.detected.name> ``` Modifications: Adjust arch to `x86_64` in maven profile for boringssl static Result: `./mvn -Pmac-intel-cross-compile -am -pl boringssl-static clean package` builds correctly on an apple silicon system Motivation: A new maven release is out Modifications: Upgrade to 3.9.5 Result: Use latest maven release Motivation: We didnt use the latest java releases on the CI Modifications: Update java releases Result: Use latest java releases on the CI Motivation: A new maven-wrapper release is out Modifications: Upgrade to 3.2.0 Result: Use latest maven-wrapper release Signed-off-by: Jorge Solórzano <[email protected]> Motivation: Some tools depend on the Specification-* entries in the MANIFEST.MF. Unfortunaly we don't add these at the moment Modifications: Configure plugin to also add the Specification-* entries Result: MANIFEST.MF contains Specification-* entries Motivation: We need to run curl in insecure mode when install stuff via sdk as the version is too old Modifications: Add config that skips cert validation Result: Be able to build docker image Motivation: We should keep our actions up to date. Modifications: Upgrade all github actions to latest releases Result: Housekeeping Motivation: The chromium-stable branch of boringssl has new commits. We should pull them in. Modifications: Change commit sha of boringssl to the latest Result: Use latest code of chromium-stable branch Motivation: There is an ew java8 release Modifications: Update to 8.0.402-zulu Result: Use latest release Motivation: We already have the JNIEnv* so we should just explicit pass it to free_ssl_state(...) Modifications: Explicit pass JNIEnv* Result: Code cleanup #850) …sl_ctxt_t Motivation: Let's not share the same memory between tcn_ssl_state_t and tcn_ssl_ctxt_t as it makes lifetime handling of the memory and prone to segfaults Modifications: - Let tcn_ssl_state_t contain tcn_ssl_verify_config_t and copy over the config from the tcn_ssl_ctxt_t if needed. - Remove free calls that are not needed anymore Result: Fix possible lifetime issue ## Why [#997](#997) added the musl compatibility check to the FIPS `native-jar` execution, but did not port the corresponding link and post-link handling from the Linux release profiles. As a result, FIPS artifacts retain glibc loader and runtime dependencies that make them fail the new check. ## Changes - link the C++ runtime and unwinder archives statically in `fips-boringssl-static` - remove the architecture-specific `ld-linux` `DT_NEEDED` entry from the final FIPS native library before the musl check - document that FIPS, x86_64, and aarch64 profiles each duplicate these compatibility settings ## Verification - `xmllint --noout boringssl-static/pom.xml` - `git diff --check` - downstream Linux FIPS builds completed successfully on x86_64 and aarch64, including the native musl compatibility check Local Maven model validation was not run because this machine has no Java runtime. Motivation:
Several actions used in our workflows target Node.js 20, which GitHub
has deprecated (runs are being force-upgraded to Node 24 with a
warning).
Modifications:
Bump each to its latest release that declares node24, keeping
SHA pinning with a version comment:
- actions/checkout v4.4.0 -> v7.0.1
- actions/cache v4.3.0 -> v6.1.0
- actions/upload-artifact v4.6.2 -> v7.0.1
- actions/download-artifact v4.3.0 -> v8.0.1
- actions/setup-java v4.9.1 -> v6.0.1
- docker/setup-buildx-action v3.12.0 -> v4.3.0
- microsoft/setup-msbuild v2.0.0 -> v3.0.0
- crazy-max/ghaction-chocolatey v3.4.0 -> v4.1.0
- s4u/maven-settings-action v3.0.0 -> v4.0.0
- crazy-max/ghaction-import-gpg v6.3.0 -> v7.0.0
- github/codeql-action/{init,analyze,autobuild} v2.28.1 (Node 16) ->
v4.38.0
shimataro/ssh-key-action already targets Node 24. ilammy/msvc-dev-cmd
is left unchanged since upstream has no newer release fixing this.
Result:
Build cleanup and less warnings
…e by latest macos release (#1012) Motivation: We need to bump up the target to be able to compile on latest macos release Modifications: Use 11 Result: Be able to compile again Motivation: Every docker compose build in ci-build.yml, ci-pr.yml, ci-deploy.yml and ci-release.yml rebuilds the CentOS6/CentOS7-aarch64/Debian7/AL2023 images from scratch on each run since GitHub-hosted runners are ephemeral and have no persistent layer cache. ci-build.yml/ci-pr.yml previously worked around this with a type=gha buildx cache scoped per matrix leg; ci-deploy.yml and ci-release.yml had no docker layer caching at all. Modifications: Switch to buildx with a registry cache backend (ghcr.io) so the expensive image layers (devtoolset, OpenSSL built from source, cross-compile toolchains) are reused across runs and across workflows. Cache images are pushed to ghcr.io/netty/netty-tcnative-build-cache, distinct from netty/netty's own ghcr.io/netty/netty-build-cache, so the two repositories' caches can never collide or overwrite each other. Result: Speed up CI builds. …ks (#1016) Motivation: resultArray in cert_compress.c compress()/decompress() and resultBytes in the SSL_PRIVATE_KEY_METHOD callbacks in sslcontext.c are obtained from CallObjectMethod/GetObjectField but were never deleted on any exit path. These are invoked repeatedly as native callbacks from OpenSSL/BoringSSL (once per certificate needing (de)compression, or per sign/decrypt/complete call), so the leaked local references accumulate and can exhaust the JNI local reference table. Modifications: - cert_compress.c: delete resultArray before every return in compress() and decompress() once it has been obtained. - sslcontext.c: delete resultBytes at the complete: label in tcn_private_key_sign_java and tcn_private_key_decrypt_java, and before every return in tcn_private_key_complete_java. Result: No longer leak local references to compression/private-key callback result arrays. #1017) Motivation: Debian 7 (wheezy) is EOL and archive.debian.org has no updated openssl/ca-certificates package for it. The ancient wget/curl in the image can no longer complete a TLS handshake with GitHub or sdkman.io, so downloading CMake, Ninja, Go, the precompiled GCC toolchain, the OpenSSL source tarball, and SDKMAN/the JDK inside the debian:7 stage now fails outright, independent of the existing --no-check-certificate/insecure-ssl workarounds already in place for the (now separate) certificate-validation problem. Modifications: Split Dockerfile.debian into a multi-stage build: a new debian:bookworm-slim downloader stage with a modern curl fetches all HTTPS artifacts (CMake, Ninja, Go, the GCC tarball, the OpenSSL source tarball, SDKMAN, and the JDK), and the debian:7 stage now only COPYs those artifacts in and compiles, without ever making a TLS connection itself. Result: Debian 7 docker images build again. Motivation: ftp.belnet.be no longer responds, breaking the Debian docker image build. The mirror was only used because the old wget in Debian 7 could not do TLS with go.dev (2228a81). Since #1017 all downloads happen in a modern image, so the official HTTPS source works again. Modifications: Download Go from https://dl.google.com/go/. Result: Debian docker image builds again. Motivation: Some algorithms, such as Ed25519, have no combined signature and hash NID, causing them to be returned as NID_undef, and thus unusable to callers. Modifications: Fall back to `psign` if `psignhash` is undefined Result: | Code point | TLS name | Before | After | |------------|-----------------------|-------------|-----------------| | `0x0807` | `ed25519` | `undefined` | `ED25519` | | `0x0808` | `ed448` | `undefined` | `ED448` | | `0x0804` | `rsa_pss_rsae_sha256` | `undefined` | `rsassaPss` | | `0x0805` | `rsa_pss_rsae_sha384` | `undefined` | `rsassaPss` | | `0x0806` | `rsa_pss_rsae_sha512` | `undefined` | `rsassaPss` | | `0x0809` | `rsa_pss_pss_sha256` | `undefined` | `rsassaPss` | | `0x080a` | `rsa_pss_pss_sha384` | `undefined` | `rsassaPss` | | `0x080b` | `rsa_pss_pss_sha512` | `undefined` | `rsassaPss` | | `0x0302` | `dsa_sha224` | `undefined` | `dsaEncryption` | | `0x0502` | `dsa_sha384` | `undefined` | `dsaEncryption` | | `0x0602` | `dsa_sha512` | `undefined` | `dsaEncryption` | Follow-up for #861. Motivation: `SSLContext.setKeyLogCallback` only works with BoringSSL and AWS-LC. OpenSSL has had the same `SSL_CTX_set_keylog_callback` API since 1.1.1, so `netty-tcnative-openssl-dynamic` users can't get SSLKEYLOGFILE-style key logs. Modification: - Enable key logging for OpenSSL 1.1.1 and later (still not LibreSSL) with a new `TCN_KEYLOG_SUPPORTED` macro. - Weak-link `SSL_CTX_set_keylog_callback` with GCC/clang, and return false if it's missing at runtime, like `setNumTickets`. MSVC builds use the version check only. - Document supported libraries, when false is returned, and the callback's threading and exception behavior. - Add tests that run real TLS 1.2 and 1.3 handshakes and check the key log labels. Result: Key logging works with OpenSSL 1.1.1 and later. Weak linking covers builds against older headers: the call returns false on an OpenSSL runtime older than 1.1.1 and true on 1.1.1 or later. Co-authored-by: Norman Maurer <[email protected]> Motivation: We should use the latest release of the central-publishing-maven-plugin to pick up bug fixes and improvements. Modifications: - Bump central-publishing-maven-plugin from 0.7.0 to 0.12.0 Result: Use the latest central-publishing-maven-plugin release. Motivation: When on windows we should only try to build openssl-classesand boringssl-static as nothing else is supported atm Modifications: - Add profile for windows which configure the correct modules to use - Adjust workflow for windows to depend on the new profile Result: ./mvn clean package works on windows out of the box ) Motivation: When using BoringSSL or AWS-LC SSL.parseX509Chain(...) allocated the STACK_OF(CRYPTO_BUFFER) before checking that the BIO argument is not null. If it was null we threw a NullPointerException and returned without freeing the stack. Modifications: - Allocate the stack only after the BIO argument was validated. Result: No more native memory leak when SSL.parseX509Chain(...) is called with a null BIO. Motivation: SSLContext.setPrivateKeyMethod0(...) builds the method signatures for the sign and decrypt lookups via NETTY_JNI_UTIL_PREPEND(...). The macro assigns the result to the given variable without freeing the previous value. After looking up the sign method the variable still held the sign signature, which was then overwritten by the first PREPEND for the decrypt lookup and so leaked on every call. In addition the early returns when a method lookup or NewGlobalRef(...) failed skipped the cleanup label and leaked the signature as well. Modifications: - Free the sign signature before reusing the variable for the decrypt signature. - Jump to the cleanup label instead of returning directly when a method lookup or NewGlobalRef(...) fails. Result: No more native memory leak when configuring an async private key method. Motivation: netty_internal_tcnative_SSLContext_JNI_OnLoad(...) leaked native memory every time the library was loaded. NETTY_JNI_UTIL_PREPEND(...) assigns the result to the given variable without freeing the previous value, so each reuse of the name variable leaked the string it held before. On the success path the last name and the dynamic methods table, including the signatures it owns, were never released either as only the error path freed them. Modifications: - Free the name before it is reused by NETTY_JNI_UTIL_PREPEND(...) and before returning successfully. - Release the dynamic methods table right after RegisterNatives(...) as the VM does not keep a reference to it. Result: No more native memory leak when the library is loaded. …IdContext (#1028) Motivation: SSLContext.setSessionTicketKeys0(...) and SSLContext.setSessionIdContext(...) called GetArrayLength(...) on the byte[] argument without checking for null first. Calling GetArrayLength(...) with null is undefined behavior according to the JNI specification and most likely crashes the JVM. Modifications: - Throw a NullPointerException if the byte[] argument is null, like we do for the other array arguments. Result: Passing null no longer risks crashing the JVM and results in a NullPointerException instead. … without a new one (#1030) Motivation: SSLContext.setCertificate(...) and SSLContext.setCertificateBio(...) only replace the stored password if a new one is given, and restore the previous one on failure via free_and_reset_pass(...). The helper did not know whether a replacement happened and so, if the call failed without a new password, it freed the password that was configured before and set it to NULL. Later loads of encrypted keys on the same context would then lose the password. Modifications: - Pass whether the password was replaced to free_and_reset_pass(...) and leave c->password untouched if it was not. Result: A failed setCertificate(...) or setCertificateBio(...) call keeps the previously configured password. Motivation: We used an older apr version. Let's update to 1.7.6 Modifications: - Update to latest apr version - Verify SHA256 of apr on windows after download Result: Use latest apr release. … AWS-LC (#1031) Motivation: SSL_CTX_setup_certs(...) allocated the STACK_OF(CRYPTO_BUFFER) at the top of the function but only hands it over to the SSL_CTX in the CA branch. The early return when skipping the first certificate failed and the return in the non-CA branch did not free the stack and so leaked it. Neither is reachable from the current callers when using BoringSSL or AWS-LC, but this is easy to break with a future change. Modifications: - Allocate the stack only in the CA branch, right before it is used. Result: Every early return now either has not allocated the stack yet or frees it, so no more native memory leak is possible. … into 16 bits (#1034) Motivation: SSLCredential.setSigningAlgorithmPrefs(...) casted each jint to uint16_t, so an out of range value (for example 0x10804 or -1) was silently turned into a different, valid looking signature algorithm id. Modifications: Validate that every id is in the range 0..0xFFFF and throw an IllegalArgumentException otherwise. Result: Invalid signing algorithm ids are rejected instead of being truncated. Motivation: The x86_64 release artifacts are built against glibc 2.12 headers, where strdup(s) is defined as a macro calling __strdup(s) and isinf(x) / isnan(x) expand to calls to __isinf(x) / __isnan(x). musl_compat.c only undefined the __-prefixed names, so the __strdup, __isinf and __isnan fallbacks called themselves and GCC compiled them to a jump to themselves. On musl (Alpine) these fallbacks are the only definitions, so loading a shaded / relocated copy of the library hung forever in JNI_OnLoad when it called strdup(packagePrefix). See #1024 Modifications: - Call (strdup)(...) so the function-like macro is not expanded. - Use __builtin_isinf_sign(...) and __builtin_isnan(...) instead of the isinf / isnan macros, which keeps the result of the glibc functions. - Fail the build when compiled with _FILE_OFFSET_BITS=64 as the fopen64 fallback would call itself in the same way. Result: OpenSsl.isAvailable() no longer hangs when the library is shaded on Alpine x86_64. Motivation: SSL(Context).setOptions(...) and clearOptions(...) take a Java int but pass it directly to SSL(_CTX)_set_options / clear_options, which take uint64_t in OpenSSL 3.x. A value with bit 31 set was sign-extended and so also set / cleared bits 32-63. Modifications: Convert the int to uint32_t before passing it on. Result: Only the bits that were requested are changed. ) Motivation: SSLContext.setSessionCacheTimeout / setSessionCacheMode / setSessionCacheSize and SSL.setTimeout / SSLSession.setTimeout take a Java long but hand it to OpenSSL / BoringSSL functions that take narrower types: uint32_t (timeout) and int (cache mode) on BoringSSL / AWS-LC, and long on OpenSSL, which is only 32 bit on Windows. Out of range values were silently truncated or wrapped. Modifications: Reject values that do not fit the target type with an IllegalArgumentException. Negative timeouts are rejected as well. Result: Out of range values fail loudly instead of being silently changed. Motivation: We did cut a new netty-jni-util release, let's use it Modifications: Update to 0.0.12.Final Result: Use latest netty-jni-util release
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |