jdk/1.8 & jdk/11:
Use closefrom(2) after fork/vfork and before exec instead of
opendir/readdir on /dev/fd. opendir/readdir are not async-signal-
safe and may not be safely called after forking in a multithreaded
program. Issue raised to my attention by deraadt@.
jdk/11:
Update to bsd release 2 of 11.0.3-7 which contains BsdSocketOptions
fix and other corrections that can be viewed here:
https://github.com/battleblow/openjdk-jdk11u/releases
Index: 1.8/Makefile
===================================================================
RCS file: /cvs/ports/devel/jdk/1.8/Makefile,v
retrieving revision 1.41
diff -u -p -u -r1.41 Makefile
--- 1.8/Makefile 11 Mar 2019 19:51:35 -0000 1.41
+++ 1.8/Makefile 22 May 2019 19:56:07 -0000
@@ -13,6 +13,7 @@ PKGNAME= jdk-${V}
PKGNAME-main= jdk-${V}
PKGNAME-jre= jre-${V}
EPOCH= 0
+REVISION= 0
DIST_SUBDIR= jdk
DISTNAME= openjdk-8u202b08-bsd-port-20190310
Index: 1.8/patches/patch-jdk_src_solaris_native_java_lang_childproc_c
===================================================================
RCS file: 1.8/patches/patch-jdk_src_solaris_native_java_lang_childproc_c
diff -N 1.8/patches/patch-jdk_src_solaris_native_java_lang_childproc_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ 1.8/patches/patch-jdk_src_solaris_native_java_lang_childproc_c 22 May 2019 19:56:07 -0000
@@ -0,0 +1,42 @@
+$OpenBSD$
+
+Index: jdk/src/solaris/native/java/lang/childproc.c
+--- jdk/src/solaris/native/java/lang/childproc.c.orig
++++ jdk/src/solaris/native/java/lang/childproc.c
+@@ -62,6 +62,28 @@ isAsciiDigit(char c)
+ return c >= '0' && c <= '9';
+ }
+
++#if defined(__OpenBSD__)
++/*
++ * Quoting POSIX: "If a multi-threaded process calls fork(), the new
++ * process shall contain a replica of the calling thread and its entire
++ * address space, possibly including the states of mutexes and other
++ * resources. Consequently, to avoid errors, the child process may only
++ * execute async-signal-safe operations until such time as one of the exec
++ * functions is called."
++ *
++ * opendir and readir are not async-signal-safe and can deadlock when
++ * called after fork or vfork (and before exec) so use closefrom syscall
++ * which is safe to call after forking.
++ */
++int
++closeDescriptors(void)
++{
++ int err;
++ RESTARTABLE(closefrom(FAIL_FILENO + 1), err);
++ return err;
++}
++#else
++
+ #ifdef _ALLBSD_SOURCE
+ #define FD_DIR "/dev/fd"
+ #define dirent64 dirent
+@@ -113,6 +135,7 @@ closeDescriptors(void)
+
+ return 1;
+ }
++
No comments:
Post a Comment