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

0 available cores detected! #11

Open
jmid opened this issue Jul 4, 2019 · 1 comment
Open

0 available cores detected! #11

jmid opened this issue Jul 4, 2019 · 1 comment

Comments

@jmid
Copy link

jmid commented Jul 4, 2019

I'm Using opam with OCaml 4.07.1+afl on my MacBook Pro with macports.
Crowbar (0.1) works. I can compile with
ocamlbuild -package crowbar firsttry.native and run afl-fuzz manually:

$ afl-fuzz -i in -o out -- ./firsttry.native @@
afl-fuzz 2.52b by <[email protected]>
[+] You have 4 CPU cores and 3 runnable tasks (utilization: 75%).
[+] Try parallel jobs - see /opt/local/share/doc/afl/parallel_fuzzing.txt.
...

I then got curious in giving bun a spin. I installed with opam install bun (installed bun.0.3.3). But when I run:

$ bun -i in -o out ./firsttry.native
07:34.46:Fuzzers launched: [].
$

and I get back the prompt (after the 5sec delay).
Adding verbose flags helps a bit on the output:

$ bun -v -v -i in -o out ./firsttry.native
07:36.09:[EXEC:30310]['afl-gotcpu']
07:36.09:[EXEC:30311]['grep' 'more processes on ']
07:36.14:[INFO]0 available cores detected!
07:36.14:Fuzzers launched: [].
$

I can work around it by supplying -s though:

$ bun -v -v -s -i in -o out ./firsttry.native
07:37.45:[EXEC:30317]['afl-gotcpu']
07:37.45:[EXEC:30318]['grep' 'more processes on ']
07:37.50:[INFO]1 available cores detected!
07:37.50:[INFO]Executing /Users/jmid/.opam/4.07.1+afl/bin/afl-fuzz -m 200 -i in -o out -S 1 -- ./firsttry.native @@
07:37.50:[INFO]/Users/jmid/.opam/4.07.1+afl/bin/afl-fuzz launched: PID 30319
07:37.50:Fuzzer 1 (pid=30319) launched.
afl-fuzz 2.52b by <[email protected]>
[+] Disabling the UI because AFL_NO_UI is set.
[+] You have 4 CPU cores and 2 runnable tasks (utilization: 50%).
[+] Try parallel jobs - see docs/parallel_fuzzing.txt.
...
@icristescu
Copy link

I also run into the same problem. dune runtest on macos, results in
15:39.20:[INFO]0 available cores detected!

I investigate it a bit, and this issue is because the command afl-getcpu has different outputs for macos and Linux:

in macos:

$ afl-gotcpu
afl-gotcpu 2.52b by <[email protected]>
[*] Measuring gross preemption rate (this will take 5.00 sec)...

>>> PASS: You can probably run additional processes. <<<

in Linux:

$ afl-gotcpu
afl-gotcpu 2.49b by <[email protected]>
[*] Measuring per-core preemption rate (this will take 1.00 sec)...
    Core #0: CAUTION (231%)
 
>>> CAUTION: You may still have 1 core available. <<<

You can also see this in the implementation of afl-gotcpu.

The problem is here:the number of cpu availables cannot be extracted from the output of the command.

The workaround is indeed to use the --single-core option but this defeats the purpose of bun.

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

No branches or pull requests

2 participants