0
0
mirror of https://github.com/termux/termux-packages.git synced 2025-05-10 04:35:37 +00:00
Files
termux-packages/packages/openjdk-21/0041-disable-statx-syscall.patch
Robert Kirkman 1440fde499 fix(main/openjdk-{17,21}): disable dlsym() of statx() syscall
- Fixes https://github.com/termux/termux-packages/issues/24651

- Fixes the problem in both `openjdk-17` and `openjdk-21` on the affected device Samsung Galaxy S8+ SM-G955F, but does not break `.jar` launching on other devices.

- Possible side effects could include subtle changes in file-timestamp-reading behavior, as described here (JDK's original behavior on Linux prior to the commit that causes a problem on Samsung Galaxy S8+): https://bugs.openjdk.org/browse/JDK-8316304

- Inspired by similar changes elsewhere in termux-packages, like https://github.com/termux/termux-packages/pull/22088
2025-05-08 20:49:25 +03:00

19 lines
985 B
Diff

This turns off dynamically loading the statx() symbol, which has the same effect as reverting
https://github.com/openjdk/jdk21u/commit/4cf572e3b99b675418e456e7815fb6fd79245e30 ,
which was fixing https://bugs.openjdk.org/browse/JDK-8316304 ,
because on some devices, for some reason it causes launching any JAR to crash the Java runtime.
Fixes https://github.com/termux/termux-packages/issues/24651
--- a/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
+++ b/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c
@@ -434,7 +438,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_init(JNIEnv* env, jclass this)
#ifdef _DARWIN_FEATURE_64_BIT_INODE
capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_BIRTHTIME;
#endif
-#if defined(__linux__)
+#if defined(__linux__) && !defined(__ANDROID__)
my_statx_func = (statx_func*) dlsym(RTLD_DEFAULT, "statx");
if (my_statx_func != NULL) {
capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_BIRTHTIME;