[release/10.0][Android] Avoid calling membarrier on older Android versions#119054
Merged
jeffschwMSFT merged 2 commits intorelease/10.0from Aug 25, 2025
Merged
Conversation
jkotas
requested changes
Aug 25, 2025
jeffschwMSFT
approved these changes
Aug 25, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a crash on older Android versions (API 28 and earlier) when using CoreCLR by avoiding calls to the membarrier syscall that is disallowed on those platforms. The fix adds a runtime API level check to conditionally use membarrier only on Android API 29 (Q) and later.
Key changes:
- Added Android API level detection before calling membarrier
- Wrapped existing membarrier logic in conditional block for newer Android versions
- Maintains existing behavior on non-Android platforms
jkotas
approved these changes
Aug 25, 2025
Member
|
@simonrozsival please take a look at the ci failures. I can assist with merging |
Member
Author
|
@jeffschwMSFT the failing tests on android-arm64 are unrelated to this change (#118366, #118950) |
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.
Fixes #115480 in .NET 10 RC2, supersedes #118984.
This fix was part of #118161 but it wasn't ready before the RC snap. This PR includes only the necessary changes to fix the Android startup crash.
/cc @jkotas
Customer Impact
In .NET 10, we are shipping experimental support for CoreCLR on Android. On older Android versions, the
membarriersyscall is disallowed. Without this change, customers will not be able to test Android CoreCLR on devices running API 28 and earlier which are still supported by .NET.Regression
Testing
Manual testing on Android emulators running a wide range of API levels.
Risk
Low. The fix is scoped to the Android target. It is based on the existing code in
gcenv.unix.cpp.