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
Fix MS-VC++2008 and Windows XP 32bit critical error problem #18856
Conversation
…on of InterlockedOr64 for 32bit and will fail to run on Windows XP 32bit. See: https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedor-intrinsic-functions#requirements To work around this problem, we implement a manual locking mechanism for only VC++ 2008 or earlier x86 compilers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This submission will require a signed CLA. Refer to the contributor agreements page.
@paulidale Thank you for information. I signed and submit the Individual Contributor License Agreement (ICLA) to the OpenSSL Software Foundation email address just now. |
crypto/threads_win.c
Outdated
// VC++ 2008 or earlier x86 compilers do not have an inline implementation of InterlockedOr64 for 32bit and will fail to run on Windows XP 32bit. | ||
// See: https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedor-intrinsic-functions#requirements | ||
// To work around this problem, we implement a manual locking mechanism for only VC++ 2008 or earlier x86 compilers. | ||
if (lock == NULL || !CRYPTO_THREAD_write_lock(lock)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use C98 block comments, not C99 line comments, and wrap lines to 80 characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about doing this at the top of the file once...
/*
* Comments....
*/
#if (defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER <= 1500)
# define NO_INTERLOCKEDOR64
#endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch is also required for VS 2015 which is _MSC_VER = 1900
I just changed the pragma check for _MSC_VER <= 1900 in crypto\thread_win.c and the build completed using VS2015.
There was an error in the CLA database which meant the "hold: cla required" flag hadn't been removed automatically. Fixed now. |
This pull request is ready to merge |
reapproved |
This pull request is ready to merge |
…on of InterlockedOr64 for 32bit and will fail to run on Windows XP 32bit. See: https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedor-intrinsic-functions#requirements To work around this problem, we implement a manual locking mechanism for only VC++ 2008 or earlier x86 compilers. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from #18856)
Pushed to master and 3.0. Thanks. I squashed the commits before push. |
…on of InterlockedOr64 for 32bit and will fail to run on Windows XP 32bit. See: https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedor-intrinsic-functions#requirements To work around this problem, we implement a manual locking mechanism for only VC++ 2008 or earlier x86 compilers. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from #18856) (cherry picked from commit 2d46a44)
…on of InterlockedOr64 for 32bit and will fail to run on Windows XP 32bit. See: https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedor-intrinsic-functions#requirements To work around this problem, we implement a manual locking mechanism for only VC++ 2008 or earlier x86 compilers. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from openssl#18856)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch is also required for VS 2015 which is _MSC_VER = 1900
I just changed the pragma check for _MSC_VER <= 1900 in crypto\thread_win.c and build completed.
There are many good reasons why I prefer to compile my products [with] vs2015 compiler version 19.00.24215.1, among them is security concerns with _MSC_VER > 1900 telemetry design. Back then, vs2015 was provided with a patch to remove the telemetry in perhaps its last update I am aware of. I still have a good bit of XP/2003 customers, sysops, operators, including myself who run ops on Wildcat! Server on private backend 2003 non-user boxes and/or as XP clients to play games or run a server There is good reason for a security component such as OpenSSL to continue to support XP/2003 boxes, at least for a while longer . Of course, I can continue to add my XP/2003 support build patch to the OpenSSL updates, such as this:
# 04/21/2019 08:03 am, SSI/HLS
# Adds XP/2003 support
# usage from within build folder:
# perl ..\configure VC-WIN32-XP --config=..\xp-support.conf
my %targets = (
"VC-WIN32-XP" => {
inherit_from => [ "VC-WIN32" ],
lflags => '/subsystem:console,"5.01" /opt:ref',
bin_lflags => '/subsystem:console,"5.01" /opt:ref',
},
"VC-WIN64A-XP" => {
inherit_from => [ "VC-WIN64A" ],
lflags => '/subsystem:console,"5.02" /opt:ref',
bin_lflags => '/subsystem:console,"5.02" /opt:ref',
},
);
I just built for openssl 1.1.1t, and with the crypto\thread_win.c patch, I just finished building for openssl-3.0.8. I have to now recompile and test a few tools using v3.0.8. |
Problem
OpenSSL 3.0.0 to 3.0.5 binaries built with MS-VC++ 2008 always fails to run on Windows XP 32-bit Editions.
Solution
VC++ 2008 or earlier x86 compilers do not have an inline implementation of InterlockedOr64 for 32bit CPUs, then OpenSSL 3.0.0 to 3.0.5 binaries built with MS-VC++ 2008 will always fail to run on Windows XP 32bit.
See: https://docs.microsoft.com/en-us/cpp/intrinsics/interlockedor-intrinsic-functions#requirements
To work around this problem, we implement a manual locking mechanism for only VC++ 2008 or earlier x86 compilers.
Related issue
This patch fixes #18855