-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add new build option to support Windows DLLs #388
Conversation
…'exec_build()') for dependencies to detect when cargo-fuzz is running
…llows for Windows DLLs to be built *without* the '/include:main' linker argument. This, plus a few other tricks, allows for Windows DLLs to be built for fuzzing.
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.
Thanks!
|
@fitzgen - Thanks for your patience; I was out of town the past few days and haven't had a chance to address the two PRs. Just added the fix to set that argument's default value! |
Hi @fitzgen - just wanted to check in and see if you've been able to give this a second look! |
I was on vacation for a bit, re-running CI now. Thanks for your patience! |
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.
Thanks!
Thank you very much! Appreciate your help with getting this merged in 😄 |
@fitzgen - Will this be built into a future release? (When do you think that release would come?) It would be great to be able to pull this new code down via an updated version number in Let me know if there is anything I can do to help there. |
Hi - this PR implements a new build argument:
--no-include-main-msvc
- in order to help enable support for building and fuzzing Windows DLLs.I recently ran into an issue when attempting to fuzz a Windows-only DLL (#386) where the
/include:main
linker argument that is added duringFuzzProject::cargo()
for MSVC-based builds gave the DLL amain
symbol it could not resolve, which caused linking to fail:The DLL is, by nature, completely separate from the fuzzing targets in my cargo-fuzz repository, but I still wanted it to be a dependency listed in
fuzz/Cargo.toml
, so that it would be built and instrumented in the exact same way as the fuzzing target binaries. I found that by controlling whether or not/include:main
is added to thecargo build
arguments executed by cargo-fuzz, I was able to set up a "dummy" fuzzing target that provides its own main function:Then, by executing
cargo fuzz run --no-include-main-msvc --features=build_dll dummy_target
, the DLL would be built successfully. I could then proceed to run all other fuzzing targets, which would load in the instrumented DLL and fuzz it.TL;DR: This solution allows Windows DLLs to be instrumented & fuzzed, but only if manual control over
/include:main
is allowed (hence,--no-include-main-msvc
). This resolves #386.