-
Notifications
You must be signed in to change notification settings - Fork 720
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
Always call classMatchesCachedVersion in rememberClass #15037
Conversation
@mstoodle could you please review/merge? @JamesKingdon fyi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Initially, I had some doubts about the ClassChainValidationCaching used in classMatchesCachedVersion()
, but I think we are ok. I was afraid that we could call classMatchesCachedVersion() with a <j9class, existingClassChain> pair, store CCVResult::success
in the cache, then later on call again classMatchesCachedVersion() with <j9class, anotherExistingClassChain> and use the cache to draw the wrong conclusion.
However, I think we are safe because for a ROMClass there could only be one existingClassChain, so the scenario with 'anotherExistingClassChain" cannot happen.
See eclipse-openj9#15013 for more details. It is possible for two J9Classes to have the same J9ROMClass but have different class chains. However, because a class chain is stored into the SCC using a key derived from the J9ROMClass, it isn't possible to store different class chains that have the same first J9ROMClass in the chain. This can lead to undefined behaviour as invalid AOT code can be executed. This commit fixes the issue by changing the code that assumes that if it can find an existing class chain in the SCC for a given J9Class, that it is valid for said J9Class. The code now always validates the class chain. Signed-off-by: Irwin D'Souza <dsouzai.gh@gmail.com>
@mstoodle made requested changes; reworded it slightly to be more consistent with each other. |
jenkins test sanity all jdk17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @dsouzai
See #15013 for more details.
It is possible for two J9Classes to have the same J9ROMClass but have
different class chains. However, because a class chain is stored into
the SCC using a key derived from the J9ROMClass, it isn't possible to
store different class chains that have the same first J9ROMClass in the
chain. This can lead to undefined behaviour as invalid AOT code can be
executed.
This PR fixes the issue by changing the code that assumes that if it
can find an existing class chain in the SCC for a given J9Class, that it
is valid for said J9Class. The code now always validates the class
chain.
Closes #15013