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

Add -M flag on 1st instance #17

Closed
wants to merge 2 commits into from

Conversation

edwintorok
Copy link
Contributor

https://aflplus.plus/ warns if you don't run one instance with -M when you use -S.

Commit on top of #16 due to conflicts.

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]>
https://aflplus.plus/ 2.68c requires the use of -M, it complains if I
use -S without it:
[!] WARNING: no -M main node found. You need to run one main instance!

Signed-off-by: Edwin Török <[email protected]>
talex5 added a commit to talex5/ocaml-bun that referenced this pull request Jul 6, 2021
The AFL docs say to do this, and according to ocurrent#17 it's required on
AFL++.
@talex5 talex5 mentioned this pull request Jul 6, 2021
talex5 added a commit to talex5/ocaml-bun that referenced this pull request Jul 6, 2021
The AFL docs say to do this, and according to ocurrent#17 it's required on
AFL++.
talex5 added a commit to talex5/ocaml-bun that referenced this pull request Jul 6, 2021
The AFL docs say to do this, and according to ocurrent#17 it's required on
AFL++.

Co-authored-by: Edwin Török <[email protected]>
talex5 added a commit to talex5/ocaml-bun that referenced this pull request Jul 6, 2021
The AFL docs say to do this, and according to ocurrent#17 it's required on
AFL++.

Co-authored-by: Edwin Török <[email protected]>
talex5 added a commit to talex5/ocaml-bun that referenced this pull request Jul 6, 2021
The AFL docs say to do this, and according to ocurrent#17 it's required on
AFL++.

Co-authored-by: Edwin Török <[email protected]>
@talex5
Copy link
Contributor

talex5 commented Jul 6, 2021

AFL also says it needs -M (even if it doesn't enforce it), so I made a simpler PR (#22) based on yours that just does this in all cases.

Thanks!

@talex5 talex5 closed this Jul 6, 2021
talex5 added a commit to talex5/opam-repository that referenced this pull request Jul 7, 2021
CHANGES:

- update to dune 2 (ocurrent/bun#18, by @talex5 and @edwintorok)
- use `-M` for first worker (ocurrent/bun#17, by @edwintorok and @talex5)
- move bun to https://github.com/ocurrent/bun (ocurrent/bun#20, by @talex5)
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.

2 participants