-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Distro-agnostic build of System.Security.Cryptography.Native for musl-libc based systems #28265
Comments
I have published VoidWSL (glibc) and VoidMuslWSL images for easier/alternate ways of testing in Void Linux on Windows 10 box. Download, extract, install☩ and run Void.exe/VoidMusl.exe with aforementioned steps. ☩ current limitaiton: package has to be in system drive to get registered with WSL. |
It might work, it might not. We don't support it. That said, if it's compiled directly (non-portable) against the LibreSSL headers, then it should, theoretically, work. Unless we happen to be counting on a behavioral difference in the libraries (I don't know of any, but there might be some). |
@janvorli, Void Linux manager provides Libressl package only, .NET Core and ASP.NET Core apps are working fine in my Void Linux boxes (both glibc and musllibc). Though I have not run all CoreFX tests on the system. The said SSL package upon installation creates symlinks However, in case of musl-based Void Linux, it throws runtime error because it can't find fixed/hardcoded version of I tried to figure out the reason in related code and it seems that this is because for glibc-Linux, the official CoreFX package is compiled in a distro-agnostic way ( |
Right, it is the reason. The intent of the manual override of the openssl version in the portable build is actually not to enable pulling in other kinds of SSL libraries, but rather to enable fixing cases where the OpenSSL shared library is named differently on some exotic distros. However, since there is no OpenSSL package for the Void Linux, changing the official build to portable to enable using LibreSSL there sounds reasonable. By doing that, we would not open any new holes, as we do that for glibc based distros anyways. However, as @bartonjs said, using other SSL library than OpenSSL won't be considered supported and you may hit unexpected issues when using some of the crypto stuff. |
I never had musl-Void, only ever standard (glibc) Void. However, should note that Thought I'd mention it since parts of the thread seem to imply it's a musl thing, AFAICT it's a void/libressl thing. To save others reading time: the workaround with an ephemeral |
In the first post, shell script code shown for glibc-based Void has
On the other hand, musl-libc variant -- at the time -- was having issue with hello world (even with that environment variable set) because corefx build for musl-libc was non-portable (favoring Alpine Linux). In non-portable builds, |
Background
In GNU-libc based systems, if libssl is available with a different version than the few hard-coded ones:
https://github.com/dotnet/corefx/blob/5710b6d09441a0a2d3cb9778ae927da14b5087cd/src/Native/Unix/System.Security.Cryptography.Native/opensslshim.c#L50-L76
dotnet.exe
gives an error from line 84:No usable version of libssl was found\rAborted
when running the applicationdotnet-run
command. At this point,ldd
shows no errors (as expected):Going by the
opensslshim
code, the version can be overridden using an environment variable. For example, if a distro haslibssl.so.46
available:This implies that the product is compiled in a distro-agnostic manner for GNU-libc based systems, which is great!
Problem
The latest 3.0 preview build for musl-libc is not built in a distro-agnostic manner (
FEATURE_DISTRO_AGNOSTIC_SSL
was off on the official build machine it seems?), therefore the binary is linked to a specific version of crypto and SSL libs:libcrypto.so.1.0.0
andlibssl.so.1.0.0
available on Alpine Linux but not any other musl-libc based systems.Void Linux comes with both flavors, glibc and musl-libc. This independent distro provides libressl via package management (XBPS:
xbps-install openssl
) with/usr/lib/libssl.so.46
and/usr/lib/libcrypto.so.44
.To make
Hello World
work on glibc based Void Linux, export variable once:CLR_OPENSSL_VERSION_OVERRIDE=46
. Full repro:Lets try the same thing in
voidlinux/voidlinux-musl
:instead it throws an exception:
At this point,
ldd
also complains:The workaround is to create a symlink for exact versions:
libcrypto.so.1.0.0
andlibssl.so.1.0.0
:Request
Please set
FEATURE_DISTRO_AGNOSTIC_SSL
in official musl-x64 build plan, so in either flavors of Void Linux, there is only one way to configure the libssl, i.e. by settingCLR_OPENSSL_VERSION_OVERRIDE
.The text was updated successfully, but these errors were encountered: