openjdk-17: remove android11.patch as it doesn't work

Perhaps issue is rather tagged pointers than fdsan.
This commit is contained in:
Leonid Pliushch 2021-07-30 12:09:06 +03:00
parent 26ca235a5d
commit ddf9dc680d
No known key found for this signature in database
GPG Key ID: 45F2964132545795
2 changed files with 1 additions and 320 deletions

View File

@ -1,319 +0,0 @@
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/share/native/launcher/main.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/share/native/launcher/main.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/share/native/launcher/main.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/share/native/launcher/main.c 2021-07-30 09:59:32.830789520 +0300
@@ -23,6 +23,23 @@
* questions.
*/
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+static void android_disable_fdsan() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_fdsan(){}
+#endif
+
/*
* This file contains the main entry point into the launcher code
@@ -101,6 +118,8 @@
int jargc;
char** jargv;
const jboolean const_javaw = JNI_FALSE;
+
+ android_disable_fdsan();
#endif /* JAVAW */
{
int i, main_jargc, extra_jargc;
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/share/native/libjli/args.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/share/native/libjli/args.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/share/native/libjli/args.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/share/native/libjli/args.c 2021-07-30 09:59:32.830789520 +0300
@@ -29,6 +29,23 @@
#include <sys/stat.h>
#include <ctype.h>
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+static void android_disable_fdsan() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_fdsan(){}
+#endif
+
#ifdef DEBUG_ARGFILE
#ifndef NO_JNI
#define NO_JNI
@@ -653,6 +670,8 @@
test_case(name[0], name + 1, sizeof(name)/sizeof(char*) - 1)
int main(int argc, char** argv) {
+ android_disable_fdsan();
+
size_t i, j;
char* case1[] = { "-version -cp \"c:\\\\java libs\\\\one.jar\" \n",
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/share/native/libjli/java.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/share/native/libjli/java.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/share/native/libjli/java.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/share/native/libjli/java.c 2021-07-30 09:59:32.834789436 +0300
@@ -50,6 +50,22 @@
* the CreateExecutionEnviroment will remove the -d<n> flags.
*/
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+static void android_disable_fdsan() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_fdsan(){}
+#endif
#include "java.h"
#include "jni.h"
@@ -252,6 +268,8 @@
_is_java_args = javaargs;
_wc_enabled = cpwildcard;
+ android_disable_fdsan();
+
InitLauncher(javaw);
DumpState();
if (JLI_IsTraceLauncher()) {
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/unix/native/jspawnhelper/jspawnhelper.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/unix/native/jspawnhelper/jspawnhelper.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/unix/native/jspawnhelper/jspawnhelper.c 2021-07-30 09:59:32.834789436 +0300
@@ -31,6 +31,23 @@
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+static void android_disable_fdsan() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_fdsan(){}
+#endif
+
#include "childproc.h"
extern int errno;
@@ -131,6 +148,8 @@
}
int main(int argc, char *argv[]) {
+ android_disable_fdsan();
+
ChildStuff c;
int t;
struct stat buf;
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/unix/native/launcher/jexec.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/unix/native/launcher/jexec.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/unix/native/launcher/jexec.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/unix/native/launcher/jexec.c 2021-07-30 09:59:32.834789436 +0300
@@ -84,6 +84,23 @@
# include "manifest_info.h"
#endif
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+static void android_disable_fdsan() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_fdsan(){}
+#endif
+
static const int CRAZY_EXEC = ENOEXEC;
static const int BAD_MAGIC = ENOEXEC;
@@ -150,6 +167,8 @@
* the kernel.)
*/
int main(int argc, const char * argv[]) {
+ android_disable_fdsan();
+
/* We need to exec the original arguments using java, instead of jexec.
* Also, for Linux, it is necessary to add the "-jar" argument between
* the new arg[0], and the old arg[1]. To do this we will create a new
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/unix/native/libjli/java_md.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/unix/native/libjli/java_md.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/unix/native/libjli/java_md.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/unix/native/libjli/java_md.c 2021-07-30 10:08:45.355787913 +0300
@@ -37,6 +37,22 @@
#include <sys/types.h>
#include "manifest_info.h"
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+static void android_disable_fdsan() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_fdsan(){}
+#endif
#define JVM_DLL "libjvm.so"
#define JAVA_DLL "libjava.so"
@@ -301,6 +317,8 @@
int argc = *pargc;
char **argv = *pargv;
+ android_disable_fdsan();
+
#ifdef SETENV_REQUIRED
jboolean mustsetenv = JNI_FALSE;
char *runpath = NULL; /* existing effective LD_LIBRARY_PATH setting */
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/windows/native/libjli/cmdtoargs.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/windows/native/libjli/cmdtoargs.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/java.base/windows/native/libjli/cmdtoargs.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/java.base/windows/native/libjli/cmdtoargs.c 2021-07-30 09:59:32.834789436 +0300
@@ -33,6 +33,23 @@
#include <assert.h>
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+static void android_disable_fdsan() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_fdsan(){}
+#endif
+
#ifndef IDE_STANDALONE
#include "java.h"
#include "jni.h"
@@ -382,6 +399,7 @@
#define MAXV 128
int main(int argc, char* argv[]) {
+ android_disable_fdsan();
int n;
for (n=1; n < argc; n++) {
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/jdk.jpackage/linux/native/applauncher/LinuxLauncher.c 2021-07-30 09:59:32.838789353 +0300
@@ -34,6 +34,22 @@
#include "JvmLauncher.h"
#include "LinuxPackage.h"
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+static void android_disable_fdsan() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_fdsan(){}
+#endif
#define STATUS_FAILURE 1
@@ -132,6 +148,8 @@
int main(int argc, char *argv[]) {
+ android_disable_fdsan();
+
int exitCode = STATUS_FAILURE;
JvmlLauncherData* jvmLauncherData;
diff -uNr mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/jdk.jpackage/share/native/applauncher/JvmLauncherLib.c mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/jdk.jpackage/share/native/applauncher/JvmLauncherLib.c
--- mobile-ec285598849a27f681ea6269342cf03cf382eb56/src/jdk.jpackage/share/native/applauncher/JvmLauncherLib.c 2021-07-06 14:29:24.000000000 +0300
+++ mobile-ec285598849a27f681ea6269342cf03cf382eb56.mod/src/jdk.jpackage/share/native/applauncher/JvmLauncherLib.c 2021-07-30 10:04:54.260282693 +0300
@@ -29,6 +29,22 @@
#include "JvmLauncher.h"
+#ifdef __TERMUX__
+#include <android/fdsan.h>
+#include <dlfcn.h>
+static void android_disable_fdsan() {
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
+}
+#else
+static void android_disable_fdsan(){}
+#endif
typedef int (JNICALL *JLI_LaunchFuncType)(int argc, char ** argv,
int jargc, const char** jargv,
@@ -91,6 +107,8 @@
int jvmLauncherStartJvm(JvmlLauncherData* jvmArgs, void* JLI_Launch) {
int exitCode;
+ android_disable_fdsan();
+
dumpJvmlLauncherData(jvmArgs);
exitCode = (*((JLI_LaunchFuncType)JLI_Launch))(
jvmArgs->jliLaunchArgc, jvmArgs->jliLaunchArgv,

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Java development kit and runtime"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=17.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/termux/openjdk-mobile-termux/archive/ec285598849a27f681ea6269342cf03cf382eb56.tar.gz
TERMUX_PKG_SHA256=d7c6ead9d80d0f60d98d0414e9dc87f5e18a304e420f5cd21f1aa3210c1a1528
TERMUX_PKG_DEPENDS="cups, fontconfig, freetype, libandroid-shmem, libandroid-spawn, libiconv, libpng, libx11, libxrender, zlib"