swtv-kaist / cs458-spring24

6 stars 0 forks source link

[HW6] How to find coverage info with `gcov`? #32

Closed leejy12 closed 4 months ago

leejy12 commented 4 months ago

Hello, I want to see if I understood the problems correctly.

In Problem 1(c)(iii), it asks to find the test input with best graph coverage. After running afl-fuzz for 30 minutes, it generated 664 test inputs. Then do I have to check coverage for each of those inputs?

Step-by-step

  1. Compile grep.c for AFL and gcov.
    $ afl-clang-lto grep.c -o grep
    $ gcc -O0 -coverage grep.c -o grep-cov
  2. Fuzz with 3 seeds (4580, 4581, 4582), 30 minutes each.
    $ afl-fuzz -V 1800 -s 4580 -i <input_seeds> -o <output_dir> -- ./grep .... @@
  3. Run grep-cov with all test inputs (hundreds!) in <output_dir> and find the best one.

Is my understanding correct?

3-24 commented 4 months ago

Yes, you need to run each inputs with grep-cov binary, and find the best input that reaches highest coverage.

leejy12 commented 4 months ago

Thank you!