Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

ChengJin01
Copy link

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 [email protected]

@ChengJin01
Copy link
Author

ChengJin01 commented Nov 10, 2023

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
Author

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

Reviewer: @gacholio
FYI: @TobiAjila, @pshipton

@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 <[email protected]>
@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
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