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

JvmtiEventControllerPrivate::set_event_callbacks CLEARING_MASK computation is incorrect

    XMLWordPrintable

Details

    • b24

    Backports

      Description

        Loom added the following code in JvmtiEventControllerPrivate::set_event_callbacks:

          // Mask to clear normal event bits.
          const jlong CLEARING_MASK = (1L >> (TOTAL_MIN_EVENT_TYPE_VAL - TOTAL_MIN_EVENT_TYPE_VAL)) - 1L;
          // Avoid cleaning extension event bits.
          jlong enabled_bits = CLEARING_MASK & env->env_event_enable()->_event_callback_enabled.get_bits();

        But the CLEARING_MASK is computed weirdly/incorrectly:
         a) It subtracts TOTAL_MIN_EVENT_TYPE_VAL from itself, always yielding 0;
         b) It shifts 1L to the right, which means the subexpression would produce either 0 or 1; or, after -1L, either 0 or -1 (full mask?).

        Attachments

          Issue Links

            Activity

              People

                sspitsyn Serguei Spitsyn
                shade Aleksey Shipilev
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: