-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
Description
I can build a functional SDK for linux-x86 for .NET 7 Preview 2 once I fix #68044 and disable ReadyToRun (which causes other issues I will dig into next)
This can run a hello world application OK.
After updating to preview 3, it fails with SIGSEGV. I bisected and the failure is introduced by eb8460f from #65738
If I revert this commit and rebuild preview 3 then everything works again - see the pipeline here:
https://github.com/Servarr/dotnet-linux-x86/tree/4b0474c30e5ea2900e14fbe94831d64d7f44b318
Reproduction Steps
On a linux-x64 host with a preview 3 SDK, run dotnet new console && dotnet build
Build .NET 7 preview 3 runtime for linux-x86. Example pipeline is here:
https://github.com/Servarr/dotnet-linux-x86/tree/4b0474c30e5ea2900e14fbe94831d64d7f44b318
Remove this line reverting the commit causing the issue:
https://github.com/Servarr/dotnet-linux-x86/blob/4b0474c30e5ea2900e14fbe94831d64d7f44b318/azure-pipelines.yml#L77
Run the output on the linux-x86 host (I'm using a ubuntu 20.04 docker with mulitlib support enabled) using the runtime generated above.
Expected behavior
Hello, World!
Actual behavior
(gdb) run ./bin/Debug/net7.0/helloworld2.dll
Starting program: /git_working/dotnet/dotnet ./bin/Debug/net7.0/helloworld2.dll
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0xf735db40 (LWP 300)]
[New Thread 0xf69ffb40 (LWP 301)]
[New Thread 0xf5fffb40 (LWP 302)]
[New Thread 0xf55ffb40 (LWP 303)]
[New Thread 0xf1bfeb40 (LWP 304)]
Thread 1 "dotnet" received signal SIGSEGV, Segmentation fault.
0xf7474e7a in FixupPrecode::GenerateCodePage (pageBase=0xf6186000 "\377%", pageBaseRX=0xf6186000 "\377%") at /runtime/src/coreclr/vm/precode.cpp:738
738 *(BYTE**)(pageBase + i + SYMBOL_VALUE(FixupPrecodeCode_Target_Offset)) = pTargetSlot;
(gdb) bt
#0 0xf7474e7a in FixupPrecode::GenerateCodePage (pageBase=0xf6186000 "\377%", pageBaseRX=0xf6186000 "\377%") at /runtime/src/coreclr/vm/precode.cpp:738
#1 0xf76b6cc7 in UnlockedLoaderHeap::UnlockedReservePages (this=0xf79eb234 <g_pSystemDomainMemory+1956>, dwSizeToCommit=8192) at /runtime/src/coreclr/utilcode/loaderheap.cpp:1192
#2 0xf76b6efd in UnlockedLoaderHeap::GetMoreCommittedPages (this=0xf79eb234 <g_pSystemDomainMemory+1956>, dwMinSize=<optimized out>) at /runtime/src/coreclr/utilcode/loaderheap.cpp:1362
#3 0xf76b741f in UnlockedLoaderHeap::UnlockedAllocAlignedMem_NoThrow (this=0xf79eb234 <g_pSystemDomainMemory+1956>, dwRequestedSize=216, alignment=1, pdwExtra=0xffffa794) at /runtime/src/coreclr/utilcode/loaderheap.cpp:1751
#4 UnlockedLoaderHeap::UnlockedAllocAlignedMem (this=0xf79eb234 <g_pSystemDomainMemory+1956>, dwRequestedSize=216, dwAlignment=1, pdwExtra=0xffffa794) at /runtime/src/coreclr/utilcode/loaderheap.cpp:1856
#5 0xf73b68c6 in LoaderHeap::RealAllocAlignedMem (this=0xf79eb230 <g_pSystemDomainMemory+1952>, dwRequestedSize=216, dwAlignment=1) at /runtime/src/coreclr/inc/loaderheap.h:664
#6 0xf7474b51 in Precode::AllocateTemporaryEntryPoints (pChunk=0xf6b24d1c, pLoaderAllocator=0xf79eb0cc <g_pSystemDomainMemory+1596>, pamTracker=0xffffcc18) at /runtime/src/coreclr/vm/precode.cpp:484
#7 0xf744cc18 in MethodDescChunk::CreateTemporaryEntryPoints (this=0xf6b24d1c, pLoaderAllocator=0xf79eb0cc <g_pSystemDomainMemory+1596>, pamTracker=0xffffcc18) at /runtime/src/coreclr/vm/method.cpp:2964
#8 0xf7571623 in MethodDescChunk::EnsureTemporaryEntryPointsCreated (this=0xf6b24d1c, pLoaderAllocator=0xf6187000, pamTracker=0xff0) at /runtime/src/coreclr/vm/method.hpp:2211
#9 MethodTableBuilder::SetupMethodTable2 (this=0xffffcaa8, pLoaderModule=0xf6b20000) at /runtime/src/coreclr/vm/methodtablebuilder.cpp:10645
#10 0xf75684a1 in MethodTableBuilder::BuildMethodTableThrowing (this=0xffffcaa8, pAllocator=0xf79eb0cc <g_pSystemDomainMemory+1596>, pLoaderModule=0xf6b20000, pModule=0xf6b20000, cl=33554530, pBuildingInterfaceList=0x0, pLayoutRawFieldInfos=0x0, pParentMethodTable=0x0, bmtGenericsInfo=0xffffca60, parentInst=..., cBuildingInterfaceList=0) at /runtime/src/coreclr/vm/methodtablebuilder.cpp:1774
#11 0xf7579b01 in ClassLoader::CreateTypeHandleForTypeDefThrowing (pModule=0xf6b20000, cl=33554530, inst=..., pamTracker=0xffffcc18) at /runtime/src/coreclr/vm/methodtablebuilder.cpp:12391
#12 0xf73d7d39 in ClassLoader::CreateTypeHandleForTypeKey (pKey=0xffffce80, pamTracker=0xffffcc18) at /runtime/src/coreclr/vm/clsload.cpp:2915
#13 0xf73d77a0 in ClassLoader::DoIncrementalLoad (pTypeKey=0xffffce80, typeHnd=..., currentLevel=CLASS_LOAD_BEGIN) at /runtime/src/coreclr/vm/clsload.cpp:2846
#14 0xf73d875a in ClassLoader::LoadTypeHandleForTypeKey_Body (this=0x565e8ea0, pTypeKey=0xffffce80, typeHnd=..., targetLevel=CLASS_LOAD_EXACTPARENTS) at /runtime/src/coreclr/vm/clsload.cpp:3531
#15 0xf73d4bb4 in ClassLoader::LoadTypeHandleForTypeKey (this=0x565e8ea0, pTypeKey=0xffffce80, typeHnd=..., targetLevel=CLASS_LOADED, pInstContext=0x0) at /runtime/src/coreclr/vm/clsload.cpp:3250
#16 0xf73d5c7a in ClassLoader::LoadTypeDefThrowing (pModule=0xf6b20000, typeDef=33554530, fNotFoundAction=ClassLoader::ReturnNullIfNotFound, fUninstantiated=ClassLoader::PermitUninstDefOrRef, tokenNotToLoad=0, level=CLASS_LOADED, pTargetInstantiation=0x0) at /runtime/src/coreclr/vm/clsload.cpp:2222
#17 0xf73d28ab in ClassLoader::LoadTypeHandleThrowing (this=0x565e8ea0, pName=0xffffcf60, level=CLASS_LOADED, pLookInThisModuleOnly=0x0) at /runtime/src/coreclr/vm/clsload.cpp:1469
#18 0xf73d2591 in ClassLoader::LoadTypeByNameThrowing (pAssembly=0x565e8e60, nameSpace=0xf7883ca5 "System", name=0xf789d947 "Object", fNotFound=ClassLoader::ThrowIfNotFound, fLoadTypes=ClassLoader::LoadTypes, level=CLASS_LOADED) at /runtime/src/coreclr/vm/assembly.hpp:113
#19 0xf73b07c8 in CoreLibBinder::LookupClassLocal (this=<optimized out>, id=CLASS__ELEMENT_TYPE_OBJECT) at /runtime/src/coreclr/vm/binder.cpp:65
#20 CoreLibBinder::LookupClass (id=CLASS__ELEMENT_TYPE_OBJECT) at /runtime/src/coreclr/vm/binder.cpp:31
#21 0xf739a58d in CoreLibBinder::GetClass (id=CLASS__ELEMENT_TYPE_OBJECT) at /runtime/src/coreclr/vm/binder.h:341
#22 SystemDomain::LoadBaseSystemClasses (this=0xf79eaa90 <g_pSystemDomainMemory>) at /runtime/src/coreclr/vm/appdomain.cpp:1329
#23 0xf739a315 in SystemDomain::Init (this=0xf79eaa90 <g_pSystemDomainMemory>) at /runtime/src/coreclr/vm/appdomain.cpp:1198
#24 0xf77ea59c in EEStartupHelper () at /runtime/src/coreclr/vm/ceemain.cpp:965
#25 0xf77e9870 in EEStartup()::$_0::operator()(void*) const (this=<optimized out>, p=<optimized out>) at /runtime/src/coreclr/vm/ceemain.cpp:1111
#26 EEStartup () at /runtime/src/coreclr/vm/ceemain.cpp:1113
#27 0xf77e9781 in EnsureEEStarted () at /runtime/src/coreclr/vm/ceemain.cpp:314
#28 0xf73e1ca2 in CorHost2::Start (this=0x56578920) at /runtime/src/coreclr/vm/corhost.cpp:101
#29 0xf73972f9 in coreclr_initialize (exePath=0x56570190 "/git_working/dotnet/dotnet", appDomainFriendlyName=0xf7a47ae4 "clrhost", propertyCount=9, propertyKeys=0x56581420, propertyValues=0x56581b40, hostHandle=0xffffd264, domainId=0xffffd260) at /runtime/src/coreclr/dlls/mscoree/exports.cpp:251
#30 0xf7a1346f in ?? () from /git_working/dotnet/shared/Microsoft.NETCore.App/7.0.0-preview.3.22175.4/libhostpolicy.so
#31 0xf7a21209 in ?? () from /git_working/dotnet/shared/Microsoft.NETCore.App/7.0.0-preview.3.22175.4/libhostpolicy.so
#32 0xf7a20aed in corehost_main () from /git_working/dotnet/shared/Microsoft.NETCore.App/7.0.0-preview.3.22175.4/libhostpolicy.so
#33 0xf7a66f62 in ?? () from /git_working/dotnet/host/fxr/7.0.0-preview.3.22175.4/libhostfxr.so
#34 0xf7a65a4f in ?? () from /git_working/dotnet/host/fxr/7.0.0-preview.3.22175.4/libhostfxr.so
#35 0xf7a624f6 in hostfxr_main_startupinfo () from /git_working/dotnet/host/fxr/7.0.0-preview.3.22175.4/libhostfxr.so
#36 0x56562ca2 in ?? ()
#37 0x56562f18 in ?? ()
#38 0xf7ac7ee5 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
#39 0x565588df in ?? ()
Regression?
This is a regression from .NET 7 Preview 2
Known Workarounds
Rebuild Preview 3 with eb8460fd29f reverted
Configuration
.NET 7 Preview 3
Cross compiling on Ubuntu 20.04 for linux-x86
Running the output in an Ubuntu 20.04 docker with multilib support enabled
dpkg --add-architecture i386
apt-get update
apt-get install libc6:i386 libgcc1:i386 libgssapi-krb5-2:i386 libicu66:i386 libssl1.1:i386 libstdc++6:i386 zlib1g:i386
Other information
I think the issue is introduced by eb8460f from #65738 authored by @janvorli (I hope this is not inappropriate, apologies in advance if I shouldn't have mentioned you)