-
Notifications
You must be signed in to change notification settings - Fork 738
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
Race condition fix for findThunkFromTerseSignature #3073
Conversation
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>
316f185
to
7224498
Compare
@gita-omr - @andrewcraik is travelling this weekend, can anyone else review this? @mstoodle @vijaysun-omr @0xdaryl @fjeremic @zl-wang ? |
@pshipton FYI |
@IBMJimmyk fyi you can use a keyword to auto-close the issue when the PR gets merged. I've already changed it. |
Jenkins test sanity |
@IBMJimmyk : the WIP will have to be removed before this is merged. The proposed fix looks reasonable to me. |
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.
The code looks good and it fixes the problem mentioned in the description of the commit.
jenkins test sanity all jdk11 |
Pretty sure Gita meant to merge this and not close it. |
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