Bug 58015 - Segfault in Mono.Btls.MonoBtlsSsl.mono_btls_ssl_connect after performing interop that is basically a no-op
Summary: Segfault in Mono.Btls.MonoBtlsSsl.mono_btls_ssl_connect after performing inte...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Security ()
Version: 5.2 (2017-04)
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2017-07-07 18:30 UTC by Steven Malis
Modified: 2017-08-20 23:34 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
The program demonstrating this behaviour (1.46 KB, text/plain)
2017-07-07 18:30 UTC, Steven Malis
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Steven Malis 2017-07-07 18:30:13 UTC
Created attachment 23409 [details]
The program demonstrating this behaviour

The attached program causes a segfault when compiled and run on my (and many others) currently up-to-date Arch Linux system. The callouts it makes to libmediainfo should act as a no-op, but somehow they appear to alter some internal state that then causes btls to segfault. Running the program with the argument '--nomediainfo' skips this step and therefore does not crash when making the http request.

$ mono --version
Mono JIT compiler version 5.0.0 (Stable 5.0.0.100/9667aa6 Fri May 12 07:20:13 UTC 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen (concurrent by default)

$ pacman -Q libmediainfo
libmediainfo 0.7.97-1

Expected output:
$ ./test.exe --nomediainfo
Trying url: https://google.com
Done: 45564 bytes

Actual output:
$ ./test.exe
Loading MediaInfo
Loaded MediaInfo, disposing.
Trying url: https://google.com
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Mono.Btls.MonoBtlsSsl.mono_btls_ssl_connect (intptr) [0x00002] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Btls.MonoBtlsSsl.Connect () [0x00011] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Btls.MonoBtlsContext.DoProcessHandshake () [0x00028] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00009] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncProtocolRequest,Mono.Net.Security.AsyncOperationStatus) [0x0002a] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (Mono.Net.Security.AsyncOperationStatus) [0x0006b] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation () [0x0000d] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x00000] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation (Mono.Net.Security.AsyncOperation) [0x00024] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Net.LazyAsyncResult) [0x00057] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient (string,System.Security.Cryptography.X509Certificates.X509CertificateCollection,System.Security.Authentication.SslProtocols,bool) [0x0000c] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Net.Security.Private.MonoSslStreamWrapper.AuthenticateAsClient (string,System.Security.Cryptography.X509Certificates.X509CertificateCollection,System.Security.Authentication.SslProtocols,bool) [0x00006] in <2fef7234205a4a009fe5995569c314ee>:0
  at Mono.Net.Security.MonoTlsStream.CreateStream (byte[]) [0x00064] in <2fef7234205a4a009fe5995569c314ee>:0
  at System.Net.WebConnection.CreateStream (System.Net.HttpWebRequest) [0x00073] in <2fef7234205a4a009fe5995569c314ee>:0
  at System.Net.WebConnection.InitConnection (object) [0x00078] in <2fef7234205a4a009fe5995569c314ee>:0
  at System.Net.WebConnection.<.ctor>b__29_0 (object) [0x00000] in <2fef7234205a4a009fe5995569c314ee>:0
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (object) [0x00007] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00071] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
  at (wrapper runtime-invoke) <Module>.runtime_invoke_bool (object,intptr,intptr,intptr) [0x0001e] in <73ee1b14c2fa4d61b481096ff3d8d6d7>:0
/proc/self/maps:
00400000-007b2000 r-xp 00000000 08:12 3831073                            /usr/bin/mono-sgen
009b1000-009b2000 r--p 003b1000 08:12 3831073                            /usr/bin/mono-sgen
009b2000-009b5000 rw-p 003b2000 08:12 3831073                            /usr/bin/mono-sgen
009b5000-009e8000 rw-p 00000000 00:00 0
0250a000-0290b000 rw-p 00000000 00:00 0                                  [heap]
408ba000-408ca000 rwxp 00000000 00:00 0
41d6f000-41ddf000 rwxp 00000000 00:00 0
7f81c8000000-7f81c80ca000 rw-p 00000000 00:00 0
7f81c80ca000-7f81cc000000 ---p 00000000 00:00 0
7f81cc000000-7f81cc021000 rw-p 00000000 00:00 0
7f81cc021000-7f81d0000000 ---p 00000000 00:00 0
7f81d0000000-7f81d0021000 rw-p 00000000 00:00 0
7f81d0021000-7f81d4000000 ---p 00000000 00:00 0
7f81d723a000-7f81d73cf000 r-xp 00000000 08:12 3831025                    /usr/lib/libmono-btls-shared.so
7f81d73cf000-7f81d75cf000 ---p 00195000 08:12 3831025                    /usr/lib/libmono-btls-shared.so
7f81d75cf000-7f81d75e1000 r--p 00195000 08:12 3831025                    /usr/lib/libmono-btls-shared.so
7f81d75e1000-7f81d75e6000 rw-p 001a7000 08:12 3831025                    /usr/lib/libmono-btls-shared.so
7f81d75e6000-7f81d75e7000 rw-p 00000000 00:00 0
7f81d75e7000-7f81d75eb000 r-xp 00000000 08:12 3807814                    /usr/lib/libcap.so.2.25
7f81d75eb000-7f81d77ea000 ---p 00004000 08:12 3807814                    /usr/lib/libcap.so.2.25
7f81d77ea000-7f81d77eb000 rw-p 00003000 08:12 3807814                    /usr/lib/libcap.so.2.25
7f81d77eb000-7f81d77f6000 r-xp 00000000 08:12 3803230                    /usr/lib/libnss_files-2.25.so
7f81d77f6000-7f81d79f5000 ---p 0000b000 08:12 3803230                    /usr/lib/libnss_files-2.25.so
7f81d79f5000-7f81d79f6000 r--p 0000a000 08:12 3803230                    /usr/lib/libnss_files-2.25.so
7f81d79f6000-7f81d79f7000 rw-p 0000b000 08:12 3803230                    /usr/lib/libnss_files-2.25.so
7f81d79f7000-7f81d79fd000 rw-p 00000000 00:00 0
7f81d79fd000-7f81d7a06000 ---p 00000000 00:00 0
7f81d7a06000-7f81d7bfe000 rw-p 00000000 00:00 0
7f81d7bfe000-7f81d7c07000 ---p 00000000 00:00 0
7f81d7c07000-7f81d7dff000 rw-p 00000000 00:00 0
7f81d7dff000-7f81d7e08000 ---p 00000000 00:00 0
7f81d7e08000-7f81d8000000 rw-p 00000000 00:00 0
7f81d8000000-7f81d8021000 rw-p 00000000 00:00 0
7f81d8021000-7f81dc000000 ---p 00000000 00:00 0
7f81dc1ff000-7f81dc208000 ---p 00000000 00:00 0
7f81dc208000-7f81dc500000 rw-p 00000000 00:00 0
7f81dc54b000-7f81dc84e000 r--p 00000000 08:12 4723184                    /usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
7f81dc84e000-7f81de161000 r--p 00000000 08:12 3821434                    /usr/lib/libicudata.so.59.1
7f81de161000-7f81de360000 ---p 01913000 08:12 3821434                    /usr/lib/libicudata.so.59.1
7f81de360000-7f81de361000 r--p 01912000 08:12 3821434                    /usr/lib/libicudata.so.59.1
7f81de361000-7f81de374000 r-xp 00000000 08:12 3803221                    /usr/lib/libresolv-2.25.so
7f81de374000-7f81de573000 ---p 00013000 08:12 3803221                    /usr/lib/libresolv-2.25.so
7f81de573000-7f81de574000 r--p 00012000 08:12 3803221                    /usr/lib/libresolv-2.25.so
7f81de574000-7f81de575000 rw-p 00013000 08:12 3803221                    /usr/lib/libresolv-2.25.so
7f81de575000-7f81de577000 rw-p 00000000 00:00 0
7f81de577000-7f81de57a000 r-xp 00000000 08:12 3813885                    /usr/lib/libkeyutils.so.1.6
7f81de57a000-7f81de779000 ---p 00003000 08:12 3813885                    /usr/lib/libkeyutils.so.1.6
7f81de779000-7f81de77a000 r--p 00002000 08:12 3813885                    /usr/lib/libkeyutils.so.1.6
7f81de77a000-7f81de77b000 rw-p 00003000 08:12 3813885                    /usr/lib/libkeyutils.so.1.6
7f81de77b000-7f81de787000 r-xp 00000000 08:12 3813975                    /usr/lib/libkrb5support.so.0.1
7f81de787000-7f81de986000 ---p 0000c000 08:12 3813975                    /usr/lib/libkrb5support.so.0.1
7f81de986000-7f81de987000 r--p 0000b000 08:12 3813975                    /usr/lib/libkrb5support.so.0.1
7f81de987000-7f81de988000 rw-p 0000c000 08:12 3813975                    /usr/lib/libkrb5support.so.0.1
7f81de988000-7f81deb26000 r-xp 00000000 08:12 3821425                    /usr/lib/libicuuc.so.59.1
7f81deb26000-7f81ded25000 ---p 0019e000 08:12 3821425                    /usr/lib/libicuuc.so.59.1
7f81ded25000-7f81ded37000 r--p 0019d000 08:12 3821425                    /usr/lib/libicuuc.so.59.1
7f81ded37000-7f81ded38000 rw-p 001af000 08:12 3821425                    /usr/lib/libicuuc.so.59.1
7f81ded38000-7f81ded39000 rw-p 00000000 00:00 0
7f81ded39000-7f81dedab000 r-xp 00000000 08:12 3816077                    /usr/lib/libpcre.so.1.2.8
7f81dedab000-7f81defaa000 ---p 00072000 08:12 3816077                    /usr/lib/libpcre.so.1.2.8
7f81defaa000-7f81defab000 r--p 00071000 08:12 3816077                    /usr/lib/libpcre.so.1.2.8
7f81defab000-7f81defac000 rw-p 00072000 08:12 3816077                    /usr/lib/libpcre.so.1.2.8
7f81defac000-7f81defaf000 r-xp 00000000 08:12 3813558                    /usr/lib/libcom_err.so.2.1
7f81defaf000-7f81df1ae000 ---p 00003000 08:12 3813558                    /usr/lib/libcom_err.so.2.1
7f81df1ae000-7f81df1af000 r--p 00002000 08:12 3813558                    /usr/lib/libcom_err.so.2.1
7f81df1af000-7f81df1b0000 rw-p 00003000 08:12 3813558                    /usr/lib/libcom_err.so.2.1
7f81df1b0000-7f81df1e1000 r-xp 00000000 08:12 3813970                    /usr/lib/libk5crypto.so.3.1
7f81df1e1000-7f81df3e0000 ---p 00031000 08:12 3813970                    /usr/lib/libk5crypto.so.3.1
7f81df3e0000-7f81df3e2000 r--p 00030000 08:12 3813970                    /usr/lib/libk5crypto.so.3.1
7f81df3e2000-7f81df3e3000 rw-p 00032000 08:12 3813970                    /usr/lib/libk5crypto.so.3.1
7f81df3e3000-7f81df3e4000 rw-p 00000000 00:00 0
7f81df3e4000-7f81df4bb000 r-xp 00000000 08:12 3813957                    /usr/lib/libkrb5.so.3.3
7f81df4bb000-7f81df6bb000 ---p 000d7000 08:12 3813957                    /usr/lib/libkrb5.so.3.3
7f81df6bb000-7f81df6c9000 r--p 000d7000 08:12 3813957                    /usr/lib/libkrb5.so.3.3
7f81df6c9000-7f81df6cc000 rw-p 000e5000 08:12 3813957                    /usr/lib/libkrb5.so.3.3
7f81df6cc000-7f81df717000 r-xp 00000000 08:12 3813984                    /usr/lib/libgssapi_krb5.so.2.2
7f81df717000-7f81df916000 ---p 0004b000 08:12 3813984                    /usr/lib/libgssapi_krb5.so.2.2
7f81df916000-7f81df918000 r--p 0004a000 08:12 3813984                    /usr/lib/libgssapi_krb5.so.2.2
7f81df918000-7f81df91a000 rw-p 0004c000 08:12 3813984                    /usr/lib/libgssapi_krb5.so.2.2
7f81df91a000-7f81dfb6b000 r-xp 00000000 08:12 3809755                    /usr/lib/libcrypto.so.1.1
7f81dfb6b000-7f81dfd6a000 ---p 00251000 08:12 3809755                    /usr/lib/libcrypto.so.1.1
7f81dfd6a000-7f81dfd88000 r--p 00250000 08:12 3809755                    /usr/lib/libcrypto.so.1.1
7f81dfd88000-7f81dfd92000 rw-p 0026e000 08:12 3809755                    /usr/lib/libcrypto.so.1.1
7f81dfd92000-7f81dfd95000 rw-p 00000000 00:00 0
7f81dfd95000-7f81dfdf6000 r-xp 00000000 08:12 3809756                    /usr/lib/libssl.so.1.1
7f81dfdf6000-7f81dfff6000 ---p 00061000 08:12 3809756                    /usr/lib/libssl.so.1.1
7f81dfff6000-7f81dfffa000 r--p 00061000 08:12 3809756                    /usr/lib/libssl.so.1.1
7f81dfffa000-7f81e0000000 rw-p 00065000 08:12 3809756                    /usr/lib/libssl.so.1.1
7f81e0000000-7f81e0021000 rw-p 00000000 00:00 0
7f81e0021000-7f81e4000000 ---p 00000000 00:00 0
7f81e410b000-7f81e4148000 r-xp 00000000 08:12 3822993                    /usr/lib/libnss_resolve.so.2
7f81e4148000-7f81e414b000 r--p 0003c000 08:12 3822993                    /usr/lib/libnss_resolve.so.2
7f81e414b000-7f81e414c000 rw-p 0003f000 08:12 3822993                    /usr/lib/libnss_resolve.so.2
7f81e414c000-7f81e4159000 r-xp 00000000 08:12 3821449                    /usr/lib/libpsl.so.5.1.1
7f81e4159000-7f81e4358000 ---p 0000d000 08:12 3821449                    /usr/lib/libpsl.so.5.1.1
7f81e4358000-7f81e4359000 r--p 0000c000 08:12 3821449                    /usr/lib/libpsl.so.5.1.1
7f81e4359000-7f81e435a000 rw-p 0000d000 08:12 3821449                    /usr/lib/libpsl.so.5.1.1
7f81e435a000-7f81e4386000 r-xp 00000000 08:12 3821040                    /usr/lib/libssh2.so.1.0.1
7f81e4386000-7f81e4586000 ---p 0002c000 08:12 3821040                    /usr/lib/libssh2.so.1.0.1
7f81e4586000-7f81e4587000 r--p 0002c000 08:12 3821040                    /usr/lib/libssh2.so.1.0.1
7f81e4587000-7f81e4588000 rw-p 0002d000 08:12 3821040                    /usr/lib/libssh2.so.1.0.1
7f81e4588000-7f81e45ab000 r-xp 00000000 08:12 3821458                    /usr/lib/libnghttp2.so.14.13.3
7f81e45ab000-7f81e47aa000 ---p 00023000 08:12 3821458                    /usr/lib/libnghttp2.so.14.13.3
7f81e47aa000-7f81e47ab000 r--p 00022000 08:12 3821458                    /usr/lib/libnghttp2.so.14.13.3
7f81e47ab000-7f81e47ae000 rw-p 00023000 08:12 3821458                    /usr/lib/libnghttp2.so.14.13.3
7f81e47ae000-7f81e4928000 r-xp 00000000 08:12 3804770                    /usr/lib/libstdc++.so.6.0.23
7f81e4928000-7f81e4b27000 ---p 0017a000 08:12 3804770                    /usr/lib/libstdc++.so.6.0.23
7f81e4b27000-7f81e4b31000 r--p 00179000 08:12 3804770                    /usr/lib/libstdc++.so.6.0.23
7f81e4b31000-7f81e4b33000 rw-p 00183000 08:12 3804770                    /usr/lib/libstdc++.so.6.0.23
7f81e4b33000-7f81e4b36000 rw-p 00000000 00:00 0
7f81e4b36000-7f81e4c47000 r-xp 00000000 08:12 3816263                    /usr/lib/libglib-2.0.so.0.5200.3
7f81e4c47000-7f81e4e46000 ---p 00111000 08:12 3816263                    /usr/lib/libglib-2.0.so.0.5200.3
7f81e4e46000-7f81e4e47000 r--p 00110000 08:12 3816263                    /usr/lib/libglib-2.0.so.0.5200.3
7f81e4e47000-7f81e4e48000 rw-p 00111000 08:12 3816263                    /usr/lib/libglib-2.0.so.0.5200.3
7f81e4e48000-7f81e4e49000 rw-p 00000000 00:00 0
7f81e4e49000-7f81e4e58000 r-xp 00000000 08:12 3831213                    /usr/lib/libmms.so.0.0.2
7f81e4e58000-7f81e5058000 ---p 0000f000 08:12 3831213                    /usr/lib/libmms.so.0.0.2
7f81e5058000-7f81e5059000 r--p 0000f000 08:12 3831213                    /usr/lib/libmms.so.0.0.2
7f81e5059000-7f81e505a000 rw-p 00010000 08:12 3831213                    /usr/lib/libmms.so.0.0.2
7f81e505a000-7f81e50d4000 r-xp 00000000 08:12 3825489                    /usr/lib/libcurl.so.4.4.0
7f81e50d4000-7f81e52d4000 ---p 0007a000 08:12 3825489                    /usr/lib/libcurl.so.4.4.0
7f81e52d4000-7f81e52d6000 r--p 0007a000 08:12 3825489                    /usr/lib/libcurl.so.4.4.0
7f81e52d6000-7f81e52d7000 rw-p 0007c000 08:12 3825489                    /usr/lib/libcurl.so.4.4.0
7f81e52d7000-7f81e52d8000 rw-p 00000000 00:00 0
7f81e52d8000-7f81e5320000 r-xp 00000000 08:12 3831215                    /usr/lib/libzen.so.0.0.0
7f81e5320000-7f81e5520000 ---p 00048000 08:12 3831215                    /usr/lib/libzen.so.0.0.0
7f81e5520000-7f81e5521000 r--p 00048000 08:12 3831215                    /usr/lib/libzen.so.0.0.0
7f81e5521000-7f81e5522000 rw-p 00049000 08:12 3831215                    /usr/lib/libzen.so.0.0.0
7f81e5522000-7f81e5538000 r-xp 00000000 08:12 3813493                    /usr/lib/libz.so.1.2.11
7f81e5538000-7f81e5737000 ---p 00016000 08:12 3813493                    /usr/lib/libz.so.1.2.11
7f81e5737000-7f81e5738000 r--p 00015000 08:12 3813493                    /usr/lib/libz.so.1.2.11
7f81e5738000-7f81e5739000 rw-p 00016000 08:12 3813493                    /usr/lib/libz.so.1.2.11
7f81e5739000-7f81e5dcd000 r-xp 00000000 08:12 3823667                    /usr/lib/libmediainfo.so.0.0.0
7f81e5dcd000-7f81e5fcc000 ---p 00694000 08:12 3823667                    /usr/lib/libmediainfo.so.0.0.0
7f81e5fcc000-7f81e5fe0000 r--p 00693000 08:12 3823667                    /usr/lib/libmediainfo.so.0.0.0
7f81e5fe0000-7f81e5fea000 rw-p 006a7000 08:12 3823667                    /usr/lib/libmediainfo.so.0.0.0
7f81e5fea000-7f81e5fec000 rw-p 00000000 00:00 0
7f81e5fec000-7f81e60e3000 r--p 00000000 08:12 4723190                    /usr/lib/mono/gac/System.Core/4.0.0.0__b77a5c561934e089/System.Core.dll
7f81e60e3000-7f81e636e000 r--p 00000000 08:12 4723182                    /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
7f81e636e000-7f81e6a38000 r-xp 00000000 08:12 4591728                    /usr/lib/mono/4.5/mscorlib.dll.so
7f81e6a38000-7f81e6c37000 ---p 006ca000 08:12 4591728                    /usr/lib/mono/4.5/mscorlib.dll.so
7f81e6c37000-7f81e6c38000 r--p 006c9000 08:12 4591728                    /usr/lib/mono/4.5/mscorlib.dll.so
7f81e6c38000-7f81e6c39000 rw-p 006ca000 08:12 4591728                    /usr/lib/mono/4.5/mscorlib.dll.so
7f81e6c39000-7f81e6c56000 rw-p 00000000 00:00 0
7f81e6c56000-7f81e6fff000 r--p 00000000 08:12 4592491                    /usr/lib/mono/4.5/mscorlib.dll
7f81e6fff000-7f81e7fff000 rw-p 00000000 00:00 0
7f81e7fff000-7f81e8000000 ---p 00000000 00:00 0
7f81e8000000-7f81e8c00000 rw-p 00000000 00:00 0
7f81e8c0d000-7f81e8c4b000 r-xp 00000000 08:12 3822992                    /usr/lib/libnss_mymachines.so.2
7f81e8c4b000-7f81e8c4e000 r--p 0003d000 08:12 3822992                    /usr/lib/libnss_mymachines.so.2
7f81e8c4e000-7f81e8c4f000 rw-p 00040000 08:12 3822992                    /usr/lib/libnss_mymachines.so.2
7f81e8c5f000-7f81e8cac000 r--p 00000000 08:12 4723180                    /usr/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
7f81e8cac000-7f81e8cca000 r--p 00000000 08:12 4723194                    /usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
7f81e8cca000-7f81e8cd3000 ---p 00000000 00:00 0
7f81e8cd3000-7f81e8f7c000 rw-p 00000000 00:00 0
7f81e8f7d000-7f81e8f7e000 rw-p 00000000 00:00 0
7f81e8f7e000-7f81e8fdd000 ---p 00000000 00:00 0
7f81e8fdd000-7f81e9179000 r-xp 00000000 08:12 3803287                    /usr/lib/libc-2.25.so
7f81e9179000-7f81e9378000 ---p 0019c000 08:12 3803287                    /usr/lib/libc-2.25.so
7f81e9378000-7f81e937c000 r--p 0019b000 08:12 3803287                    /usr/lib/libc-2.25.so
7f81e937c000-7f81e937e000 rw-p 0019f000 08:12 3803287                    /usr/lib/libc-2.25.so
7f81e937e000-7f81e9382000 rw-p 00000000 00:00 0
7f81e9382000-7f81e9398000 r-xp 00000000 08:12 3804757                    /usr/lib/libgcc_s.so.1
7f81e9398000-7f81e9597000 ---p 00016000 08:12 3804757                    /usr/lib/libgcc_s.so.1
7f81e9597000-7f81e9598000 r--p 00015000 08:12 3804757                    /usr/lib/libgcc_s.so.1
7f81e9598000-7f81e9599000 rw-p 00016000 08:12 3804757                    /usr/lib/libgcc_s.so.1
7f81e9599000-7f81e95b2000 r-xp 00000000 08:12 3803308                    /usr/lib/libpthread-2.25.so
7f81e95b2000-7f81e97b1000 ---p 00019000 08:12 3803308                    /usr/lib/libpthread-2.25.so
7f81e97b1000-7f81e97b2000 r--p 00018000 08:12 3803308                    /usr/lib/libpthread-2.25.so
7f81e97b2000-7f81e97b3000 rw-p 00019000 08:12 3803308                    /usr/lib/libpthread-2.25.so
7f81e97b3000-7f81e97b7000 rw-p 00000000 00:00 0
7f81e97b7000-7f81e97ba000 r-xp 00000000 08:12 3803226                    /usr/lib/libdl-2.25.so
7f81e97ba000-7f81e99b9000 ---p 00003000 08:12 3803226                    /usr/lib/libdl-2.25.so
7f81e99b9000-7f81e99ba000 r--p 00002000 08:12 3803226                    /usr/lib/libdl-2.25.so
7f81e99ba000-7f81e99bb000 rw-p 00003000 08:12 3803226                    /usr/lib/libdl-2.25.so
7f81e99bb000-7f81e99c2000 r-xp 00000000 08:12 3803219                    /usr/lib/librt-2.25.so
7f81e99c2000-7f81e9bc1000 ---p 00007000 08:12 3803219                    /usr/lib/librt-2.25.so
7f81e9bc1000-7f81e9bc2000 r--p 00006000 08:12 3803219                    /usr/lib/librt-2.25.so
7f81e9bc2000-7f81e9bc3000 rw-p 00007000 08:12 3803219                    /usr/lib/librt-2.25.so
7f81e9bc3000-7f81e9cd3000 r-xp 00000000 08:12 3803225                    /usr/lib/libm-2.25.so
7f81e9cd3000-7f81e9ed3000 ---p 00110000 08:12 3803225                    /usr/lib/libm-2.25.so
7f81e9ed3000-7f81e9ed4000 r--p 00110000 08:12 3803225                    /usr/lib/libm-2.25.so
7f81e9ed4000-7f81e9ed5000 rw-p 00111000 08:12 3803225                    /usr/lib/libm-2.25.so
7f81e9ed5000-7f81e9ef8000 r-xp 00000000 08:12 3803288                    /usr/lib/ld-2.25.so
7f81e9eff000-7f81e9f49000 rw-p 00000000 00:00 0
7f81e9f49000-7f81ea0e1000 r--p 00000000 08:12 3830589                    /usr/lib/locale/locale-archive
7f81ea0e1000-7f81ea0ea000 rw-p 00000000 00:00 0
7f81ea0ea000-7f81ea0eb000 rw-p 00000000 00:00 0
7f81ea0eb000-7f81ea0ec000 r--p 00000000 08:12 266048                     /home/steve/test.exe
7f81ea0ec000-7f81ea0f7000 rw-p 00000000 00:00 0
7f81ea0f7000-7f81ea0f8000 rw-s 00000000 00:15 15069                      /dev/shm/mono.696
7f81ea0f8000-7f81ea0f9000 r--p 00023000 08:12 3803288                    /usr/lib/ld-2.25.so
7f81ea0f9000-7f81ea0fa000 rw-p 00024000 08:12 3803288                    /usr/lib/ld-2.25.so
7f81ea0fa000-7f81ea0fb000 rw-p 00000000 00:00 0
7fff104af000-7fff104b7000 ---p 00000000 00:00 0
7fff10c8d000-7fff10cae000 rw-p 00000000 00:00 0                          [stack]
7fff10ddf000-7fff10de1000 r--p 00000000 00:00 0                          [vvar]
7fff10de1000-7fff10de3000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

Native stacktrace:

        /usr/bin/mono() [0x4ad37f]
        /usr/bin/mono() [0x510ad6]
        /usr/lib/libcrypto.so.1.1(COMP_CTX_free+0xc) [0x7f81df9e640c]
        [0x25a91c0]

Debug info from gdb:

mono_gdb_render_native_backtraces not supported on this platform, unable to find gdb or lldb

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Aborted (core dumped)
Comment 1 Jo Shields 2017-08-18 20:33:24 UTC
Hi

Can you confirm whether libmediainfo on your distribution is linked against OpenSSL, probably indirectly via libcurl?

If so, this is fixed in e6e0fb82261340f9181d1b2b11a9706a16c5dbc7 which is in our Debian/Ubuntu/CentOS Mono 5.2 packages.
Comment 2 Steven Malis 2017-08-19 00:52:39 UTC
$ ldd libmediainfo.so.0.0.0
        linux-vdso.so.1 (0x00007ffd41f0a000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f624ffc6000)
        libzen.so.0 => /usr/lib/libzen.so.0 (0x00007f624fd7f000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f624fb61000)
        libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007f624f8e4000)
        libmms.so.0 => /usr/lib/libmms.so.0 (0x00007f624f6d3000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f624f3c0000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f624f038000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007f624ed26000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f624e980000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f624e769000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6250a9b000)
        libnghttp2.so.14 => /usr/lib/libnghttp2.so.14 (0x00007f624e543000)
        libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007f624e315000)
        libpsl.so.5 => /usr/lib/libpsl.so.5 (0x00007f624e107000)
        libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007f624de9d000)
        libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007f624da1d000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007f624d7cf000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007f624d4e7000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007f624d2b3000)
        libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007f624d0af000)
        libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f624ce3c000)
        libicuuc.so.59 => /usr/lib/libicuuc.so.59 (0x00007f624ca8b000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f624c887000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007f624c67a000)
        libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007f624c476000)
        libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f624c260000)
        libicudata.so.59 => /usr/lib/libicudata.so.59 (0x00007f624a74d000)

Looks like both OpenSSL and libcurl are linked against.
Comment 3 Steven Malis 2017-08-20 22:07:34 UTC
After compiling mono myself and re-testing the attached code still segfaults. New version: 
$ mono --version
Mono JIT compiler version 5.2.0.215 (tarball Sun Aug 20 14:43:07 PDT 2017)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug
        LLVM:          supported, not enabled.
        GC:            sgen (concurrent by default)
Comment 4 Steven Malis 2017-08-20 23:34:08 UTC
I realized that the commit you mentioned isn't actually in the mono 5.2 source tarball, so I tried with the latest nightly and everything works. Confirmed fixed.