The generated JfrNativeSettings union holds an array of settings ("bits") overlayed with named structures ("ev"). The latter only exists for debugging:
```
union JfrNativeSettings {
// Array version.
jfrNativeEventSetting bits[NUMBER_OF_EVENTS];
// Then, to make it easy to debug,
// add named struct members also.
struct {
jfrNativeEventSetting pad[NUMBER_OF_RESERVED_EVENTS];
jfrNativeEventSetting Duration;
jfrNativeEventSetting Instant;
jfrNativeEventSetting Value;
jfrNativeEventSetting Text;
jfrNativeEventSetting ZThreadDebug;
...
jfrNativeEventSetting DeprecatedInvocation;
jfrNativeEventSetting StackFrame;
} ev;
};
```
I noticed that sizes of `bits` vs `ev` did not match up (even adding the fix Matthias proposed forJDK-8332699). Looks like the `ev` substructure contains members that are not events:
```
jfrNativeEventSetting VirtualSpace;
jfrNativeEventSetting ObjectSpace;
...
jfrNativeEventSetting MetaspaceSizes;
...
jfrNativeEventSetting CopyFailed;
...
jfrNativeEventSetting G1EvacuationStatistics;
...
jfrNativeEventSetting CalleeMethod;
...
jfrNativeEventSetting StackFrame;
```
These are types of fields, not events. Therefore, the overlayed named structures would not match up against their corresponding bits[event id] slot.
The ev substructure is not used during building, so I assume one only notices during debugging.
(error relates to, but is different from, the issue described inJDK-8332699)
```
union JfrNativeSettings {
// Array version.
jfrNativeEventSetting bits[NUMBER_OF_EVENTS];
// Then, to make it easy to debug,
// add named struct members also.
struct {
jfrNativeEventSetting pad[NUMBER_OF_RESERVED_EVENTS];
jfrNativeEventSetting Duration;
jfrNativeEventSetting Instant;
jfrNativeEventSetting Value;
jfrNativeEventSetting Text;
jfrNativeEventSetting ZThreadDebug;
...
jfrNativeEventSetting DeprecatedInvocation;
jfrNativeEventSetting StackFrame;
} ev;
};
```
I noticed that sizes of `bits` vs `ev` did not match up (even adding the fix Matthias proposed for
```
jfrNativeEventSetting VirtualSpace;
jfrNativeEventSetting ObjectSpace;
...
jfrNativeEventSetting MetaspaceSizes;
...
jfrNativeEventSetting CopyFailed;
...
jfrNativeEventSetting G1EvacuationStatistics;
...
jfrNativeEventSetting CalleeMethod;
...
jfrNativeEventSetting StackFrame;
```
These are types of fields, not events. Therefore, the overlayed named structures would not match up against their corresponding bits[event id] slot.
The ev substructure is not used during building, so I assume one only notices during debugging.
(error relates to, but is different from, the issue described in
- relates to
-
JDK-8332699 ubsan: jfrEventSetting.inline.hpp:31:43: runtime error: index 163 out of bounds for type 'jfrNativeEventSetting [162]'
-
- Resolved
-