-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Windows build: Control flow guard feature (/guard:cf) #1592
Comments
We have not considered it. Can you add the flag by hand on the config line and see how it works? |
There are two ambiguities in suggestion. One is that attempt to pass option starting with slash will be rejected by Configure. Fortunately MSVC accepts both slash and dash, i.e. /guard:cf and -guard:cf are interchangeable. Secondly, and more importantly, passing [dash-form of] this option at config-time won't work all the way, because it will be used when generating .obj-s, but not when linking .dll-s and .exe-s. And latter is as essential. This is because we call link.exe directly and it needs own flag. Fortunately there is a way to slip in command line arguments, and even without passing additional flags at config-time. One can |
@dot-asm provided a workaround for this above - so closing. |
I'm reopening this issue because the proposed workaround no longer works.
/guard:cf is also missing from the linker command
I think it would probably be a good idea to enable CFG by default. All Windows system dlls have CFG enabled. |
Ping @dot-asm |
any chance that this issue can be reopened? Thanks. |
We added option /guard:cf in MSVC 14.12.25827 (from VS 2017) compiler and linker when building openssl 1.0.2p, we saw exception:
OPENSSL_UplinkTable[APPLINK_FSETMOD] is in assembly code generated by /openssl/src/ms/uplink-x86_64.pl, the assembly code is parsed by nasm. Checked latest nasm and ml64, they don't have equivalent option for C compiler/Linker option /guard:cf, this might be the reason of failure. Checked Thanks! |
Is there any update on this issue? We have an organizational mandate to enable the /guard:cf. Once we do we run into this issue running openssl.exe genrsa -out foo.pem 2048. If we do not add the -out param then this does not occur. We need to build 1.1.1 as we have many services with a dependency on this version. Currently we are using msvc (2017 compilers) although the same issue occurs with 2019 compilers as well as on the latest master 3.0 build of openssl. |
@noahdav , I've been looking into this too. I've been able to track down the cause of the crash. It is related to using the Netwide nasm assembler instead of the Microsoft masm assembler. I suspect the masm puts something in the headers to for CFG to use. The good news for the 64 bit image is that this configuration works great: If you are using the 32 bit code, the perlasm will take a lot of conversion to build with masm, so it isn't a slam dunk like above. I've found that directly referencing the asm functions in C gets the linker to mark the functions as CFG compatible, but suspect there is a better solution for that. I'm probably going to create a specific issue for the 32-bit CFG and put everything I've found in there. |
@bonafideduck Thanks for the information. I will give this a shot for the 64 bit build but we still have a few uses of 32 bit as well. Can you please add the link to whatever issue you add. |
I was wondering if you have already considered to enable the control flow guard feature [1] for MSVC (Visual Studio 2015) Windows builds?
Compiler switch: /guard:cf
The text was updated successfully, but these errors were encountered: