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

Fix interleaved heap RW commit failure handling #73566

Merged

Conversation

janvorli
Copy link
Member

@janvorli janvorli commented Aug 8, 2022

We were not checking the result of the ExecutableAllocator::Commit call
for mapping the RW page in the case of interleaved heaps. I've seen a
failure in the CI that seems to be caused by this - when we succeeded
committing the RX page, but failed to commit the related RW page, we
have then crashed when trying to initialize the precode stubs data.

This change adds the check to fix the problem. This causes the
LoaderHeap allocation to fail as expected in such case.

Close #71624

We were not checking the result of the ExecutableAllocator::Commit call
for mapping the RW page in the case of interleaved heaps. I've seen a
failure in the CI that seems to be caused by this - when we succeeded
committing the RX page, but failed to commit the related RW page, we
have then crashed when trying to initialize the precode stubs data.

This change adds the check to fix the problem. This causes the
LoaderHeap allocation to fail as expected in such case.
@janvorli janvorli added this to the 7.0.0 milestone Aug 8, 2022
@janvorli janvorli requested a review from jkotas August 8, 2022 14:45
@janvorli janvorli self-assigned this Aug 8, 2022
@@ -1304,14 +1304,17 @@ BOOL UnlockedLoaderHeap::GetMoreCommittedPages(size_t dwMinSize)
void *pData = ExecutableAllocator::Instance()->Commit(m_pPtrToEndOfCommittedRegion, dwSizeToCommitPart, IsExecutable());
if (pData == NULL)
{
_ASSERTE(!"Unable to commit a loaderheap page");
Copy link
Member Author

Choose a reason for hiding this comment

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

I have removed this assert since I've noticed the same CI test that uncovered the issue has failed due to this assert in another run. We should just return FALSE and let the caller handle the memory allocation failure.

Copy link
Member

Choose a reason for hiding this comment

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

I've seen this assert occasionally on macOS-arm64 Fuzzlyn runs but have not had time to create a repro case. When would we expect this to occur? In low memory situations or for other reasons too?

Copy link
Member Author

Choose a reason for hiding this comment

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

In low memory situation only.

@janvorli
Copy link
Member Author

janvorli commented Aug 9, 2022

The only failure in the CI tests is the known GetGCMemoryInfo failure on arm32.

@mangod9
Copy link
Member

mangod9 commented Aug 9, 2022

The only failure in the CI tests is the known GetGCMemoryInfo failure on arm32.

believe a change which might have caused this failure was reverted which should have avoided the failure. Perhaps your CI didnt pickup that change?

@janvorli
Copy link
Member Author

janvorli commented Aug 9, 2022

Perhaps your CI didnt pickup that change?

I think it didn't. I would have to close and reopen the PR to pick the latest changes in main. Since it was the only issue in the CI and it was known, I would just merge this. I was just waiting for an approval.

@janvorli janvorli merged commit 1dc5eba into dotnet:main Aug 9, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure GC\\LargeMemory\\API\\gc\\keepalive\\keepalive.cmd
3 participants