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

Check RomClass is in SCC before storing IProf Data #2510

Merged
merged 1 commit into from
Aug 1, 2018

Conversation

dsouzai
Copy link
Contributor

@dsouzai dsouzai commented Jul 30, 2018

The following race is possible:

  1. Thread 1 calls TR_IPBCDataCallGraph::canBePersisted on Entry A,
    which succeeds. However, at least one class in the list is NULL
  2. Thread 2 calls TR_IPBCDataCallGraph::setData on Entry A, which
    also succeeds, setting one of the classes that was previous NULL
    to something non-NULL.
  3. Thread 1 calls TR_IPBCDataCallGraph::createPersistentCopy.
    Normally if a class in the list is NULL, the value stored is also
    NULL. However, because Thread 2 updated some previously NULL class,
    Thread 1 will compute the difference of
    (ramClass->romClass - startOfSCC) and potentially get a value
    that's bigger than the SCC.

This commit checks for this race before persisting IProfiler data.

@dsouzai
Copy link
Contributor Author

dsouzai commented Jul 30, 2018

@mpirvu Could you please review.

* the romClass is within the SCC.
*/
if (romClass >= cacheStartAddress)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do we test that the romClass after the SCC?

@dsouzai
Copy link
Contributor Author

dsouzai commented Jul 31, 2018

@mpirvu Changes made.

On a related note, shouldn't this https://github.com/eclipse/openj9/pull/2510/files#diff-31c18c7318f7ce5d1b5699cf26523d07R2999 be romClass >= cacheStartAddress+cacheSize, namely greater than or equal to, instead of just greater than?

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.

LGTM

@mpirvu
Copy link
Contributor

mpirvu commented Jul 31, 2018

In reply to #2510 (comment)
the answer is yes you are correct.

@mpirvu mpirvu self-assigned this Jul 31, 2018
The following race is possible:

1. Thread 1 calls TR_IPBCDataCallGraph::canBePersisted on Entry A,
   which succeeds. However, at least one class in the list is NULL
2. Thread 2 calls TR_IPBCDataCallGraph::setData on Entry A, which
   also succeeds, setting one of the classes that was previous NULL
   to something non-NULL.
3. Thread 1 calls TR_IPBCDataCallGraph::createPersistentCopy.
   Normally if a class in the list is NULL, the value stored is also
   NULL. However, because Thread 2 updated some previously NULL class,
   Thread 1 will compute the difference of
   (ramClass->romClass - startOfSCC) and potentially get a value
   that's bigger than the SCC.

This commit checks for this race before persisting IProfiler data.

Signed-off-by: Irwin D'Souza <dsouzai@ca.ibm.com>
@dsouzai
Copy link
Contributor Author

dsouzai commented Jul 31, 2018

Fixed the copyright and added the >= to the line specified in #2510 (comment)

@mpirvu
Copy link
Contributor

mpirvu commented Jul 31, 2018

jenkins test all

@mpirvu
Copy link
Contributor

mpirvu commented Aug 1, 2018

The few failures are not related to this PR, so merging.

@mpirvu mpirvu merged commit 9f32548 into eclipse-openj9:master Aug 1, 2018
@dsouzai dsouzai deleted the iprofilerRace branch October 15, 2019 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants