RFR: 8297877: Risk for uninitialized memory in case of CHECK macro early return as part of field access

Calvin Cheung ccheung at openjdk.org
Thu Jan 12 16:39:15 UTC 2023


On Wed, 11 Jan 2023 15:48:31 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

> Greetings,
> 
> this change removes the risk of accessing uninitialized memory as part of field access when using the jfrJavaSupport abstraction, in case the klass->initialize(CHECK) early outs.
> 
> It includes a small refactoring when in the area.
> 
> Testing: jdk_jfr
> 
> Thanks
> Markus

Looks good. Just couple of nits below.

src/hotspot/share/jfr/jni/jfrJavaSupport.cpp line 489:

> 487: 
> 488: void JfrJavaSupport::get_field_local_ref(JfrJavaArguments* args, TRAPS) {
> 489:   get_field_ref(args, true, THREAD);

I'd suggest add a comment for the bool arg like the following:
`get_field_ref(args, true /* local_ref */, THREAD);`

src/hotspot/share/jfr/jni/jfrJavaSupport.cpp line 493:

> 491: 
> 492: void JfrJavaSupport::get_field_global_ref(JfrJavaArguments* args, TRAPS) {
> 493:   get_field_ref(args, false, THREAD);

Same suggestion as above:
`get_field_ref(args, false /* local_ref */, THREAD);`

-------------

Marked as reviewed by ccheung (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11950


More information about the hotspot-jfr-dev mailing list