JDK-8230517 : UnifiedOop invokes undefined behavior
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jfr
  • Affected Version: 14
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2019-09-04
  • Updated: 2019-12-04
  • Resolved: 2019-12-04
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 14
14Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
UnifiedOop may attempt to construct oop* values that are misaligned.  That has unspecified behavior.  Any further manipulation of the value (such as attempting to convert back to a narrowOop*) can't remove that.  And dereferencing a pointer with unspecified value is undefined behavior.

It is generally a bad idea to lie to the type system the way this class is doing. An alternative would be to have a distinct type that carried around the internal (tagged) pointer as a void* or the like.  Make it a thin, trivially copyable class, and there's no additional overhead.

Comments
We will address this as part of JDK-8235174.
04-12-2019

ILW = MLM = P4
10-09-2019