GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix infinite loop in musl_compat fallbacks on old glibc headers by normanmaurer · Pull Request #1037 · netty/netty-tcnative

Conversation

@normanmaurer

@normanmaurer normanmaurer commented Oct 29, 2026

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dnault reacted with rocket emoji
All reactions
  • 🚀 1 reaction
@normanmaurer
Fix infinite loop in musl_compat fallbacks on old glibc headers
9a93e14
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.
@normanmaurer normanmaurer added this to the 2.0.85.Final milestone Oct 29, 2026
@normanmaurer
normanmaurer merged commit 9e9ed1d into main Oct 29, 2026
17 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer deleted the alpn-fix-083adfb3 branch October 29, 2026 15:26
@normanmaurer normanmaurer mentioned this pull request Oct 30, 2026
jni util 0.0.12 #1039
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

2.0.85.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@normanmaurer
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.