Pass seed corpus list in a file to get around argument length limits on Windows.
This limit was preventing many uses of fork mode on Windows.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 31171 Build 31170: arc lint + arc unit
Event Timeline
- undo accidental
compiler-rt/lib/fuzzer/FuzzerDriver.cpp | ||
---|---|---|
784 | Removing the file is somewhat hostile to users but is the best way to prevent the accumulation of files in fork mode. | |
compiler-rt/test/fuzzer/cross_over.test | ||
18 ↗ | (On Diff #196154) | The reason why I do this hacky python thing is because echo leaves a trailing newline and printf didn't work well with the percent formatting. |
compiler-rt/lib/fuzzer/FuzzerDriver.cpp | ||
---|---|---|
784 | A bit too hostile indeed, and in this case the file is deleted by a process that didn't create it, making it more confusing. | |
compiler-rt/lib/fuzzer/FuzzerFlags.def | ||
24–25 | I found this flag to be useful by itself, outside the fork mode, so instead of replacing it with a new flag,
| |
compiler-rt/lib/fuzzer/FuzzerFork.cpp | ||
128 | for readability, I'd prefer to introduce another variant of WriteToFile: void WriteToFile(const std::string &Str, const std::string &Path); | |
compiler-rt/test/fuzzer/cross_over.test | ||
18 ↗ | (On Diff #196154) | no need to change this test with the change I proposed. |
compiler-rt/test/fuzzer/seed_inputs_file.test | ||
4 ↗ | (On Diff #196165) | will echo -n work in this case? |
compiler-rt/lib/fuzzer/FuzzerFlags.def | ||
---|---|---|
24–25 | So that "@" will be necessary to distinguish between a case where we want to use one seed and a case where we want to use the file as the seed list? |
compiler-rt/lib/fuzzer/FuzzerFlags.def | ||
---|---|---|
24–25 | Yes. |
- change name of test
- Get list argument working again
- combine code
- rename
- Use old method
compiler-rt/lib/fuzzer/FuzzerDriver.cpp | ||
---|---|---|
784 | Done. | |
compiler-rt/lib/fuzzer/FuzzerFlags.def | ||
24–25 | Done. Please let me know if you think the help message needs work. | |
compiler-rt/lib/fuzzer/FuzzerFork.cpp | ||
128 | Done. | |
compiler-rt/test/fuzzer/cross_over.test | ||
18 ↗ | (On Diff #196154) | Undid this change and the one in len_control. |
compiler-rt/test/fuzzer/seed_inputs_file.test | ||
4 ↗ | (On Diff #196165) | Yeah good suggestion, that's much better. For some reason I thought it wouldn't work on Windows. |
LGTM with several nits.
compiler-rt/lib/fuzzer/FuzzerDriver.cpp | ||
---|---|---|
771 | plz make this if-else more compact (no {}, comments on the same line) | |
compiler-rt/lib/fuzzer/FuzzerFlags.def | ||
24–25 | "of input files" repeated twice? | |
compiler-rt/test/fuzzer/seed_inputs.test | ||
4 | replace with CHECK: then remove all --check-prefix | |
18 | terminate the file with a newline |
compiler-rt/test/fuzzer/seed_inputs.test | ||
---|---|---|
4 | I added a test to ensure we handle a single file correctly instead. |
@kcc I've changed things so that libFuzzer will fail if the argument to -seed_inputs is a non existent file or is empty? What do you think of this change?
plz make this if-else more compact (no {}, comments on the same line)