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: unassignedb...@nondot.org
          Reporter: jack.ll...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to