Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

janvorli
Copy link
Member

We call the ExecutableAllocator from two places in PAL. One is the
VirtualAlloc when the allocation type contains MEM_RESERVE_EXECUTABLE.
The other is MAPMapPEFile.
While the former is called inside of the virtual_critsec critical section,
the latter doesn't take that critical section and so in some race cases,
we were returning the same address twice - once for VirtualAlloc and
once for MAPMapPEFile. That resulted in strange memory corruption cases.
The fix is to use the same critical section for the MAPMapPEFile too.

I am also reverting the change in the virtual commit that was made when
we have thought that the culprit might be in the mprotect.

We call the ExecutableAllocator from two places in PAL. One is the
VirtualAlloc when the allocation type contains MEM_RESERVE_EXECUTABLE.
The other is MAPMapPEFile.
While the former is called inside of the virtual_critsec critical section,
the latter doesn't take that critical section and so in some race cases,
we were returning the same address twice - once for VirtualAlloc and
once for MAPMapPEFile. That resulted in strange memory corruption cases.
The fix is to use the same critical section for the MAPMapPEFile too.

I am also reverting the change in the virtual commit that was made when
we have thought that the culprit might be in the mprotect.
@gkhanna79
Copy link
Member

Cool! @sergiy-k Did you get a chance to run this locally where you could reproduce the problem?

@sergiy-k
Copy link

No, not yet. I'm building it right now.

@sergiy-k
Copy link

@dotnet-bot test Ubuntu Checked pri1r2r please

@sergiy-k
Copy link

@dotnet-bot test OSX Checked pri1r2r please

@sergiy-k
Copy link

@dotnet-bot test Windows_NT x64 Release Priority 1 Build and Test please

@sergiy-k
Copy link

The results for Ubuntu R2R tests look OK. There is one failure due to a known issue (https://github.com/dotnet/coreclr/issues/5501).

@sergiy-k sergiy-k merged commit aa8aef1 into dotnet:release/1.0.0 Jun 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants