mrash / afl-cov

Produce code coverage results with gcov from afl-fuzz test cases

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lcov: ERROR: no valid records found in tracefile

numairmansur opened this issue · comments

I followed the instructions given in the workflow section. Running afl-cov gives me following error:

$ afl-cov -d /home/numair/Documents/faultlocalization/evaluation/RealWorld/AFL-FUZZING/findings --live --coverage-cmd "cat AFL_FILE | LD_LIBRARY_PATH=./lib/.libs ./bin/.libs/somebin -a -b -c" --code-dir .
[-] Sleep for 60 seconds for AFL fuzzing directory to be created...
    
*** Imported 2 new test cases from: /home/numair/Documents/faultlocalization/evaluation/RealWorld/AFL-FUZZING/findings/queue

    [+] AFL test case: id:000000,orig:test1.txt (0 / 2), cycle: 0
lcov: ERROR: no valid records found in tracefile /home/numair/Documents/faultlocalization/evaluation/RealWorld/AFL-FUZZING/findings/cov/lcov/id:000000,orig:test1.txt.lcov_info
Traceback (most recent call last):
  File "/usr/bin/afl-cov", line 724, in <module>
    sys.exit(main())
  File "/usr/bin/afl-cov", line 72, in main
    return not process_afl_test_cases(gpaths, cargs)
  File "/usr/bin/afl-cov", line 140, in process_afl_test_cases
    gen_coverage(gpaths, cov_paths, f, cargs)
  File "/usr/bin/afl-cov", line 447, in gen_coverage
    + cov_paths['lcov_info_final'], cargs, WANT_OUTPUT)
  File "/usr/bin/afl-cov", line 536, in run_cmd
    out = subprocess.check_output(cmd.split())
  File "/usr/lib/python2.7/dist-packages/subprocess32.py", line 635, in check_output
    raise CalledProcessError(retcode, process.args, output=output)
subprocess32.CalledProcessError: Command '['lcov', '--rc', 'lcov_branch_coverage=1', '--no-checksum', '-r', '/home/numair/Documents/faultlocalization/evaluation/RealWorld/AFL-FUZZING/findings/cov/lcov/id:000000,orig:test1.txt.lcov_info', '/usr/include/*', '--output-file', '/home/numair/Documents/faultlocalization/evaluation/RealWorld/AFL-FUZZING/findings/cov/lcov/id:000000,orig:test1.txt.lcov_info_final']' returned non-zero exit status 255

What am I doing wrong ?

I’ve just released 0.6.2 - any chance you could try to reproduce this with that version? Thanks.

I can confirm that this problem still exists with 0.6.2, albeit in a slightly different way.
Unlike the older versions, the lcov errors are also spit out with afl-cov so one doesn't need to run the culprit lcov command to see what the problem was.

Anyway, the problem seems to be still the same - for some reason trace.lcov_info is always empty while trace.lcov_base has at least some of the coverage information. As a result of lcov not being able to read trace.lcov_info it also cannot generate trace.lcov_info_final which is what afl-cov is trying to read.

I can't understand or solve why lcov_info is not being populated with any of the afl-cov versions :( Any hints would be really appreciated.

Thanks @mrash !

Hi guys, you need to change arguments in this part "cat AFL_FILE | LD_LIBRARY_PATH=./lib/.libs ./bin/.libs/somebin -a -b -c". This refers to the binary with coverage, which you want to test.

Hi guys, you need to change arguments in this part "cat AFL_FILE | LD_LIBRARY_PATH=./lib/.libs ./bin/.libs/somebin -a -b -c". This refers to the binary with coverage, which you want to test.

how exactly, I do not understand what this argument is ( even after reading the readme)

cat AFL_FILE should not be changed,
LD_LIBRARY_PATH=xxx is the library path (you may don't need it),
./bin/xxx/your_binary -a -b -c is the arguments that you use on AFL after the --.

I am having the same problem. My program is successfully being fuzzed, afl-cov is running and I'm getting this message amongst the errors:

lcov: ERROR: no valid records found in tracefile ../fuzzgoat/out/cov/lcov/trace.lcov_info

It appears that the trace.lcov_info file is not getting populated correctly (the trace.lcov_base file is though, so somethings working).

Ideas?

@jdwoolc How is the result with the hints I gave earlier in this thread? Make sure you pass the binary with coverage support only (you don't need the one instrumented with AFL). Should you also check the binary itself runs normally. Hope this help!

@zhangysh1995 Thanks. It works.

I still seem to be getting the errors below. Any guidance would be appreciated.
lcov: ERROR: no valid records found in tracefile /tmp/fuzzgoat/out//cov/lcov/trace.lcov_base
Non-zero exit status '255' for CMD: /usr/bin/lcov --no-checksum -r /tmp/tmp0a25Nx /usr/include/* --output-file /tmp/fuzzgoat/out//cov/lcov/trace.lcov_info_final

gcc version: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
lcov: LCOV version 1.13
afl-cov version: afl-cov-0.6.2
Using afl-gcc from afl++ github repo to compile to run with afl-fuzz

cmd to run afl-cov: ./afl-cov -d /tmp/fuzzgoat/out/ --live --coverage-cmd "./dir/fuzzgoat_inst -f AFL_FILE @@" --code-dir ./dir
cmd to run fuzzer: afl-fuzz -i in -o out ./out/fuzzgoat_inst @@

Hi,
I installed the version 1.15 and I still have this issue:
lcov: ERROR: no valid records found in tracefile /home/xxxx/workspace/smp-tfs/.build-ws/lcov/data/init/smp-tfs-lib.info.raw
Any help ?

This is happening for flutter as well with flutter test --coverage && lcov --ignore-errors empty -r coverage/lcov.info -o coverage/lcov_cleaned.info Any help?