RFR: JDK-8271858: Handle to jimage file inherited into child processes (posix)

Thomas Stuefe stuefe at openjdk.java.net
Thu Aug 5 13:16:43 UTC 2021


We should not leak the handle to the jimage file (lib/modules) to childs.

JDK-8194734 did solve this for windows. We should use FD_CLOEXEC on Posix as well.

Note that this only poses a problem when a child process is spawned off not via `Runtime.exec` but via another route since the spawnhelper closes all file descriptors.

---
test:

manually verified that lib/modules now has the FD_CLOEXEC flag set.

-------------

Commit messages:
 - open image file with O_CLOEXEC

Changes: https://git.openjdk.java.net/jdk/pull/4991/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4991&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8271858
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4991.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4991/head:pull/4991

PR: https://git.openjdk.java.net/jdk/pull/4991


More information about the core-libs-dev mailing list