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

Potential off-read when checking JFR's status in awaitFinished

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 19
    • 17, 19
    • hotspot
    • None
    • jfr
    • b15
    • generic
    • generic

      It looks to me that the method ChunkHeader::awaitFinished [0] can potentially read an incorrect offset when checking the status. The correct offset is first set [1] but every time we go through the loop, it's advanced (as a side-effect of reading) [2] and never reset. The right pattern for this seems to be the one here [3].

      Note: this observation is based on static code-analysis only, I have not verified it with an actual test and there could be something that I'm overlooking.

      --
      [0] - https://github.com/openjdk/jdk/blob/jdk-19+13/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java#L166
      [1] - https://github.com/openjdk/jdk/blob/jdk-19+13/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java#L172
      [2] - https://github.com/openjdk/jdk/blob/jdk-19+13/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java#L174
      [3] - https://github.com/openjdk/jdk/blob/jdk-19+13/src/jdk.jfr/share/classes/jdk/jfr/internal/consumer/ChunkHeader.java#L118

            egahlin Erik Gahlin
            mbalao Martin Balao Alonso
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: