Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8230517

UnifiedOop invokes undefined behavior

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 14
    • Fix Version/s: 14
    • Component/s: hotspot
    • Subcomponent:
      jfr

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mgronlun Markus Grönlund
              Reporter:
              kbarrett Kim Barrett
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: