afl覆盖率统计工具afl-cov常见问题总结

  1. “官网”http://cipherdyne.com/afl-cov/    https://github.com/mrash/afl-cov
  2. 编译
    需要使用gcc -fprofile-arcs -ftest-coverage test.c (-o cov.out)对源码进行插桩从而支持覆盖率的统计
  3. C++ lcov reached unexpected end of file问题
    A:将编译信息清空make clean all
    ref:https://stackoverflow.com/questions/35965415/c-lcov-reached-unexpected-end-of-file
  4. 对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。
    
  5. 对klee覆盖统计命令
    afl-cov -d klee-last --live --coverage-cmd "cat AFL_FILE | ./gcccov.out" --code-dir . --klee --overwrite
  6. 覆盖路径、时间
    在kleetmp-cov和afltmp-cov文件夹中*.extra的文件对于klee-last/testxxx, afl/output/queue/xxx,可以在python中用pickle处理文件
    注意:afl-cov一开始执行就会计时,统计覆盖信息会等klee/afl生成测试用例,后者开始的时间影响覆盖计时。
  7. 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 .
  8.  lcov: ERROR: no valid records found in tracefile问题
    A:重新gcc -fprofile-arcs -ftest-coverage test.c (-o cov.out)试试,不仅.out需要覆盖插桩对版本,还有包括.gcda .gcdo等文件
  9. 覆盖结果查看
    The code coverage results in /path/to/afl-fuzz-output/cov/web/lcov-web-final represent cumulative code coverage across all AFL test cases. 
    执行过程中也会窗口打印
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值