Java crashes using musl-1.2.5
Kevin Rushforth
kevin.rushforth at oracle.com
Wed Sep 10 12:34:21 UTC 2025
Given where it is crashing, I recommend sending your message to
core-libs-dev 'at' openjdk.org instead. This isn't a Java client libs issue.
-- Kevin
On 9/10/2025 2:54 AM, Konstantin Kletschke wrote:
> Hello,
>
> I am used to crosscompile openjdk for cortex-a[7|8|9] manually or using
> buildroot framework without severe Problems.
> ARM EABIhf 32Bit.
>
> However recently I got in contact with a customer's rootfs using
> musl-1.2.5 instead of musl-1.2.4 which I was used to and had no problems with.
>
> Severe debugging resulted in the crash whenever musl-1.2.5 was used in
> the target (regardeless what musl version was used to crosscompile and
> regardeless with java I tried, correto-24, openjdk-21, openjdk-24).
>
> I tested with a helloworld downloaded from github somewhere.
> "java -jar helloworld.jar" crashes. Unzippping the jar and using
> "java -cp . HelloWorld" works!
>
> Crashes looks something like those:
>
> # SIGSEGV (0xb) at pc=0x7693e018, pid=8026, tid=8027
> #
> # JRE version: OpenJDK Runtime Environment (21.0+21) (build 21+21)
> # Java VM: OpenJDK Server VM (21+21, mixed mode, serial gc, linux-arm)
> # Problematic frame:
> # V [libjvm.so+0x61e018]
>
> FATAL ERROR in native method: Null object passed to JNI
> at sun.nio.fs.UnixNativeDispatcher.stat0(java.base at 21/Native Method)
> at sun.nio.fs.UnixNativeDispatcher.stat(java.base at 21/Unknown Source)
> at sun.nio.fs.UnixFileAttributes.get(java.base at 21/Unknown Source)
> at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(java.base at 21/Unknown Source)
> at sun.nio.fs.UnixFileSystemProvider.readAttributes(java.base at 21/Unknown Source)
> at sun.nio.fs.LinuxFileSystemProvider.readAttributes(java.base at 21/Unknown Source)
> at java.nio.file.Files.readAttributes(java.base at 21/Unknown Source)
> at java.util.zip.ZipFile$Source.get(java.base at 21/Unknown Source)
> at java.util.zip.ZipFile$CleanableResource.<init>(java.base at 21/Unknown Source)
> at java.util.zip.ZipFile.<init>(java.base at 21/Unknown Source)
> at java.util.zip.ZipFile.<init>(java.base at 21/Unknown Source)
> at java.util.jar.JarFile.<init>(java.base at 21/Unknown Source)
> at java.util.jar.JarFile.<init>(java.base at 21/Unknown Source)
> at java.util.jar.JarFile.<init>(java.base at 21/Unknown Source)
> at sun.launcher.LauncherHelper.getMainClassFromJar(java.base at 21/Unknown Source)
> at sun.launcher.LauncherHelper.loadMainClass(java.base at 21/Unknown Source)
> at sun.launcher.LauncherHelper.checkAndLoadMain(java.base at 21/Unknown Source)
> Aborted
>
>
> With 1.2.4 everything works fine.
>
>
> Farther debugging revealed that following fix in Java allowed to run it
> with 1.2.5:
>
> Index: openjdk-21.0.9+6/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
> ===================================================================
> --- openjdk-21.0.9+6.orig/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
> +++ openjdk-21.0.9+6/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
> @@ -430,7 +430,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_ini
> capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_BIRTHTIME;
> #endif
> #if defined(__linux__)
> - my_statx_func = (statx_func*) dlsym(RTLD_DEFAULT, "statx");
> + my_statx_func = NULL;
> if (my_statx_func != NULL) {
> capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_BIRTHTIME;
> }
>
>
>
> May be this has something to do with the stat ./. stat64 stuff or so.
> Should this be investigated to be repaired in musl or should I head to
> the java guys?
>
>
> Kind Regards
> Konstantin Kletschke
>
More information about the client-libs-dev
mailing list