JDK-8369631 : Assess and remedy any unsafe usage of the sr_semaphore Semaphore in the Posix signal code
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-10-13
  • Updated: 2025-10-20
  • Resolved: 2025-10-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26 masterFixed
Related Reports
Causes :  
Relates :  
Description
As discussed in JDK-8361462, static Semaphores are potentially unsafe if accessed during VM termination. The suspend/resume code (for event sampling) in signals_posix.cpp declares:

// suspend/resume support
#if defined(__APPLE__)
  static OSXSemaphore sr_semaphore;
#else
  static PosixSemaphore sr_semaphore;
#endif

It is very difficult to establish with certainty that we could not be utilising this semaphore around VM termination, so it is safest to fix the problem. The signal code already has another lazily initialization `Semaphore*` so we can easily change the `sr_semaphore` as well.
Comments
Changeset: 680414d0 Branch: master Author: David Holmes <dholmes@openjdk.org> Date: 2025-10-20 00:07:08 +0000 URL: https://git.openjdk.org/jdk/commit/680414d0f9ab75d888bcb284cc494124a01a388f
20-10-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/27762 Date: 2025-10-13 06:52:32 +0000
13-10-2025