Skip to content
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 Support #379

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft

Windows Support #379

wants to merge 14 commits into from

Conversation

RossSmyth
Copy link

@RossSmyth RossSmyth commented Jul 24, 2024

Note: I will clean up the commits once it's mostly working

This crate is quite close to supporting Windows. The crates will already build without issue. Things to do:

  • Add the directory that clang_rt.asan_dynamic-x86_64.dll is in to $PATH of the fuzzer process

With this change it is possible to run the fuzzers too.

This directory is not on PATH by default, so the binary cannot load the DLL when run. It is recommended to add it to PATH before running the binary. It somewhere like
C:\Program Files (x86)\Microsoft Visual Studio\[MSVC VERSION]\BuildTools\VC\Tools\MSVC\[RT VERSION]\bin\Hostx64\x64

asan is fairly new to MSVC so it will only exist on versions newer than 2019.

This DLL resides in the same directory as link.exe & cl.exe so the most accurate way to obtain it is to do the same process rustc does to get the location of link.exe. This ensures that the runtime & msvc version matches the one used to compile the binary.

Note: this is required for sanitizers = none as well. Windows does not support any other sanitizers at this time.

  • Fix-up tests so that they pass on Windows too

There are errors that are *nix specific that need to be fixed up. It is mainly fixing str paths that will be displayed incorrectly on Windows.

  • init_twice

  • add_twice

  • build_dev

  • build_all

  • build_one

  • run_a_few_inputs

  • run_alt_corpus

  • run_diagnostic_contains_fuzz_dir

  • run_one_input

  • run_without_sanitizer_with_crash

  • run_with_crash

  • run_with_coverage

  • tmin

  • Ensure child processes are always terminated

The win32 Job Objects API is what is needed for this. Essentially, get its info, set the info so that it has JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE set.

  • Ensure the fuzzer runs?

For some reason on my work computer the fuzzer just hangs when it opens, not doing anything. At home it seems to work as expected. I'm not sure why.

Looks like every thread it hanging out in `NtWaitForAlertByThreadId`. IDK what that means.

(lldb) thread backtrace all 
* thread #7
  * frame #0: �[33m0x00007ffe84ef0f94�[0m ntdll.dll`NtWaitForAlertByThreadId + 20
    frame #1: �[33m0x00007ffe84e83270�[0m ntdll.dll`RtlLookupFunctionEntry + 1680
    frame #2: �[33m0x00007ffe84ea2bb1�[0m ntdll.dll`RtlWalkFrameChain + 1169
    frame #3: �[33m0x00007ffe84ea28ba�[0m ntdll.dll`RtlWalkFrameChain + 410
    frame #4: �[33m0x00007ffe84ea274a�[0m ntdll.dll`RtlWalkFrameChain + 42
    frame #5: �[33m0x00007ffe84ea26e2�[0m ntdll.dll`RtlCaptureStackBackTrace + 66
    frame #6: �[33m0x00007ffdecb3749c�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_symbolize_pc + 16732
    frame #7: �[33m0x00007ffdecb33202�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_dump_trace_pc_guard_coverage + 11650
    frame #8: �[33m0x00007ffdecb72c33�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_version_mismatch_check_v8 + 1651
    frame #9: �[33m0x00007ffdecb6471c�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_wrap_RtlAllocateHeap + 444
    frame #10: �[33m0x00007ffe84ea4cdf�[0m ntdll.dll`RtlLoadString + 4511
    frame #11: �[33m0x00007ffe84ea4b2d�[0m ntdll.dll`RtlLoadString + 4077
    frame #12: �[33m0x00007ffe84e677a7�[0m ntdll.dll`LdrShutdownThread + 855
    frame #13: �[33m0x00007ffe84ec60a4�[0m ntdll.dll`LdrInitializeThunk + 1156
    frame #14: �[33m0x00007ffe84ec5c83�[0m ntdll.dll`LdrInitializeThunk + 99
    frame #15: �[33m0x00007ffe84ec5c2e�[0m ntdll.dll`LdrInitializeThunk + 14
  thread #2
    frame #0: �[33m0x00007ffe84ef0f94�[0m ntdll.dll`NtWaitForAlertByThreadId + 20
    frame #1: �[33m0x00007ffe84e83270�[0m ntdll.dll`RtlLookupFunctionEntry + 1680
    frame #2: �[33m0x00007ffe84ea2bb1�[0m ntdll.dll`RtlWalkFrameChain + 1169
    frame #3: �[33m0x00007ffe84ea28ba�[0m ntdll.dll`RtlWalkFrameChain + 410
    frame #4: �[33m0x00007ffe84ea274a�[0m ntdll.dll`RtlWalkFrameChain + 42
    frame #5: �[33m0x00007ffe84ea26e2�[0m ntdll.dll`RtlCaptureStackBackTrace + 66
    frame #6: �[33m0x00007ffdecb3749c�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_symbolize_pc + 16732
    frame #7: �[33m0x00007ffdecb33202�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_dump_trace_pc_guard_coverage + 11650
    frame #8: �[33m0x00007ffdecb72c33�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_version_mismatch_check_v8 + 1651
    frame #9: �[33m0x00007ffdecb63bec�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_wrap_LocalAlloc + 284
    frame #10: �[33m0x00007ffe790a98cd�[0m TmUmEvt64.dll
    frame #11: �[33m0x00007ffe790aa607�[0m TmUmEvt64.dll`void TmmonDestoryAddonObject(void) + 1143
    frame #12: �[33m0x00007ffe790a99c1�[0m TmUmEvt64.dll
    frame #13: �[33m0x0000000076a29694�[0m tmmon64.dll
    frame #14: �[33m0x0000000076a4cd32�[0m tmmon64.dll
    frame #15: �[33m0x0000000076a4d077�[0m tmmon64.dll
    frame #16: �[33m0x0000000076973c39�[0m tmmon64.dll
    frame #17: �[33m0x00007ffe84e9ec5e�[0m ntdll.dll`RtlExitUserThread + 46
    frame #18: �[33m0x00007ffe84e9dd28�[0m ntdll.dll`TpReleaseCleanupGroupMembers + 4200
    frame #19: �[33m0x00007ffe848f7374�[0m kernel32.dll`BaseThreadInitThunk + 20
    frame #20: �[33m0x00007ffe84e9cc91�[0m ntdll.dll`RtlUserThreadStart + 33
  thread #1
    frame #0: �[33m0x00007ffe84ef0f94�[0m ntdll.dll`NtWaitForAlertByThreadId + 20
    frame #1: �[33m0x00007ffe84e83270�[0m ntdll.dll`RtlLookupFunctionEntry + 1680
    frame #2: �[33m0x00007ffe84ea2bb1�[0m ntdll.dll`RtlWalkFrameChain + 1169
    frame #3: �[33m0x00007ffe84ea28ba�[0m ntdll.dll`RtlWalkFrameChain + 410
    frame #4: �[33m0x00007ffe84ea274a�[0m ntdll.dll`RtlWalkFrameChain + 42
    frame #5: �[33m0x00007ffe84ea26e2�[0m ntdll.dll`RtlCaptureStackBackTrace + 66
    frame #6: �[33m0x00007ffdecb3749c�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_symbolize_pc + 16732
    frame #7: �[33m0x00007ffdecb33202�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_dump_trace_pc_guard_coverage + 11650
    frame #8: �[33m0x00007ffdecb72c33�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_version_mismatch_check_v8 + 1651
    frame #9: �[33m0x00007ffdecb3e853�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_new_array + 211
    frame #10: �[33m0x00007ff6a232ffb2�[0m fuzz_target_1.exe`LLVMFuzzerRunDriver + 198482
    frame #11: �[33m0x00007ff6a22e43c2�[0m fuzz_target_1.exe`__sanitizer_weak_hook_strstr + 64546
    frame #12: �[33m0x00007ff6a22e63af�[0m fuzz_target_1.exe`__sanitizer_weak_hook_strstr + 72719
    frame #13: �[33m0x00007ff6a22e4bd0�[0m fuzz_target_1.exe`__sanitizer_weak_hook_strstr + 66608
    frame #14: �[33m0x00007ff6a22f928e�[0m fuzz_target_1.exe`LLVMFuzzerMutate + 44510
    frame #15: �[33m0x00007ff6a22ccb23�[0m fuzz_target_1.exe`main + 35
    frame #16: �[33m0x00007ff6a23308b8�[0m fuzz_target_1.exe`LLVMFuzzerRunDriver + 200792
    frame #17: �[33m0x00007ffe848f7374�[0m kernel32.dll`BaseThreadInitThunk + 20
    frame #18: �[33m0x00007ffe84e9cc91�[0m ntdll.dll`RtlUserThreadStart + 33
  thread #6
    frame #0: �[33m0x00007ffe84ef0f94�[0m ntdll.dll`NtWaitForAlertByThreadId + 20
    frame #1: �[33m0x00007ffe84e83270�[0m ntdll.dll`RtlLookupFunctionEntry + 1680
    frame #2: �[33m0x00007ffe84ea2bb1�[0m ntdll.dll`RtlWalkFrameChain + 1169
    frame #3: �[33m0x00007ffe84ea28ba�[0m ntdll.dll`RtlWalkFrameChain + 410
    frame #4: �[33m0x00007ffe84ea274a�[0m ntdll.dll`RtlWalkFrameChain + 42
    frame #5: �[33m0x00007ffe84ea26e2�[0m ntdll.dll`RtlCaptureStackBackTrace + 66
    frame #6: �[33m0x00007ffdecb3749c�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_symbolize_pc + 16732
    frame #7: �[33m0x00007ffdecb33202�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_dump_trace_pc_guard_coverage + 11650
    frame #8: �[33m0x00007ffdecb72c33�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_version_mismatch_check_v8 + 1651
    frame #9: �[33m0x00007ffdecb6471c�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_wrap_RtlAllocateHeap + 444
    frame #10: �[33m0x00007ffe84ea4cdf�[0m ntdll.dll`RtlLoadString + 4511
    frame #11: �[33m0x00007ffe84ea4b2d�[0m ntdll.dll`RtlLoadString + 4077
    frame #12: �[33m0x00007ffe84e677a7�[0m ntdll.dll`LdrShutdownThread + 855
    frame #13: �[33m0x00007ffe84ec60a4�[0m ntdll.dll`LdrInitializeThunk + 1156
    frame #14: �[33m0x00007ffe84ec5c83�[0m ntdll.dll`LdrInitializeThunk + 99
    frame #15: �[33m0x00007ffe84ec5c2e�[0m ntdll.dll`LdrInitializeThunk + 14
  thread #4
    frame #0: �[33m0x00007ffe84ef0f94�[0m ntdll.dll`NtWaitForAlertByThreadId + 20
    frame #1: �[33m0x00007ffe84e83270�[0m ntdll.dll`RtlLookupFunctionEntry + 1680
    frame #2: �[33m0x00007ffe84ea2bb1�[0m ntdll.dll`RtlWalkFrameChain + 1169
    frame #3: �[33m0x00007ffe84ea28ba�[0m ntdll.dll`RtlWalkFrameChain + 410
    frame #4: �[33m0x00007ffe84ea274a�[0m ntdll.dll`RtlWalkFrameChain + 42
    frame #5: �[33m0x00007ffe84ea26e2�[0m ntdll.dll`RtlCaptureStackBackTrace + 66
    frame #6: �[33m0x00007ffdecb3749c�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_symbolize_pc + 16732
    frame #7: �[33m0x00007ffdecb33202�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_dump_trace_pc_guard_coverage + 11650
    frame #8: �[33m0x00007ffdecb72c33�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_version_mismatch_check_v8 + 1651
    frame #9: �[33m0x00007ffdecb63bec�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_wrap_LocalAlloc + 284
    frame #10: �[33m0x00007ffe790a98cd�[0m TmUmEvt64.dll
    frame #11: �[33m0x00007ffe790aa607�[0m TmUmEvt64.dll`void TmmonDestoryAddonObject(void) + 1143
    frame #12: �[33m0x00007ffe790a99c1�[0m TmUmEvt64.dll
    frame #13: �[33m0x0000000076a29694�[0m tmmon64.dll
    frame #14: �[33m0x0000000076a4cd32�[0m tmmon64.dll
    frame #15: �[33m0x0000000076a4d077�[0m tmmon64.dll
    frame #16: �[33m0x0000000076973c39�[0m tmmon64.dll
    frame #17: �[33m0x00007ffe84e9ec5e�[0m ntdll.dll`RtlExitUserThread + 46
    frame #18: �[33m0x00007ffe84e9dd28�[0m ntdll.dll`TpReleaseCleanupGroupMembers + 4200
    frame #19: �[33m0x00007ffe848f7374�[0m kernel32.dll`BaseThreadInitThunk + 20
    frame #20: �[33m0x00007ffe84e9cc91�[0m ntdll.dll`RtlUserThreadStart + 33
  thread #5
    frame #0: �[33m0x00007ffe84ef0f94�[0m ntdll.dll`NtWaitForAlertByThreadId + 20
    frame #1: �[33m0x00007ffe84e83270�[0m ntdll.dll`RtlLookupFunctionEntry + 1680
    frame #2: �[33m0x00007ffe84ea2bb1�[0m ntdll.dll`RtlWalkFrameChain + 1169
    frame #3: �[33m0x00007ffe84ea28ba�[0m ntdll.dll`RtlWalkFrameChain + 410
    frame #4: �[33m0x00007ffe84ea274a�[0m ntdll.dll`RtlWalkFrameChain + 42
    frame #5: �[33m0x00007ffe84ea26e2�[0m ntdll.dll`RtlCaptureStackBackTrace + 66
    frame #6: �[33m0x00007ffdecb3749c�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_symbolize_pc + 16732
    frame #7: �[33m0x00007ffdecb33202�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_dump_trace_pc_guard_coverage + 11650
    frame #8: �[33m0x00007ffdecb72c33�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_version_mismatch_check_v8 + 1651
    frame #9: �[33m0x00007ffdecb6471c�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_wrap_RtlAllocateHeap + 444
    frame #10: �[33m0x00007ffe790fd6b4�[0m TmUmEvt64.dll`void TmmonDestoryAddonObject(void) + 341284
    frame #11: �[33m0x00007ffe790e12a3�[0m TmUmEvt64.dll`void TmmonDestoryAddonObject(void) + 225555
    frame #12: �[33m0x00007ffe790b570f�[0m TmUmEvt64.dll`void TmmonDestoryAddonObject(void) + 46463
    frame #13: �[33m0x00007ffe790b25e3�[0m TmUmEvt64.dll`void TmmonDestoryAddonObject(void) + 33875
    frame #14: �[33m0x00007ffe790b36c8�[0m TmUmEvt64.dll`void TmmonDestoryAddonObject(void) + 38200
    frame #15: �[33m0x00007ffe790b4049�[0m TmUmEvt64.dll`void TmmonDestoryAddonObject(void) + 40633
    frame #16: �[33m0x00007ffe7901e1e8�[0m TmUmEvt64.dll
    frame #17: �[33m0x00007ffe79020357�[0m TmUmEvt64.dll
    frame #18: �[33m0x00007ffe7902030d�[0m TmUmEvt64.dll
    frame #19: �[33m0x00007ffe7902146b�[0m TmUmEvt64.dll
    frame #20: �[33m0x00007ffe7905e90c�[0m TmUmEvt64.dll
    frame #21: �[33m0x00007ffe7905f30c�[0m TmUmEvt64.dll
    frame #22: �[33m0x00007ffe790a09a3�[0m TmUmEvt64.dll
    frame #23: �[33m0x00000000769713c6�[0m tmmon64.dll
    frame #24: �[33m0x0000000076a4cdd2�[0m tmmon64.dll
    frame #25: �[33m0x0000000076a4d077�[0m tmmon64.dll
    frame #26: �[33m0x0000000076972fa5�[0m tmmon64.dll
    frame #27: �[33m0x00007ffe84e6354a�[0m ntdll.dll`RtlAddRefActivationContext + 138
    frame #28: �[33m0x00007ffe84e62252�[0m ntdll.dll`TpIsTimerSet + 594
    frame #29: �[33m0x00007ffe84e60921�[0m ntdll.dll`RtlIsProcessorFeaturePresent + 177
    frame #30: �[33m0x00007ffe84e5fb05�[0m ntdll.dll`TpAllocWork + 2085
    frame #31: �[33m0x00007ffe84e64bcf�[0m ntdll.dll`RtlIsCriticalSectionLockedByThread + 831
    frame #32: �[33m0x00007ffe84eb1253�[0m ntdll.dll`RtlUnlockHeap + 6211
    frame #33: �[33m0x00007ffe84eb0f80�[0m ntdll.dll`RtlUnlockHeap + 5488
    frame #34: �[33m0x00007ffe84eb021f�[0m ntdll.dll`RtlUnlockHeap + 2063
    frame #35: �[33m0x00007ffe84e6fb53�[0m ntdll.dll`RtlGetFullPathName_UstrEx + 8899
    frame #36: �[33m0x00007ffe84e673e4�[0m ntdll.dll`RtlDosPathNameToNtPathName_U + 212
    frame #37: �[33m0x00007ffe84e66af4�[0m ntdll.dll`LdrLoadDll + 228
    frame #38: �[33m0x00000000769733c4�[0m tmmon64.dll
    frame #39: �[33m0x00007ffe825a2612�[0m KernelBase.dll`LoadLibraryExW + 354
    frame #40: �[33m0x00007ffe8296c050�[0m ucrtbase.dll`__stdio_common_vfwprintf + 1264
    frame #41: �[33m0x00007ffe8297357b�[0m ucrtbase.dll`_o__difftime64 + 203
    frame #42: �[33m0x00007ffe82971be4�[0m ucrtbase.dll`_configthreadlocale + 196
    frame #43: �[33m0x00007ffdecb748ff�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_default_suppressions__dll + 4879
    frame #44: �[33m0x00007ffe848f7374�[0m kernel32.dll`BaseThreadInitThunk + 20
    frame #45: �[33m0x00007ffe84e9cc91�[0m ntdll.dll`RtlUserThreadStart + 33
  thread #3
    frame #0: �[33m0x00007ffe84ef0f94�[0m ntdll.dll`NtWaitForAlertByThreadId + 20
    frame #1: �[33m0x00007ffe84e83270�[0m ntdll.dll`RtlLookupFunctionEntry + 1680
    frame #2: �[33m0x00007ffe84ea2bb1�[0m ntdll.dll`RtlWalkFrameChain + 1169
    frame #3: �[33m0x00007ffe84ea28ba�[0m ntdll.dll`RtlWalkFrameChain + 410
    frame #4: �[33m0x00007ffe84ea274a�[0m ntdll.dll`RtlWalkFrameChain + 42
    frame #5: �[33m0x00007ffe84ea26e2�[0m ntdll.dll`RtlCaptureStackBackTrace + 66
    frame #6: �[33m0x00007ffdecb3749c�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_symbolize_pc + 16732
    frame #7: �[33m0x00007ffdecb33202�[0m clang_rt.asan_dynamic-x86_64.dll`__sanitizer_dump_trace_pc_guard_coverage + 11650
    frame #8: �[33m0x00007ffdecb72c33�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_version_mismatch_check_v8 + 1651
    frame #9: �[33m0x00007ffdecb63bec�[0m clang_rt.asan_dynamic-x86_64.dll`__asan_wrap_LocalAlloc + 284
    frame #10: �[33m0x00007ffe790a98cd�[0m TmUmEvt64.dll
    frame #11: �[33m0x00007ffe790aa607�[0m TmUmEvt64.dll`void TmmonDestoryAddonObject(void) + 1143
    frame #12: �[33m0x00007ffe790a99c1�[0m TmUmEvt64.dll
    frame #13: �[33m0x0000000076a29694�[0m tmmon64.dll
    frame #14: �[33m0x0000000076a4cd32�[0m tmmon64.dll
    frame #15: �[33m0x0000000076a4d077�[0m tmmon64.dll
    frame #16: �[33m0x0000000076973c39�[0m tmmon64.dll
    frame #17: �[33m0x00007ffe84e9ec5e�[0m ntdll.dll`RtlExitUserThread + 46
    frame #18: �[33m0x00007ffe84e9dd28�[0m ntdll.dll`TpReleaseCleanupGroupMembers + 4200
    frame #19: �[33m0x00007ffe848f7374�[0m kernel32.dll`BaseThreadInitThunk + 20
    frame #20: �[33m0x00007ffe84e9cc91�[0m ntdll.dll`RtlUserThreadStart + 33

RossSmyth and others added 2 commits July 24, 2024 17:33
Add directory where asan DLL is to path when running.

Improve diagnostics
@fitzgen
Copy link
Member

fitzgen commented Jul 25, 2024

Nice! Does cargo fuzz run my-fuzzer --sanitizer=none already work, if this is just about getting asan linked in?

@RossSmyth
Copy link
Author

I added a function for setting up a Windows JobObject so that all child processes are cleaned up when cargo-fuzz is terminated.

@RossSmyth
Copy link
Author

Nice! Does cargo fuzz run my-fuzzer --sanitizer=none already work, if this is just about getting asan linked in?

Hmm trying it with --sanitizers=none results in a build failure of the fuzz project.

PS C:\Users\rsmyth\Documents\test_project> ..\..\cargo-fuzz\target\debug\cargo-fuzz.exe run fuzz_target_1 --sanitizer=none
warning: test_project-fuzz v0.0.0 (C:\Users\rsmyth\Documents\test_project\fuzz) ignoring invalid dependency `test_project` which is missing a lib target
   Compiling once_cell v1.19.0
   Compiling arbitrary v1.3.2
   Compiling libfuzzer-sys v0.4.7
   Compiling test_project-fuzz v0.0.0 (C:\Users\rsmyth\Documents\test_project\fuzz)
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.40.33807\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\rsmyth\\AppData\\Local\\Temp\\rustc6xktQl\\symbols.o" "C:\\Users\\rsmyth\\Documents\\test_project\\fuzz\\target\\x86_64-pc-windows-msvc\\release\\deps\\fuzz_target_1.fuzz_target_1.11e554e2e5471688-cgu.0.rcgu.o" "/LIBPATH:C:\\Users\\rsmyth\\Documents\\test_project\\fuzz\\target\\x86_64-pc-windows-msvc\\release\\deps" "/LIBPATH:C:\\Users\\rsmyth\\Documents\\test_project\\fuzz\\target\\release\\deps" "/LIBPATH:C:\\Users\\rsmyth\\Documents\\test_project\\fuzz\\target\\x86_64-pc-windows-msvc\\release\\build\\libfuzzer-sys-0db93598c93951c8\\out" "/LIBPATH:C:\\Users\\rsmyth\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "C:\\Users\\rsmyth\\AppData\\Local\\Temp\\rustc6xktQl\\liblibfuzzer_sys-8d7934011650b828.rlib" "C:\\Users\\rsmyth\\AppData\\Local\\Temp\\rustc6xktQl\\libstd-cef76c2685dfb4ca.rlib" "C:\\Users\\rsmyth\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins-a6954cc40265b962.rlib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "kernel32.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/LIBPATH:C:\\Users\\rsmyth\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:C:\\Users\\rsmyth\\Documents\\test_project\\fuzz\\target\\x86_64-pc-windows-msvc\\release\\deps\\fuzz_target_1.exe" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\rsmyth\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\rsmyth\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\rsmyth\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\rsmyth\\.rustup\\toolchains\\nightly-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis" "/include:main"
  = note:    Creating library C:\Users\rsmyth\Documents\test_project\fuzz\target\x86_64-pc-windows-msvc\release\deps\fuzz_target_1.lib and object C:\Users\rsmyth\Documents\test_project\fuzz\target\x86_64-pc-windows-msvc\release\deps\fuzz_target_1.exp
          fuzz_target_1.fuzz_target_1.11e554e2e5471688-cgu.0.rcgu.o : error LNK2019: unresolved external symbol __start___sancov_cntrs referenced in function sancov.module_ctor_8bit_counters
          fuzz_target_1.fuzz_target_1.11e554e2e5471688-cgu.0.rcgu.o : error LNK2019: unresolved external symbol __stop___sancov_cntrs referenced in function sancov.module_ctor_8bit_counters
          fuzz_target_1.fuzz_target_1.11e554e2e5471688-cgu.0.rcgu.o : error LNK2019: unresolved external symbol __start___sancov_pcs referenced in function sancov.module_ctor_8bit_counters
          fuzz_target_1.fuzz_target_1.11e554e2e5471688-cgu.0.rcgu.o : error LNK2019: unresolved external symbol __stop___sancov_pcs referenced in function sancov.module_ctor_8bit_counters
          C:\Users\rsmyth\Documents\test_project\fuzz\target\x86_64-pc-windows-msvc\release\deps\fuzz_target_1.exe : fatal error LNK1120: 4 unresolved externals


error: could not compile `test_project-fuzz` (bin "fuzz_target_1") due to 1 previous error
Error: failed to build fuzz script: "cargo" "build" "--manifest-path" "C:\\Users\\rsmyth\\Documents\\test_project\\fuzz\\Cargo.toml" "--target" "x86_64-pc-windows-msvc" "--release" "--config" "profile.release.debug=true" "--bin" "fuzz_target_1"

Where the test project is just an empty Rust template with an empty fuzzer.

@RossSmyth
Copy link
Author

RossSmyth commented Jul 25, 2024

I did a dumpbin, and it looks like it requires some of the symbols the asan DLL provides. So on Windows it unconditionally needs to be linked with -Zsanitizer=address

@RossSmyth
Copy link
Author

Wow this library desperately needs golden file testing. The weird and(predicates::str::contains()) testing is extremely verbose and tedious. Plus when something is wrong, it just spews garbage out and is near impossible to tell what is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants