[mono] Allocate helper page with mono_valloc so it doesn't confuse instruments#120060
Merged
BrzVlad merged 2 commits intodotnet:mainfrom Sep 25, 2025
Merged
[mono] Allocate helper page with mono_valloc so it doesn't confuse instruments#120060BrzVlad merged 2 commits intodotnet:mainfrom
BrzVlad merged 2 commits intodotnet:mainfrom
Conversation
…net#119754)" This reverts commit 9031045.
mono_valloc uses mmap behind the scene.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR changes how the helper page is allocated in the mono runtime's process-wide memory barrier implementation to avoid confusing profiling instruments. The key change replaces posix_memalign with mono_valloc (which uses mmap) and restructures when memory protection is set.
- Replaces
posix_memalignallocation withmono_vallocto use mmap-based allocation - Moves memory protection setup to occur before page access rather than after
- Removes the protection restoration logic that was specifically added to avoid confusing profiling tools
Comments suppressed due to low confidence (1)
src/mono/mono/utils/mono-threads-posix.c:1
- The code writes to the helper page at line 304 but then immediately removes all access permissions at line 306. This creates a memory leak scenario where the page remains allocated but inaccessible for future barrier operations, potentially causing crashes on subsequent calls to this function.
/**
Member
Author
jkotas
approved these changes
Sep 24, 2025
lateralusX
approved these changes
Sep 25, 2025
Member
Author
|
/ba-g This change doesn't touch wasm bits. |
Member
Author
|
/backport to release/10.0 |
Contributor
|
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/18160368930 |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mono_valloc uses mmap behind the scene.