Re: RFR: 8332699: ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
On Mon, 10 Jun 2024 12:30:59 GMT, Matthias Baesken wrote: > When running hs :tier1 tests or jdk/jfr tests, with ubsan enabled (configure > flag --enable-ubsan), in a lot of jfr related tests like > compiler/intrinsics/klass/CastNullCheckDroppingsTest.jtr > serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.jtr > this oob error can be seen : > > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31:43: runtime > error: index 163 out of bounds for type 'jfrNativeEventSetting [162]' > #0 0x7f6b75a8634b in JfrEventSetting::setting(JfrEventId) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31 > #1 0x7f6b75a8634b in JfrEventSetting::set_stacktrace(long, bool) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp:47 > > Looks like the array in generated code is too small. > With > `jfrNativeEventSetting bits[NUMBER_OF_EVENTS];` > and > > static const int NUMBER_OF_EVENTS = 162; > static const int NUMBER_OF_RESERVED_EVENTS = 2; > > > Access at index 163 cannot work. > But it looks like there is always enough memory after the array so we do not > crash and it was not noticed before. Hi Thomas and Johannes, thanks for the reviews ! - PR Comment: https://git.openjdk.org/jdk/pull/19628#issuecomment-2162188598
Re: RFR: 8332699: ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
On Mon, 10 Jun 2024 12:30:59 GMT, Matthias Baesken wrote: > When running hs :tier1 tests or jdk/jfr tests, with ubsan enabled (configure > flag --enable-ubsan), in a lot of jfr related tests like > compiler/intrinsics/klass/CastNullCheckDroppingsTest.jtr > serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.jtr > this oob error can be seen : > > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31:43: runtime > error: index 163 out of bounds for type 'jfrNativeEventSetting [162]' > #0 0x7f6b75a8634b in JfrEventSetting::setting(JfrEventId) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31 > #1 0x7f6b75a8634b in JfrEventSetting::set_stacktrace(long, bool) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp:47 > > Looks like the array in generated code is too small. > With > `jfrNativeEventSetting bits[NUMBER_OF_EVENTS];` > and > > static const int NUMBER_OF_EVENTS = 162; > static const int NUMBER_OF_RESERVED_EVENTS = 2; > > > Access at index 163 cannot work. > But it looks like there is always enough memory after the array so we do not > crash and it was not noticed before. @egahlin thank you. Patch is okay then. - Marked as reviewed by stuefe (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/19628#pullrequestreview-2112007936
Re: RFR: 8332699: ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
On Tue, 11 Jun 2024 16:55:39 GMT, Thomas Stuefe wrote: > About your fix, do you know why MetadataEvent and CheckPointEvent would not > count toward the number of events? In other words, why NUMBER_OF_EVENTS is > 162 if we have 164 events? Maybe the number of events is wrong? > > @egahlin ? The metadata and check point events are built-in and hold labels/descriptions and constants, so they can't be enabled/disabled and thus don't need event settings. - PR Comment: https://git.openjdk.org/jdk/pull/19628#issuecomment-2161391485
Re: RFR: 8332699: ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
On Mon, 10 Jun 2024 12:30:59 GMT, Matthias Baesken wrote: > When running hs :tier1 tests or jdk/jfr tests, with ubsan enabled (configure > flag --enable-ubsan), in a lot of jfr related tests like > compiler/intrinsics/klass/CastNullCheckDroppingsTest.jtr > serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.jtr > this oob error can be seen : > > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31:43: runtime > error: index 163 out of bounds for type 'jfrNativeEventSetting [162]' > #0 0x7f6b75a8634b in JfrEventSetting::setting(JfrEventId) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31 > #1 0x7f6b75a8634b in JfrEventSetting::set_stacktrace(long, bool) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp:47 > > Looks like the array in generated code is too small. > With > `jfrNativeEventSetting bits[NUMBER_OF_EVENTS];` > and > > static const int NUMBER_OF_EVENTS = 162; > static const int NUMBER_OF_RESERVED_EVENTS = 2; > > > Access at index 163 cannot work. > But it looks like there is always enough memory after the array so we do not > crash and it was not noticed before. About your fix, do you know why MetadataEvent and CheckPointEvent would not count toward the number of events? In other words, why NUMBER_OF_EVENTS is 162 if we have 164 events? Maybe the number of events is wrong? @egahlin ? - PR Comment: https://git.openjdk.org/jdk/pull/19628#issuecomment-2161218498
Re: RFR: 8332699: ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
On Tue, 11 Jun 2024 14:46:10 GMT, Matthias Baesken wrote: > My maximum JfrEventId is 163 , see the generated > hotspot/variant-server/gensrc/jfrfiles/jfrEventIds.hpp > > ``` > > enum JfrEventId { > JfrMetadataEvent = 0, > JfrCheckpointEvent = 1, > JfrDurationEvent = 2, > JfrInstantEvent = 3, > JfrValueEvent = 4, > JfrTextEvent = 5, > JfrZThreadDebugEvent = 6, >. > JfrJavaAgentEvent = 161, > JfrNativeAgentEvent = 162, > JfrDeprecatedInvocationEvent = 163, > }; > ``` > > so NUMBER_OF_EVENTS + NUMBER_OF_RESERVED_EVENTS looks fine to me. 163 is the > highest I could see while testing. No, I am quite sure the `ev` substructure is wrong. The structure contains members that are not events, that's why its larger. But it's an issue orthogonal to the one you are fixing. I opened https://bugs.openjdk.org/browse/JDK-8334031 to track it. - PR Comment: https://git.openjdk.org/jdk/pull/19628#issuecomment-2161205376
Re: RFR: 8332699: ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
On Mon, 10 Jun 2024 12:30:59 GMT, Matthias Baesken wrote: > When running hs :tier1 tests or jdk/jfr tests, with ubsan enabled (configure > flag --enable-ubsan), in a lot of jfr related tests like > compiler/intrinsics/klass/CastNullCheckDroppingsTest.jtr > serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.jtr > this oob error can be seen : > > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31:43: runtime > error: index 163 out of bounds for type 'jfrNativeEventSetting [162]' > #0 0x7f6b75a8634b in JfrEventSetting::setting(JfrEventId) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31 > #1 0x7f6b75a8634b in JfrEventSetting::set_stacktrace(long, bool) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp:47 > > Looks like the array in generated code is too small. > With > `jfrNativeEventSetting bits[NUMBER_OF_EVENTS];` > and > > static const int NUMBER_OF_EVENTS = 162; > static const int NUMBER_OF_RESERVED_EVENTS = 2; > > > Access at index 163 cannot work. > But it looks like there is always enough memory after the array so we do not > crash and it was not noticed before. My maximum JfrEventId is 163 , see the generated hotspot/variant-server/gensrc/jfrfiles/jfrEventIds.hpp enum JfrEventId { JfrMetadataEvent = 0, JfrCheckpointEvent = 1, JfrDurationEvent = 2, JfrInstantEvent = 3, JfrValueEvent = 4, JfrTextEvent = 5, JfrZThreadDebugEvent = 6, . JfrJavaAgentEvent = 161, JfrNativeAgentEvent = 162, JfrDeprecatedInvocationEvent = 163, }; so NUMBER_OF_EVENTS + NUMBER_OF_RESERVED_EVENTS looks fine to me. 163 is the highest I could see while testing. - PR Comment: https://git.openjdk.org/jdk/pull/19628#issuecomment-2160953294
Re: RFR: 8332699: ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
On Mon, 10 Jun 2024 12:30:59 GMT, Matthias Baesken wrote: > When running hs :tier1 tests or jdk/jfr tests, with ubsan enabled (configure > flag --enable-ubsan), in a lot of jfr related tests like > compiler/intrinsics/klass/CastNullCheckDroppingsTest.jtr > serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.jtr > this oob error can be seen : > > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31:43: runtime > error: index 163 out of bounds for type 'jfrNativeEventSetting [162]' > #0 0x7f6b75a8634b in JfrEventSetting::setting(JfrEventId) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31 > #1 0x7f6b75a8634b in JfrEventSetting::set_stacktrace(long, bool) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp:47 > > Looks like the array in generated code is too small. > With > `jfrNativeEventSetting bits[NUMBER_OF_EVENTS];` > and > > static const int NUMBER_OF_EVENTS = 162; > static const int NUMBER_OF_RESERVED_EVENTS = 2; > > > Access at index 163 cannot work. > But it looks like there is always enough memory after the array so we do not > crash and it was not noticed before. Good catch! But I am not sure the solution is correct, or not enough. On my machine (linux x64), I see 169 explicitly named events in `JfrNativeSettings::ev`. But then, `NUMBER_OF_EVENTS = 162;` and `NUMBER_OF_RESERVED_EVENTS = 2;` . => 164. So, the last 5 events are not covered by the `bits` array even with your change. So, there is a mismatch somewhere between `metadata.getEventsAndStructs()` (used to print out individual event data) and `metadata.eventCounter.count` (used to determine NUMBER_OF_EVENTS). If you have figured this out, and fixed it, could you please let the generator add a STATIC_ASSERT( sizeof(JfrNativeSettings::ev) == sizeof(JfrNativeSettings::bits) ); to the header? - PR Comment: https://git.openjdk.org/jdk/pull/19628#issuecomment-2160739146
Re: RFR: 8332699: ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
On Mon, 10 Jun 2024 12:30:59 GMT, Matthias Baesken wrote: > When running hs :tier1 tests or jdk/jfr tests, with ubsan enabled (configure > flag --enable-ubsan), in a lot of jfr related tests like > compiler/intrinsics/klass/CastNullCheckDroppingsTest.jtr > serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.jtr > this oob error can be seen : > > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31:43: runtime > error: index 163 out of bounds for type 'jfrNativeEventSetting [162]' > #0 0x7f6b75a8634b in JfrEventSetting::setting(JfrEventId) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31 > #1 0x7f6b75a8634b in JfrEventSetting::set_stacktrace(long, bool) > /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp:47 > > Looks like the array in generated code is too small. > With > `jfrNativeEventSetting bits[NUMBER_OF_EVENTS];` > and > > static const int NUMBER_OF_EVENTS = 162; > static const int NUMBER_OF_RESERVED_EVENTS = 2; > > > Access at index 163 cannot work. > But it looks like there is always enough memory after the array so we do not > crash and it was not noticed before. LGTM - Marked as reviewed by jbechberger (Committer). PR Review: https://git.openjdk.org/jdk/pull/19628#pullrequestreview-2108008694
RFR: 8332699: ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
When running hs :tier1 tests or jdk/jfr tests, with ubsan enabled (configure flag --enable-ubsan), in a lot of jfr related tests like compiler/intrinsics/klass/CastNullCheckDroppingsTest.jtr serviceability/jvmti/RedefineClasses/RedefineSharedClassJFR.jtr this oob error can be seen : /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]' #0 0x7f6b75a8634b in JfrEventSetting::setting(JfrEventId) /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.inline.hpp:31 #1 0x7f6b75a8634b in JfrEventSetting::set_stacktrace(long, bool) /jdk/src/hotspot/share/jfr/recorder/jfrEventSetting.cpp:47 Looks like the array in generated code is too small. With `jfrNativeEventSetting bits[NUMBER_OF_EVENTS];` and static const int NUMBER_OF_EVENTS = 162; static const int NUMBER_OF_RESERVED_EVENTS = 2; Access at index 163 cannot work. But it looks like there is always enough memory after the array so we do not crash and it was not noticed before. - Commit messages: - JDK-8332699 Changes: https://git.openjdk.org/jdk/pull/19628/files Webrev: https://webrevs.openjdk.org/?repo=jdk=19628=00 Issue: https://bugs.openjdk.org/browse/JDK-8332699 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/19628.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/19628/head:pull/19628 PR: https://git.openjdk.org/jdk/pull/19628