JDK-8341854 : Incorrect clearing of ZF in fast_unlock_lightweight on x86
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • CPU: x86
  • Submitted: 2024-10-09
  • Updated: 2024-10-14
  • Resolved: 2024-10-09
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 24
24 b19Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
This bug was introduced by JDK-8320318.

C2_MacroAssembler::fast_unlock_lightweight() on x86 issues a testl(monitor, monitor); instruction for the sole purpose of clearing the zero-flag, which should force us to go into the slow path.

However, this instruction incorrectly only checks the lower 32-bits, which results in setting the zero-flag if the ObjectMonitor has all-zeros in the lower 32-bits. For some reason this seems to be quite common on macosx-x64, where we tend to get an ObjectMonitor address that is 0x0000600000000000.

The reason we wanted to go into the slow path was that we've observed that there is a thread queued on either the EntryList or cxq, and there is no successor. However since we failed to clear the zero-flag, we will go into the fast path and no one will wake up the stranded thread. Thus the system will hang and any test system will timeout.

Comments
This fix for this bug is integrated in jdk-24+19-2209.
09-10-2024

Changeset: fcc9c8d5 Branch: master Author: Fredrik Bredberg <fbredberg@openjdk.org> Date: 2024-10-09 16:45:56 +0000 URL: https://git.openjdk.org/jdk/commit/fcc9c8d570396506068e0a1d4123e32b195e6653
09-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/21422 Date: 2024-10-09 13:11:58 +0000
09-10-2024