JIT: SIGSEGV in ABIPassingSegment::GetStackOffset / Lowering::LowerArg during FullOpts compilation when ObjectStackAllocation is enabled (.NET 11.0.0 regression)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- csharp
- 領域
- backend, compilers, performance
調査の方向性
Start by reading the JIT lowering path in Lowering::LowerArg and the ABIPassingSegment::GetStackOffset call shown in the backtrace, then use the provided C# reproduction with object stack allocation enabled to inspect the failing FullOpts compilation. The issue is reproduced on .NET 11.0.0 and avoided by disabling object stack allocation; done means the reproduction prints True and exits successfully with that feature enabled.
索引モデルが issue の本文から書いたものです。
説明
Description
RyuJIT deterministically crashes with SIGSEGV (EXC_BAD_ACCESS at 0x105) in ABIPassingSegment::GetStackOffset() const called from Lowering::LowerArg(GenTreeCall*, CallArg*) during FullOpts compilation on .NET 11.0.0 when object stack allocation is enabled.
Reproduction Steps
Repro.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>
</Project>
Program.cs:
using System;
using System.Runtime.CompilerServices;
public class C
{
public int x;
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
public static bool Check()
{
var c = new C();
return 0 == c.x && new int[0] != new int[0];
}
public static void Main() => Console.WriteLine(Check());
}
Run in Release mode:
dotnet run -c Release
Note: AggressiveOptimization is only used to trigger FullOpts on the first call. Without AggressiveOptimization, the exact same crash reproduces via any of:
DOTNET_TieredCompilation=0- Calling
Check()in a loop until Tier1 promotion - Loading the assembly into a collectible
AssemblyLoadContext("repro", isCollectible: true)(which compiles directly with FullOpts and skips Tier0;isCollectible: falsepasses on the first call under Tier0, and crashes withDOTNET_TieredCompilation=0or after Tier1 promotion)
Expected behavior
Prints True and exits with code 0.
Actual behavior
Crashes with SIGSEGV (exit code 139 / -11) while JIT-compiling C:Check().
DOTNET_JitDisasmSummary=1 output:
1: JIT compiled C:Main() [Tier0, IL size=11, code size=56]
Segmentation fault: 11
lldb backtrace (osx-arm64):
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x105)
frame #0: 0x0000000105896198 libclrjit.dylib`ABIPassingSegment::GetStackOffset() const
libclrjit.dylib`ABIPassingSegment::GetStackOffset:
-> 0x105896198 <+0>: ldr w0, [x0, #0x4]
0x10589619c <+4>: ret
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x105)
* frame #0: 0x0000000105896198 libclrjit.dylib`ABIPassingSegment::GetStackOffset() const
frame #1: 0x00000001059a9eac libclrjit.dylib`Lowering::LowerArg(GenTreeCall*, CallArg*) + 312
frame #2: 0x00000001059a7a94 libclrjit.dylib`Lowering::LowerCall(GenTree*) + 444
frame #3: 0x00000001059a62b4 libclrjit.dylib`Lowering::LowerNode(GenTree*) + 1568
frame #4: 0x00000001059b3194 libclrjit.dylib`Lowering::DoPhase() + 192
frame #5: 0x00000001059e97a4 libclrjit.dylib`Phase::Run() + 44
frame #6: 0x00000001058c61f0 libclrjit.dylib`Compiler::compCompile(void**, unsigned int*, JitFlags*) + 4996
frame #7: 0x00000001058c8030 libclrjit.dylib`Compiler::compCompileHelper(CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*) + 1304
frame #8: 0x00000001058c7290 libclrjit.dylib`Compiler::compCompileAfterInit(CORINFO_MODULE_STRUCT_*, void**, unsigned int*, JitFlags*) + 868
frame #9: 0x00000001058c84f8 libclrjit.dylib`jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*) + 336
frame #10: 0x00000001058cb3a8 libclrjit.dylib`CILJit::compileMethod(ICorJitInfo*, CORINFO_METHOD_INFO*, unsigned int, unsigned char**, unsigned int*) + 136
frame #11: 0x000000010525777c libcoreclr.dylib`UnsafeJitFunction(PrepareCodeConfig*, COR_ILMETHOD_DECODER*, bool*, bool*, unsigned int*) + 1012
frame #12: 0x000000010528a150 libcoreclr.dylib`MethodDesc::JitCompileCodeLocked(PrepareCodeConfig*, COR_ILMETHOD_DECODER*, ListLockEntryBase<NativeCodeVersion>*, unsigned int*, bool*) + 152
frame #13: 0x0000000105289b14 libcoreclr.dylib`MethodDesc::JitCompileCodeLockedEventWrapper(PrepareCodeConfig*, ListLockEntryBase<NativeCodeVersion>*) + 868
frame #14: 0x00000001052893f4 libcoreclr.dylib`MethodDesc::JitCompileCode(PrepareCodeConfig*) + 476
frame #15: 0x0000000105288fac libcoreclr.dylib`MethodDesc::PrepareCode(PrepareCodeConfig*) + 328
frame #16: 0x00000001052072a8 libcoreclr.dylib`CodeVersionManager::PublishVersionableCodeIfNecessary(MethodDesc*, CallerGCMode, bool*, bool*) + 632
frame #17: 0x000000010528c0f4 libcoreclr.dylib`MethodDesc::DoPrestub(MethodTable*, CallerGCMode) + 276
frame #18: 0x000000010528bac0 libcoreclr.dylib`PreStubWorker + 644
frame #19: 0x00000001053aa58c libcoreclr.dylib`ThePreStub + 80
Regression?
Yes. Changing <TargetFramework> to net10.0 (running on Microsoft.NETCore.App 10.0.15) prints True and exits 0.
Known Workarounds
DOTNET_JitObjectStackAllocation=0printsTrueand exits 0.DOTNET_JitObjectStackAllocationSize=0printsTrueand exits 0.DOTNET_JITMinOpts=1printsTrueand exits 0.- Debug builds (
dotnet run -c Debug) printTrueand exit 0.
Configuration
Reproduced on macOS arm64 (osx-arm64) and also observed on GitHub Actions ubuntu-latest (linux-x64) with .NET SDK 11.0.100 / runtime 11.0.0.
dotnet --info:
.NET SDK:
Version: 11.0.100
Commit: 297acf930f
Workload version: 11.0.100-manifests.08e30c08
MSBuild version: 18.12.2-1.26529.118+297acf930
Runtime Environment:
OS Name: Mac OS X
OS Version: 27.2
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/11.0.100
Host:
Version: 11.0.0
Architecture: arm64
Commit: 297acf930f
.NET SDKs installed:
10.0.404 [/usr/local/share/dotnet/sdk]
11.0.100 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 11.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 11.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other information
- Disabling
DOTNET_JitObjectStackAllocationRefClass=0,DOTNET_JitObjectStackAllocationArray=0,DOTNET_JitObjectStackAllocationBoxedValueClass=0,DOTNET_JitObjectStackAllocationConditionalEscape=0, orDOTNET_JitObjectStackAllocationTrackFields=0(including combiningRefClass=0,Array=0, andBoxedValueClass=0) still crashes;DOTNET_JitObjectStackAllocation=0orDOTNET_JitObjectStackAllocationSize=0avoids the crash. - Interestingly,
return 0 == c.x && new int[0] != new int[0];(andnew int[1] != new int[1]) crashes, whilereturn c.x == 0 && new int[0] != new int[0];does not.
- 主要言語
- C#
- スター
- 18.5k
- フォーク
- 5.8k
- 平均マージ
- 2日 8時間
- マージ済み PR(30日)
- 597
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/runtime のほかの issue
-
area-VM-meta-mono untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
area-Debugger-mono untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
dotnet/runtime#138494 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area-AssemblyLoader-mono untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/runtime#138493 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
JsonConsoleFormatter throws on NaN and infinite double and float values, failing the log call対応中かも @Mohamedadel-prog が 2 日前に担当しました。 オープンarea-Extensions-Logging untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
dotnet/runtime#138418 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
area-System.IO untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/runtime#138417 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
juandresrodca/AdminForge#69 ·
メンテナーはふだん 1 日以内に返信
-
Keep PublicAPI.Unshipped.txt sorted, with a guard, so concurrent API PRs stop conflicting on itオープンchore small tooling
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
BattletechModders/ModTek#256 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Facepunch/sbox-public#12484 ·
メンテナーはふだん 2 日以内に返信