-
Notifications
You must be signed in to change notification settings - Fork 5k
[release/9.0-staging] [mono] Missing memory barrier leads to crash in multi-threaded scenarios #113740
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
Merged
steveisok
merged 4 commits into
release/9.0-staging
from
backport/pr-113140-to-release/9.0-staging
Mar 31, 2025
Merged
[release/9.0-staging] [mono] Missing memory barrier leads to crash in multi-threaded scenarios #113740
steveisok
merged 4 commits into
release/9.0-staging
from
backport/pr-113140-to-release/9.0-staging
Mar 31, 2025
Conversation
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
This was referenced Mar 20, 2025
jeffschwMSFT
approved these changes
Mar 25, 2025
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.
lgtm. please get a code review. we will take for consideration in 9.0.x
BrzVlad
reviewed
Mar 25, 2025
kg
reviewed
Mar 26, 2025
Co-authored-by: Aleksey Kliger (λgeek) <alklig@microsoft.com>
BrzVlad
approved these changes
Mar 26, 2025
This was referenced Mar 26, 2025
Open
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport of #113140 to release/9.0-staging
/cc @kg
Customer Impact
In specific multithreaded scenarios, a null pointer is dereferenced by the runtime due to an initialization race condition, causing a crash. A customer observed this on Android. This does not expose uninitialized memory, just zeroed memory that hasn't been filled in yet.
Regression
47c09fa (.NET 7)
Testing
We are relying on CI and customer validation for this as they are embedding an application with Unreal Engine. It is unclear why the race condition was overlooked originally.
Risk
Low risk. This adds asserts for deterministic early failure (especially on targets where it is legal to dereference null, like wasm) and adds an additional memory barrier in a specific place, so it should not be possible for it to cause an undesirable behavior regression.
The memory barrier could theoretically regress performance, but this is initialization code that runs rarely so the impact should be basically nil.