[llvm-bugs] [Bug 25991] New: libFuzzer fails to load corpus if filesystem does not provide d_type

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 1 14:50:22 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=25991

            Bug ID: 25991
           Summary: libFuzzer fails to load corpus if filesystem does not
                    provide d_type
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jack.lloyd at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

With latest (trunk) libFuzzer I ran into a problem fuzzing processes on my
desktop machine. Running the fuzzer against a corpus directory, it would
repeatedly show no units loaded even though it was saving finds to the same
directory. 

It turned out to be due to this loop in FuzzerIO.cpp

  while (auto E = readdir(D)) {
    if (E->d_type == DT_REG || E->d_type == DT_LNK)
      V.push_back(E->d_name);
  }

The Linux man page says d_type is not set for some filesystems, this apparently
includes XFS when running over dm-crypt. This caused this loop to appear to
load the corpus but actually silently skip all the files provided.

I fixed it locally by adding to this loop (from memory here):

else if(E->d_type == DT_UNKNOWN && strcmp(E->d_name, ".") != 0 &&
strcmp(E->d_name, "..") != 0)
  V.push_back(E->d_name);

at which point I could stop and restart my fuzzers and everything seemed to
work.

Let me know if there is any additional information I can provide, and thanks
for a great piece of software.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160101/566c39f1/attachment.html>


More information about the llvm-bugs mailing list