Clean up after leftover AFL processes #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In permanent mode AFL leaves some processes behind:
#14 (comment)
This is partly due to bun using proc#terminate (SIGKILL),
but even with SIGTERM there are race conditions in AFL
and some processes stay behind:
https://groups.google.com/d/topic/afl-users/E37s4YDti7o
This can observed by just doing a 'dune runtest' in bun itself,
and then
ps -ef|grep short.exe
on a multicore machine.The permanent mode processes stop themselves with SIGSTOP and wait for
their afl parent to unblock them, but their afl parent exits, so they
stay around forever.
Which wouldn't be a problem, except for afl-gotcpu which detect that
these processes are around and refuses to start more fuzzing jobs.
The processes' parent pid, gid and sid is unrelated to bun or the afl
fuzzer processes (afl/forkserver does a setsid call),
so we have no easy way of finding these processes.
Use cgroups when available to kill child processes reliably: this allows
us to easily find all the pids of (grand)children.
Fixes #14