Skip to content

[mono][android-arm64] System.Threading.Volatile.ReadBarrier() never returns (hangs; or StackOverflow/SIGSEGV in deeper call chains) #130265

Description

@uholeschak

Description

Details:

  • net10.0-android36.1, RID android-arm64 (arm64-v8a), Debug, Mono JIT/interpreter (no AOT).
  • The [Intrinsic] is not recognized on this target; the self-referential managed
    fallback executes:
    • simple/direct call -> tail-call-optimized into an infinite loop -> HANGS forever
    • deep call chain (e.g. Roslyn CSharpCompilation.Emit) -> stack grows ->
      StackOverflowException / native SIGSEGV (SEGV_ACCERR, fault addr 16 bytes
      below a 4 KB page boundary, e.g. 0x...ff0; observed on Thread-18).
  • Output target is irrelevant: MemoryStream vs temp FileStream makes no difference.

Real-world trigger / version boundary:
Microsoft.CodeAnalysis.CSharp 5.3.0 -> OK
Microsoft.CodeAnalysis.CSharp 5.6.0 -> crash (calls ReadBarrier() during Emit)

Ruled out (all reproduce unchanged):
concurrentBuild:false; 16 MB thread stack; CreateFromStream; DOTNET_EnableHWIntrinsic=0;
all ~80 reference assemblies validated intact via PEReader.

Reproduction Steps

Simply execute in net10.0-android36.1:
Minimal repro (no Roslyn, no stream):
System.Threading.Volatile.ReadBarrier(); // never returns
ReadBarrier() hangs and finally generates a stack overflow

Expected behavior

System.Threading.Volatile.ReadBarrier();
should not crash.

Actual behavior

ReadBarrier() hangs and finally generates a stack overflow

Regression?

The problem occurs in combination with Microsoft.CodeAnalysis.CSharp.Scripting 5.6.0, because only this version uses ReadBarrier().
With Microsoft.CodeAnalysis.CSharp.Scripting 5.3.0 there is no problem.

Known Workarounds

Use Microsoft.CodeAnalysis.CSharp.Scripting 5.3.0 to avoid calling ReadBarrier().
Do not use Microsoft.CodeAnalysis.CSharp.Scripting 5.6.0 in net10.0-android36.1

Configuration

.NET SDK: 10.0.301

Android workload:
Workloadversion: 10.0.301.1

Installierte Workload-ID Manifestversion Installationsquelle

android 36.1.69/10.0.100 SDK 10.0.300, VS 18.7.11925.98
ios 26.5.10284/10.0.100 SDK 10.0.300, VS 18.7.11925.98
maccatalyst 26.5.10284/10.0.100 SDK 10.0.300, VS 18.7.11925.98
maui-windows 10.0.20/10.0.100 SDK 10.0.300, VS 18.7.11925.98

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area ownersuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions