RFR: 8357089: Remove VFORK launch mechanism from Process implementation (linux)
Roger Riggs
rriggs at openjdk.org
Mon Jun 16 18:28:30 UTC 2025
On Thu, 12 Jun 2025 04:11:15 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
> (for JDK 26)
>
> Note: This PR is a continuation of the old PR here: https://github.com/openjdk/jdk/pull/25260; had to close the old one since I had Skara problems after the JDK25 split-off.
>
> See the companion CSR (https://bugs.openjdk.org/browse/JDK-8357090) for the ratio behind this removal.
>
> Patch
>
> - removes all code handling the VFORK mode.
> - removes or clarifies comments explaining use of vfork by the JVM.
> - we now print out an error message to stderr if the user still specifies -Djdk.lang.Process.launchMechanism=vfork.
src/java.base/unix/native/libjava/ProcessImpl_md.c line 60:
> 58: * - then exec(2) the target binary
> 59: *
> 60: * On the OS-side are four ways to fork off:
I would mention the two ways that are implemented, only mentioning vfork after the supported mechanisms to inhibit someone wanting to go backwards.
src/java.base/unix/native/libjava/ProcessImpl_md.c line 86:
> 84: * powerful, but Linux-specific.
> 85: *
> 86: * D) posix_spawn(3): Where fork/vfork/clone all fork off the process and leave
I would downplay the OS launch options we don't use, only saying that vfork is dangerous (and a bit as to why) but there's no need to mention clone. And there's no need to mention the the deprecation or removal, when this is integrated its gone.
src/java.base/unix/native/libjava/childproc.c line 207:
> 205: vector[count] = NULL;
> 206: }
> 207:
This mode should be mentioned in the CSR, even if no-one knew it was there.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25768#discussion_r2150580874
PR Review Comment: https://git.openjdk.org/jdk/pull/25768#discussion_r2150578422
PR Review Comment: https://git.openjdk.org/jdk/pull/25768#discussion_r2150587579
More information about the core-libs-dev
mailing list