RFR: 8329995: Restricted access to `/proc` can cause JFR initialization to crash

Jaroslav Bachorik jbachorik at openjdk.org
Sun Apr 14 09:02:01 UTC 2024


Please, review this trivial change to make using `ProcessIterator` more robust in the presence of SELinux or a similar system.

The call to `os::opendir("/proc")` may return `nulltptr` if the `/proc` is not accessible due to restrictions placed by the SELinux. In that case the `ProcessIterator` will SIGSEG because it assumes the `_dir`, which is the variable storing the result  of the `os::opendir("/proc")` call to be non-null.

The patch is missing regression test because it is very hard to simulate `/proc` not being accessible to the test process.

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

Commit messages:
 - 8329995:Restricted access to `/proc` can cause JFR initialization to crash

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

PR: https://git.openjdk.org/jdk/pull/18775


More information about the hotspot-runtime-dev mailing list