Fix mono_class_setup_interfaces race-condition on ARM64#2220
Open
nulldatamap wants to merge 7 commits into
Open
Fix mono_class_setup_interfaces race-condition on ARM64#2220nulldatamap wants to merge 7 commits into
nulldatamap wants to merge 7 commits into
Conversation
UnityAlex
reviewed
Jul 14, 2026
UnityAlex
approved these changes
Jul 15, 2026
Author
|
I ran the Windows ARM64 build with b15853c and it succeeded: https://yamato.ds.unity3d.com/job/71688177. Normally it would crash on the assert because the build runs the editor. |
Author
|
Alright I have proof of the old offsets failing on WinARM64: https://yamato.ds.unity3d.com/job/71759109 |
nulldatamap
force-pushed
the
fix-setup-interfaces-arm64
branch
from
July 17, 2026 11:45
e19fa21 to
eb1b8e4
Compare
nulldatamap
force-pushed
the
fix-setup-interfaces-arm64
branch
from
July 17, 2026 11:46
eb1b8e4 to
06c860d
Compare
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 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.
Summary
On ARM64 the weak memory ordering model makes the
mono_class_setup_interfacescode racy, causing segfaults.The fix is to use a load-acquire when reading
klass->interfaces_inited.Fixes UUM-144819.
The Problem
I have a detailed explanation of the problem in the comment included with the fix.
Testing
I've tested that solution works against a repro and I had a general sanity assert to ensure the bitfield offset was correct (see commit 6b098b5)
Reviewers: please consider these questions as well! ❤️
Release notes
Fixed UUM-144819 @nulldatamap:
Mono: Fix race condition during interface initialization on ARM64.
Backports
6000.0, 6000.3, 6000.5, 6000.6