sec / dotnet-core-freebsd-source-build

Collection of script to build .NET Core under FreeBSD OS (with binary releases)
MIT License
53 stars 4 forks source link

dotnet binaries sometimes crash with ASLR enabled on 13.2-RELEASE amd64 #21

Open Partmedia opened 1 year ago

Partmedia commented 1 year ago

I recently updated my amd64 machine to 13.2-RELEASE, which enables ASLR by default for 64-bit binaries.

With ASLR enabled, running the binaries produced by dotnet occasionally (maybe 50%) of the time result in a SIGSEGV in the CLR.

I have not troubleshooted in depth, but as a workaround, it appears that disabling ASLR for the binary fixes the problem:

$ elfctl -e +noaslr binary 

This must be done for all binaries produced by dotnet.

Partmedia commented 11 months ago

I checked back with binaries compiled with dotnet build using 8.0.100-x64-native and 13.2-RELEASE on amd64. The resulting binaries still sometimes crash with "Internal CLR error" if ASLR is not disabled on the binary.

Is this a problem on other architectures/releases? If so, perhaps I could investigate a workaround (such as always marking .NET binaries as ASLR-off).

sec commented 11 months ago

Hi. Yes I also saw the same crashed without ASLR. Can't remember if those were also on 14. Don't think those are also on other OS'es, if you have time/knowledge - doing investigation and/or fixing the issue will be beneficial for all BSD users :)