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

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 19
    • Affects Version/s: 17, 19
    • Component/s: 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

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

              Created:
              Updated:
              Resolved: