-
-
Notifications
You must be signed in to change notification settings - Fork 329
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 Stoppable trait to State which exposes an API to stop the fuzzer #2325
Conversation
…ps the fuzzer in fuzz_loop or fuzz_loop_for when set to true
I'm not sure about the name. How about |
Yeah, I wanted to keep it in line with AFL++ but I'll change it |
clippy complains. error[E0277]: the trait bound `S: libafl::state::HasShouldStopFuzzing` is not satisfied
--> src/fuzz.rs:68:8
|
68 | F: Fuzzer<E, EM, ST, State = S>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `libafl::state::HasShouldStopFuzzing` is not implemented for `S` Also, should the trait just be called |
We can do stoppable, but |
…int in libafl_libfuzzer report.rs
@domenukk I was also thinking of introducing a new |
And also adding this to |
I was thinking we can reuse that trait for other parts like the stage. But maybe you're right. WRT |
No let's keep Stoppable then, I had not thought of it's re-use potential. |
839ea38
to
631409f
Compare
Hmm this is still crashing when using
|
Usually if you use |
as far as i understand the stop event is not created at all so far, why would you need to ask for stopping the fuzzer from the state? |
The Stoppable trait would be the thing that stops fuzzing from a signal handler for example, the event is just a bonus to stop opther nodes as well (optionally) |
I don't think so, we don't have access to the state from the signal handler. i don't think it is easy to fix, since we could have a signal happening while we are mutating the state, so we cannot use static mut (except if we use synchronization primitives, but we would have an overhead for each access to the state, which is not something we want i believe) |
Ah right, I agree - we definitely need to set the flag outside of the state. Both PRs should be merged somehow |
@@ -716,7 +716,8 @@ where | |||
self.time_obs.clone(), | |||
)?; | |||
|
|||
self.main_run_client.take().unwrap()(state, c_mgr, *bind_to) | |||
self.main_run_client.take().unwrap()(state, c_mgr, *bind_to)?; |
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.
Shouldn't the run loop already reutrn ShuttingDown?
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.
Nope
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.
Why not? Also, can you change noed
-> node
in the main_run_client fn docu while you're having a PR open? :D
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.
where is this? I can't seem to find it.
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.
It is not necessary that the run_client function propagates Error::ShuttingDown, it may decide to handle it manually and return Ok(()), so we need to force return an Error::ShuttingDown
…called when calling on_shutdown anyways
…d reset_stop to discard_stop_request
@domenukk we should be good now |
Note that I still prefer cancel :P |
No description provided.