runtime: [Linux] Segfault when AssemblyBuilder.DefineDynamicAssembly and PerfMap

Hi! When I build app with final .NET Core v3.0.0 and run it with COMPlus_PerfMapEnabled=1

static void Main(string[] args)
{
     AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Sth.dll"), AssemblyBuilderAccess.RunAndCollect);
}

I get instantly Segmentation fault.

It seems it is working fine on Preview9 (I was not testing any other versions).

It migh be related to Link

Fun fact, with COMPlus_PerfMapEnabled=1
I get segfault for

dotnet new console dotnet tool install -g dotnet-sos
That makes it real fun to diagnose.

Maybe this stack trace helps

frame #0: 0x00007f5a43d32caa libcoreclr.so`PerfInfo::LogImage(PEFile, char16_t) + 90
frame dotnet/coreclr#1: 0x00007f5a43d31e57 libcoreclr.so`PerfMap::LogImage(PEFile*) + 279
frame dotnet/coreclr#2: 0x00007f5a43e6c56a libcoreclr.so`Assembly::CreateDynamic(AppDomain, CreateDynamicAssemblyArgs) + 2538
frame dotnet/coreclr#3: 0x00007f5a43ec052a libcoreclr.so`AppDomainNative::CreateDynamicAssembly(AssemblyNameBaseObject, StackCrawlMark, int) + 234

Of course I can disable it, but this prevents me from profiling apps 😦

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 20 (18 by maintainers)

Most upvoted comments

Bit of clarification, this looks like it’s part of the newly-released 3.0.1 Runtime as described here: https://github.com/dotnet/coreclr/pull/26910 and here: https://github.com/dotnet/coreclr/issues?utf8=✓&q=milestone%3A3.0.1+label%3Aservicing-approved+sort%3Aupdated-desc

Thanks for the work, y’all!

Yup, this was caused by dotnet/coreclr#26403. I am working on a fix.

@jkotas any thoughts?

Plain vanilla bug in the PerfMap implementation.

does it happen on more than 1 machine? This is highly suspicious

It is 100% repro.