- “官网”http://cipherdyne.com/afl-cov/ https://github.com/mrash/afl-cov
- 编译
需要使用gcc -fprofile-arcs -ftest-coverage test.c (-o cov.out)对源码进行插桩从而支持覆盖率的统计 - C++ lcov reached unexpected end of file问题
A:将编译信息清空make clean all
ref:https://stackoverflow.com/questions/35965415/c-lcov-reached-unexpected-end-of-file - 对afl覆盖统计命令
afl-cov -d /path/to/afl-fuzz-output/ --live --coverage-cmd \ "cat AFL_FILE | LD_LIBRARY_PATH=./lib/.libs ./bin/.libs/somebin -a -b -c" \ --code-dir . 先执行afl-cov,再执行afl,afl-cov将读取afl output/queue中的所有文件,--live将实时读取新生成的文件。 --coverage-cmd里面用带覆盖率插桩的可执行文件“./cov.out AFL_FILE". AFL_FILE为固定写法,代表从queue中读取到的文件。 如果使用stdin读取输入,需要使用cat。
- 对klee覆盖统计命令
afl-cov -d klee-last --live --coverage-cmd "cat AFL_FILE | ./gcccov.out" --code-dir . --klee --overwrite - 覆盖路径、时间
在kleetmp-cov和afltmp-cov文件夹中*.extra的文件对于klee-last/testxxx, afl/output/queue/xxx,可以在python中用pickle处理文件
注意:afl-cov一开始执行就会计时,统计覆盖信息会等klee/afl生成测试用例,后者开始的时间影响覆盖计时。 - Non-zero exit status '1' for CMD: /usr/bin/readelf -a cat Could not find an executable binary with code coverage support ('-fprofile-arcs -ftest-coverage' ) in --coverage-cmd 'cat -A AFL_FILE|./gcccov.out'
A:注意 管道|前后加空格,注意gcccov.out使用gcc -fprofile-arcs -ftest-coverage,afl-gcc不可以
对于stdin做输入:afl-cov -d ./output --live --coverage-cmd "cat -A AFL_FILE | ./gcccov.out" --code-dir .
对于file做输入:afl-cov -d ./output --live --coverage-cmd "./gcccov.out AFL_FILE" --code-dir . - lcov: ERROR: no valid records found in tracefile问题
A:重新gcc -fprofile-arcs -ftest-coverage test.c (-o cov.out)试试,不仅.out需要覆盖插桩对版本,还有包括.gcda .gcdo等文件 - 覆盖结果查看
The code coverage results in /path/to/afl-fuzz-output/cov/web/lcov-web-final represent cumulative code coverage across all AFL test cases.
执行过程中也会窗口打印
afl覆盖率统计工具afl-cov常见问题总结
最新推荐文章于 2024-09-13 22:28:30 发布