Skip to content
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

[Arm64/Unix] Crossgen Microsoft.CodeAnalysis.dll segmentation fault #8921

Closed
sdmaclea opened this issue Sep 13, 2017 · 5 comments · Fixed by dotnet/coreclr#14016
Closed

[Arm64/Unix] Crossgen Microsoft.CodeAnalysis.dll segmentation fault #8921

sdmaclea opened this issue Sep 13, 2017 · 5 comments · Fixed by dotnet/coreclr#14016
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug

Comments

@sdmaclea
Copy link
Contributor

On 7d6cc7c, I am seeing segmentation fault when running

./crossgen /MissingDependenciesOK /Platform_Assemblies_Paths $PWD Microsoft.CodeAnalysis.dll

The problem did not exist on 18ab356

@sdmaclea
Copy link
Contributor Author

Backtrace

#0  Compiler::gtTryRemoveBoxUpstreamEffects (this=0xffffb4bd0020, op=0xffffb4bd5d48, options=Compiler::BR_REMOVE_AND_NARROW_WANT_TYPE_HANDLE) at /home/vmjenkins/workspace/Dotnet/build_and_test/src/jit/gentree.cpp:12534
dotnet/coreclr#1  0x0000ffffb6b63c2c in Compiler::impIntrinsic (this=0xffffb4bd0020, newobjThis=0x0, clsHnd=0xffffb71b7470, method=<optimized out>, sig=0xffffffffd8d8, memberRef=167772316, readonlyCall=<error reading variable: access outside bounds of object referenced via synthetic p
ointer>, tailCall=<error reading variable: access outside bounds of object referenced via synthetic pointer>, isJitIntrinsic=<error reading variable: access outside bounds of object referenced via synthetic pointer>, pIntrinsicID=<optimized out>, isSpecialIntrinsic=0x0)
at /home/vmjenkins/workspace/Dotnet/build_and_test/src/jit/importer.cpp:3627
dotnet/coreclr#2  0x0000ffffb6b6c444 in Compiler::impImportCall (this=0xffffb4bd0020, opcode=<optimized out>, pResolvedToken=<optimized out>, pConstrainedResolvedToken=<optimized out>, newobjThis=<optimized out>, prefixFlags=<optimized out>, callInfo=0xffffffffd8c8, rawILOffset=<optim
ized out>) at /home/vmjenkins/workspace/Dotnet/build_and_test/src/jit/importer.cpp:6925
dotnet/coreclr#3  0x0000ffffb6b725c0 in Compiler::impImportBlockCode (this=<optimized out>, block=<optimized out>) at /home/vmjenkins/workspace/Dotnet/build_and_test/src/jit/importer.cpp:13246
dotnet/coreclr#4  0x0000ffffb6b8189c in Compiler::impImportBlock(BasicBlock*)::$_1::operator()(Compiler::impImportBlock(BasicBlock*)::FilterVerificationExceptionsParam*) const (this=<optimized out>, pParam=<optimized out>) at /home/vmjenkins/workspace/Dotnet/build_and_test/src/jit/imp
orter.cpp:16067
dotnet/coreclr#5  Compiler::impImportBlock (this=0xffffb4bd0020, block=0xffffb4bd5080) at /home/vmjenkins/workspace/Dotnet/build_and_test/src/jit/importer.cpp:16077
dotnet/coreclr#6  0x0000ffffb6b83c0c in Compiler::impImport (this=<optimized out>, method=<optimized out>) at /home/vmjenkins/workspace/Dotnet/build_and_test/src/jit/importer.cpp:17154
dotnet/coreclr#7  0x0000ffffb6b30a3c in Compiler::fgImport (this=0xffffb4bd0020) at /home/vmjenkins/workspace/Dotnet/build_and_test/src/jit/flowgraph.cpp:6800
dotnet/coreclr#8  0x0000ffffb6b18790 in Compiler::compCompile (this=<optimized out>, methodCodePtr=<optimized out>, methodCodeSize=<optimized out>, compileFlags=<optimized out>) at /home/vmjenkins/workspace/Dotnet/build_and_test/src/jit/compiler.cpp:4386
dotnet/coreclr#9  0x0000ffffb6b1aec4 in Compiler::compCompileHelper (this=0xffffb4bd0020, classPtr=<optimized out>, compHnd=<optimized out>, methodInfo=0xffffffffe5a0, methodCodePtr=0xffffffffe060, methodCodeSize=0xffffffffe0bc, compileFlags=0xffffffffe070, instVerInfo=<optimized out>

src/jit/gentree.cpp

12524|     // If we're eventually going to return the type handle, remember it now.
12525|     GenTree* boxTypeHandle = nullptr;
12526|     if (options == BR_REMOVE_AND_NARROW_WANT_TYPE_HANDLE)
12527|     {
12528|         // Note we might see GenTreeAllocObj here, if impImportAndPushBox
12529|         // starts using it instead of a bare helper call.
12530|         GenTree* asgSrc = asg->gtOp.gtOp2;
12531|         assert(asgSrc->IsCall());
12532|         GenTreeCall*    newobjCall = asgSrc->AsCall();
12533|         GenTreeArgList* newobjArgs = newobjCall->gtCallArgs->AsArgList();
12534+>        boxTypeHandle              = newobjArgs->Current();
12535|         assert(boxTypeHandle != nullptr);

newobjArgs is null

@sdmaclea
Copy link
Contributor Author

@dotnet/jit-contrib PTAL might be related to intrinsic implementation

@AndyAyersMS
Copy link
Member

Yeah, this is code I added recently. Will take a look.

@AndyAyersMS AndyAyersMS self-assigned this Sep 15, 2017
@janvorli
Copy link
Member

@AndyAyersMS I can see similar issue when building the dotnet/cli repo modified so that it uses the latest shared framework - see dotnet/cli#7606. It fails on all architectures on Unix, but not on Windows.

You can easily repro it locally if the @sdmaclea's repro doesn't work for you:

  • Checkout the latest dotnet/cli
  • Modify the build/DependencyVersions.props like in the PR mentioned above (to version 2.1.0-preview1-25714-02)
  • Run ./build.sh --configuration release

After the segfault, see the command line above the failure message and run just that under a debugger to get the repro.
On my box, the command line was:
/home/janvorli/git/cli/.nuget/packages/runtime.linux-x64.microsoft.netcore.app/2.1.0-preview1-25714-02/tools/crossgen -readytorun -in "/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Microsoft.CodeAnalysis.dll" -out "/tmp/tmpEKAVT6.tmp" -platform_assemblies_paths /home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/15.0/Microsoft.Common.CrossTargeting.targets/ImportAfter/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/15.0/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/15.0/Microsoft.Common.targets/ImportAfter/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/15.0/SolutionFile/ImportAfter/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/cs/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/de/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/en/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/es/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Extensions/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/fr/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/cs/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/de/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/es/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/fr/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/it/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/ja/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/ko/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/pl/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/pt-BR/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/ru/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/tr/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/zh-Hans/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/FSharp/zh-Hant/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/it/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/ja/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/ko/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Microsoft/Microsoft.NET.Build.Extensions/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/pl/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/pt-BR/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/cs/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/de/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/es/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/fr/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/it/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/ja/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/ko/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/pl/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/pt-BR/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/ru/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/runtimes/any/native/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/runtimes/unix/lib/netstandard1.3/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/runtimes/win/lib/netstandard1.3/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/tr/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/zh-Hans/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/Roslyn/zh-Hant/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/ru/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/runtimes/unix/lib/netstandard1.3/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/runtimes/win/lib/netstandard1.3/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/tr/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/zh-Hans/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/sdk/2.1.0-preview1-007172/zh-Hant/:/home/janvorli/git/cli/bin/2/linux-x64/dotnet/shared/Microsoft.NETCore.App/2.1.0-preview1-25714-02 -JITPath /home/janvorli/git/cli/.nuget/packages/runtime.linux-x64.microsoft.netcore.app/2.1.0-preview1-25714-02/runtimes/linux-x64/native/libclrjit.so

My call stack when the segfault occured was:

* thread dotnet/coreclr#1: tid = 51384, 0x00007ffff4ec6f59 libclrjit.so`Compiler::gtTryRemoveBoxUpstreamEffects(GenTree*, Compiler::BoxRemovalOptions) + 57, name = 'crossgen', stop reason = signal SIGSEGV: invalid address (fault address: 0x38)
  * frame #0: 0x00007ffff4ec6f59 libclrjit.so`Compiler::gtTryRemoveBoxUpstreamEffects(GenTree*, Compiler::BoxRemovalOptions) + 57
    frame dotnet/coreclr#1: 0x00007ffff4edf500 libclrjit.so`Compiler::impImportCall(opcode_t, CORINFO_RESOLVED_TOKEN*, CORINFO_RESOLVED_TOKEN*, GenTree*, int, CORINFO_CALL_INFO*, unsigned int) + 24752
    frame dotnet/coreclr#2: 0x00007ffff4eec08d libclrjit.so`Compiler::impImportBlockCode(BasicBlock*) + 41981
    frame dotnet/coreclr#3: 0x00007ffff4e725d2 libclrjit.so`Compiler::compCompile(void**, unsigned int*, JitFlags*) + 1042
    frame dotnet/coreclr#4: 0x00007ffff4e8f238 libclrjit.so`Compiler::compCompile(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*) + 9336
    frame dotnet/coreclr#5: 0x00007ffff4e91995 libclrjit.so`jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*) + 3445
    frame dotnet/coreclr#6: 0x00007ffff4e94649 libclrjit.so`CILJit::compileMethod(ICorJitInfo*, CORINFO_METHOD_INFO*, unsigned int, unsigned char**, unsigned int*) + 153
    frame dotnet/coreclr#7: 0x00000000006887f6 crossgen`ZapInfo::CompileMethod() + 534
    frame dotnet/coreclr#8: 0x0000000000681fcb crossgen`ZapImage::TryCompileMethodWorker(CORINFO_METHOD_STRUCT_*, unsigned int, unsigned int) + 635
    frame dotnet/coreclr#9: 0x0000000000680e47 crossgen`ZapImage::TryCompileMethodDef(unsigned int, unsigned int) + 199
    frame dotnet/coreclr#10: 0x0000000000681536 crossgen`ZapImage::CompileColdRegion() + 166
    frame dotnet/coreclr#11: 0x0000000000681737 crossgen`ZapImage::Compile() + 23
    frame dotnet/coreclr#12: 0x000000000067b7a5 crossgen`Zapper::CompileModule(CORINFO_MODULE_STRUCT_*, IMetaDataAssemblyEmit*) + 197
    frame dotnet/coreclr#13: 0x000000000067a91f crossgen`Zapper::CompileAssembly(_GUID*) + 655
    frame dotnet/coreclr#14: 0x00000000006779e2 crossgen`Zapper::Compile(char16_t const*, _GUID*) + 402
    frame dotnet/coreclr#15: 0x0000000000677624 crossgen`NGenWorker + 516
    frame dotnet/coreclr#16: 0x00000000004ec378 crossgen`wmain(int, char16_t**) + 3944
    frame dotnet/coreclr#17: 0x00000000004ec78e crossgen`main + 206
    frame dotnet/coreclr#18: 0x00007ffff65a9f45 libc.so.6`__libc_start_main(main=(crossgen`main), argc=10, argv=0x00007fffffffd048, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007fffffffd038) + 245 at libc-start.c:287
    frame dotnet/coreclr#19: 0x00000000004ea3b4 crossgen`_start + 41

AndyAyersMS referenced this issue in AndyAyersMS/coreclr Sep 15, 2017
In some R2R expansions the type handle is not an explicit operand to
the newobj helper. So we must bail out of removal attempts when the
type handle is desired and we see such an expansion.

Closes #13942.
Also likely will fix #XXX (grumble).
AndyAyersMS referenced this issue in AndyAyersMS/coreclr Sep 15, 2017
In some R2R expansions the type handle is not an explicit operand to
the newobj helper. So we must bail out of removal attempts when the
type handle is desired and we see such an expansion.

Closes #13942.
Also likely will fix #13930.
@AndyAyersMS
Copy link
Member

Thanks @janvorli. I was able to repro this locally on Ubuntu and have a fix out for PR.

AndyAyersMS referenced this issue in dotnet/coreclr Sep 15, 2017
In some R2R expansions the type handle is not an explicit operand to
the newobj helper. So we must bail out of removal attempts when the
type handle is desired and we see such an expansion.

Closes #13942.
Also likely will fix #13930.
@msftgits msftgits transferred this issue from dotnet/coreclr Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants