aboutsummaryrefslogtreecommitdiffstats
path: root/community/openjdk8
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-05-30 14:38:30 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2017-05-30 15:01:15 +0000
commit874cfb1fc5eaca8c800329d7e7f911d84fb20644 (patch)
treecdb586b0cbf47612b41b4b8a1b19b2070d609f08 /community/openjdk8
parent007c4c71aa098e197d5e42ad5ea128e50a30f56d (diff)
downloadaports-874cfb1fc5eaca8c800329d7e7f911d84fb20644.tar.bz2
aports-874cfb1fc5eaca8c800329d7e7f911d84fb20644.tar.xz
community/openjdk8: increase buffer size for getmntent_r
Java will only use 1024 byte buffer for parsing mounts. Unlike glibc will musl return error when this is not big enough instead of truncating it. We solve it by allocating a much bigger buffer. ref #9073 We also build without precompiled headers, which does not work eith PIE.
Diffstat (limited to 'community/openjdk8')
-rw-r--r--community/openjdk8/APKBUILD5
-rw-r--r--community/openjdk8/icedtea-jdk-getmntent-buffer.patch88
2 files changed, 92 insertions, 1 deletions
diff --git a/community/openjdk8/APKBUILD b/community/openjdk8/APKBUILD
index 2de62adcfd..4f8db316d5 100644
--- a/community/openjdk8/APKBUILD
+++ b/community/openjdk8/APKBUILD
@@ -6,7 +6,7 @@ _icedteaver=3.4.0
# pkgver is <JDK version>.<JDK update>.<JDK build>
# Check http://icedtea.classpath.org/wiki/Main_Page when updating!
pkgver=8.131.11
-pkgrel=0
+pkgrel=1
pkgdesc="OpenJDK 8 provided by IcedTea"
url="http://icedtea.classpath.org/"
arch="all"
@@ -64,6 +64,7 @@ source="http://icedtea.classpath.org/download/source/icedtea-$_icedteaver.tar.gz
icedtea-jdk-fix-libjvm-load.patch
icedtea-jdk-musl.patch
icedtea-jdk-includes.patch
+ icedtea-jdk-getmntent-buffer.patch
icedtea-autoconf-config.patch
"
builddir="$srcdir/icedtea-$_icedteaver"
@@ -134,6 +135,7 @@ build() {
--localstatedir=/var \
--disable-dependency-tracking \
--disable-downloading \
+ --disable-precompiled-headers \
--with-parallel-jobs=${JOBS:-2} \
--with-hotspot-build=default \
--with-openjdk-src-zip="$srcdir/openjdk-$_dropsver.tar.xz" \
@@ -283,4 +285,5 @@ f6365cfafafa008bd6c1bf0ccec01a63f8a39bd1a8bc87baa492a27234d47793ba02d455e5667a87
b135991c76b0db8fa7c363e0903624668e11eda7b54a943035c214aa4d7fc8c3e8110ed200edcec82792f3c9393150a9bd628625ddf7f3e55720ff163fbbb471 icedtea-jdk-fix-libjvm-load.patch
cdebe2c59657e7fd317a4841b2fbe95d9e8d7ee9d1593edf352ed7f49a92a42cbce82cbaa404d3f02c6d273eae03222a79559c09bf6cf439396c5ec5434f5458 icedtea-jdk-musl.patch
e8d9f1b867bf4fc84aa00d1237b264bcf503b1ed5f34735e14b0b747a728953fe0051a5af69ed058d377fbf65d8be1ed9e38fe5fc6edb2d50b31f34bf3ba91dc icedtea-jdk-includes.patch
+7e6fa46b10c630517bfa46943858aea1d032c12d32ba3fcb7a2143ae1e896c34fa4cb8f925af80cb19f8e29149b835aa054adfd30ebb00539f6c78588d6f5211 icedtea-jdk-getmntent-buffer.patch
662d662d0a7a84be2978e921317589f212f3ba3b7629527ba0f1140b5ac4c1024893e0ed176211688ed1a4505968c4befc841ed57ffcdbb9d355c2cb0571b167 icedtea-autoconf-config.patch"
diff --git a/community/openjdk8/icedtea-jdk-getmntent-buffer.patch b/community/openjdk8/icedtea-jdk-getmntent-buffer.patch
new file mode 100644
index 0000000000..075a9d4238
--- /dev/null
+++ b/community/openjdk8/icedtea-jdk-getmntent-buffer.patch
@@ -0,0 +1,88 @@
+Give a much bigger buffer to getmntent_r.
+
+https://bugs.alpinelinux.org/issues/7093
+
+diff --git a/openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c b/openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
+index c8500db..d0b85d6 100644
+--- openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
++++ openjdk/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c
+@@ -33,6 +33,7 @@
+ #include <dlfcn.h>
+ #include <errno.h>
+ #include <mntent.h>
++#include <limits.h>
+
+ #include "sun_nio_fs_LinuxNativeDispatcher.h"
+
+@@ -173,8 +174,8 @@ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this,
+ jlong value, jobject entry)
+ {
+ struct mntent ent;
+- char buf[1024];
+- int buflen = sizeof(buf);
++ char *buf = NULL;
++ const size_t buflen = PATH_MAX * 4;
+ struct mntent* m;
+ FILE* fp = jlong_to_ptr(value);
+ jsize len;
+@@ -183,10 +184,17 @@ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this,
+ char* dir;
+ char* fstype;
+ char* options;
++ jint res = -1;
+
+- m = getmntent_r(fp, &ent, (char*)&buf, buflen);
+- if (m == NULL)
++ buf = malloc(buflen);
++ if (buf == NULL) {
++ JNU_ThrowOutOfMemoryError(env, "native heap");
+ return -1;
++ }
++ m = getmntent_r(fp, &ent, buf, buflen);
++ if (m == NULL)
++ goto out;
++
+ name = m->mnt_fsname;
+ dir = m->mnt_dir;
+ fstype = m->mnt_type;
+@@ -195,32 +203,35 @@ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this,
+ len = strlen(name);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+- return -1;
++ goto out;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name);
+ (*env)->SetObjectField(env, entry, entry_name, bytes);
+
+ len = strlen(dir);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+- return -1;
++ goto out;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir);
+ (*env)->SetObjectField(env, entry, entry_dir, bytes);
+
+ len = strlen(fstype);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+- return -1;
++ goto out;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype);
+ (*env)->SetObjectField(env, entry, entry_fstype, bytes);
+
+ len = strlen(options);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+- return -1;
++ goto out;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options);
+ (*env)->SetObjectField(env, entry, entry_options, bytes);
+
+- return 0;
++ res = 0;
++out:
++ free(buf);
++ return res;
+ }
+
+ JNIEXPORT void JNICALL