Java crashes using musl-1.2.5
Konstantin Kletschke
konstantin.kletschke at inside-m2m.de
Wed Sep 10 12:54:29 UTC 2025
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 changed
in musl from 1.2.4 to 1.2.5 or so.
I already headed to the musl people but I am not shure if its placed
better over there or here. I also already showed up at client-libs-dev
but was told to be come over here.
Kind Regards
Konstantin
--
INSIDE M2M GmbH
Konstantin Kletschke
Berenbosteler Straße 76 B
30823 Garbsen
Telefon: +49 (0) 5137 90950136
Mobil: +49 (0) 151 15256238
Fax: +49 (0) 5137 9095010
konstantin.kletschke at inside-m2m.de
http://www.inside-m2m.de
Geschäftsführung: Michael Emmert, Derek Uhlig
HRB: 111204, AG Hannover
More information about the core-libs-dev
mailing list