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

Race condition fix for findThunkFromTerseSignature #3073

Merged
merged 1 commit into from
Sep 29, 2018

Conversation

IBMJimmyk
Copy link
Contributor

@IBMJimmyk IBMJimmyk commented Sep 28, 2018

match points to an entry inside a TR_PersistentArray in TR_J2IThunkTable.
Before returning from findThunkFromTerseSignature, the code attempts to
read from match->_thunk after leaving the critical section. This is bad
because if the TR_PersistentArray grows, the match pointer is stale and
may not point to the correct entry anymore.

This fix moves the read from match->_thunk into the critical section.
Assuming locking is handled properly in other areas, this will prevent the
match pointer from going stale unexpectedly and ensures a valid
match->_thunk.

Fixes: #3006
Signed-off-by: jimmyk jimmyk@ca.ibm.com

match points to an entry inside a TR_PersistentArray in TR_J2IThunkTable.
Before returning from findThunkFromTerseSignature, the code attempts to
read from match->_thunk after leaving the critical section. This is bad
because if the TR_PersistentArray grows, the match pointer is stale and
may not point to the correct entry anymore.

This fix moves the read from match->_thunk into the critical section.
Assuming locking is handled properly in other areas, this will prevent the
match pointer from going stale unexpectedly and ensures a valid
match->_thunk.

Issue: eclipse-openj9#3006
Signed-off-by: jimmyk <jimmyk@ca.ibm.com>
@irinarada
Copy link

@gita-omr - @andrewcraik is travelling this weekend, can anyone else review this? @mstoodle @vijaysun-omr @0xdaryl @fjeremic @zl-wang ?

@irinarada
Copy link

@pshipton FYI

@pshipton
Copy link
Member

@IBMJimmyk fyi you can use a keyword to auto-close the issue when the PR gets merged. I've already changed it.
https://help.github.com/articles/closing-issues-using-keywords/

@0xdaryl
Copy link
Contributor

0xdaryl commented Sep 29, 2018

Jenkins test sanity

@0xdaryl
Copy link
Contributor

0xdaryl commented Sep 29, 2018

@IBMJimmyk : the WIP will have to be removed before this is merged.

The proposed fix looks reasonable to me.

Copy link
Contributor

@mpirvu mpirvu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good and it fixes the problem mentioned in the description of the commit.

@gita-omr gita-omr self-assigned this Sep 29, 2018
@pshipton
Copy link
Member

jenkins test sanity all jdk11

@gita-omr gita-omr closed this Sep 29, 2018
@pshipton pshipton changed the title WIP: Race condition fix for findThunkFromTerseSignature Race condition fix for findThunkFromTerseSignature Sep 29, 2018
@pshipton
Copy link
Member

Pretty sure Gita meant to merge this and not close it.

@pshipton pshipton reopened this Sep 29, 2018
@gita-omr gita-omr merged commit c501846 into eclipse-openj9:master Sep 29, 2018
@IBMJimmyk IBMJimmyk deleted the SCM23MultiThread-fix branch April 5, 2019 19:09
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.

Test-extended.system-JDK11-linux_ppc-64_cmprssptrs_le SharedClasses.SCM23.MultiThread crash
6 participants