Skip to content

[Verifier] Fix the field access issue with putfield/getfield - #18440

Merged
gacholio merged 1 commit into
eclipse-openj9:masterfrom
ChengJin01:bcv_fix_field_access_putfield_initialization
Nov 12, 2023
Merged

[Verifier] Fix the field access issue with putfield/getfield#18440
gacholio merged 1 commit into
eclipse-openj9:masterfrom
ChengJin01:bcv_fix_field_access_putfield_initialization

Conversation

@ChengJin01

Copy link
Copy Markdown

The changes aim to capture the corner case when
the specified field doesn't exist in the current
class or it is intentionally accessed by a hostile
subclass prior to its superclass's initialization
when it belongs to one of the superclasses.

Related: #16524

Signed-off-by: ChengJin01 jincheng@ca.ibm.com

@ChengJin01

ChengJin01 commented Nov 10, 2023

Copy link
Copy Markdown
Author

The idea is: for an instance initialization method of the subclass, the access to the superclass's fields must be delayed till the superclass's initialization is finished; otherwise, the fields must belong to the subclass.

The correct output (matching the RI's output at #16524 (comment)) is as follows:

Error: Unable to initialize main class AcceptInvalid01
Caused by: java.lang.VerifyError: JVMVRFY021 thrown object not throwable; 
class=AcceptInvalid01, method=<init>()V, pc=22
Exception Details:
  Location:
    AcceptInvalid01.<init>()V @22: JBputfield
  Reason:
    Type 'uninitializedThis' (current frame, stack[0]) is not assignable to 'AcceptInvalid01'
  Current Frame:
    bci: @22
    flags: { flagThisUninit }
    locals: { 'uninitializedThis' }
    stack: { 'uninitializedThis' }

@ChengJin01

Copy link
Copy Markdown
Author

The PR is verified in internal & external builds (Java 8, 11, 17, 21, and beyond).

Reviewer: @gacholio
FYI: @TobiAjila, @pshipton

Comment thread runtime/bcverify/vrfyhelp.c Outdated
Comment thread runtime/bcverify/vrfyhelp.c Outdated
Comment thread runtime/bcverify/vrfyhelp.c Outdated
Comment thread runtime/bcverify/vrfyhelp.c Outdated
Comment thread runtime/bcverify/vrfyhelp.c Outdated
@ChengJin01
ChengJin01 force-pushed the bcv_fix_field_access_putfield_initialization branch from 8c9de2a to 2d5bf3b Compare November 10, 2023 19:59
The changes aim to capture the corner case when
the specified field doesn't exist in the current
class or it is intentionally accessed by a hostile
subclass prior to its superclass's initialization
when it belongs to one of the superclasses.

Related: eclipse-openj9#16524

Signed-off-by: ChengJin01 <jincheng@ca.ibm.com>
@ChengJin01
ChengJin01 force-pushed the bcv_fix_field_access_putfield_initialization branch from 2d5bf3b to e241c4d Compare November 10, 2023 20:35
@gacholio

Copy link
Copy Markdown
Contributor

jenkins test sanity win jdk21

@gacholio
gacholio merged commit 8fa4dd4 into eclipse-openj9:master Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants