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
LLVMFuzzerRunDriver() support #1515
Comments
can you please give some more information what is needed? |
LLVMFuzzerRunDriver starts the fuzzing loop. So yes we need to implement the driver, that then calls out to the fuzzer. |
Here's an example how it works with libFuzzer: #include <iostream>
extern "C" int LLVMFuzzerRunDriver(int *argc, char ***argv,
int (*callback)(const uint8_t *data, size_t size));
int MyFuzzTarget(const uint8_t *data, size_t size) {
std::cout << "Fuzz me!\n";
return 0;
}
int main(int argc, char *argv[]) {
std::cout << "I must run before fuzzing! ";
std::cout << "Can't do LLVMFuzzerInitialize, sorry.\n";
LLVMFuzzerRunDriver(&argc, &argv, &MyFuzzTarget);
}
libFuzzer provides an additional
|
@lszekeres can you have a look - or better test - if b7a2c7e is already all that is needed? |
plus 636025d |
That's a nice solution! I wonder if there's any potential price for the indirect call here, alternatively we could add a function that both, main and the runner, call and then main can call directly though to LLVMTestOneInput, the runner calls the callback |
thanks! if we fix the rest of the calls too, it's doing something :) |
I wrote that in the hotel lobby after a night were our flight had to return to the airport due hydraulic problems ... ;) |
Please support the LLVMFuzzerRunDriver interface to enable fuzzing targets that must provide their own
main()
.Supporting this should be simple, i.e., by putting something like:
in a separate compilation unit (see e.g., libfuzzer) and allow linking without it. So the fuzz target's
main
can run first, which can call the engine's "main", i.e.,LLVMFuzzerRunDriver()
.cc: @domenukk
The text was updated successfully, but these errors were encountered: