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

Clean up after leftover AFL processes #16

Open
wants to merge 1 commit into
base: primary
Choose a base branch
from

Conversation

edwintorok
Copy link
Contributor

@edwintorok edwintorok commented Sep 16, 2020

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

In permanent mode AFL leaves some processes behind:
ocurrent#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 ocurrent#14
Signed-off-by: Edwin Török <[email protected]>
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.

Leftover processes after successful bun run
1 participant