This is an archive of the discontinued LLVM Phabricator instance.

Add interceptors for the fts(3) API family from NetBSD
ClosedPublic

Authored by krytarowski on Nov 7 2018, 5:31 PM.

Details

Summary

fts(3) is API to traverse a file hierarchy.
Cover this interface with interceptors.

Add a test to validate the interface reading
the number of regular files in /etc.

Based on original work by Yang Zheng.

Diff Detail

Repository
rL LLVM

Event Timeline

krytarowski created this revision.Nov 7 2018, 5:31 PM
vitalybuka added inline comments.Nov 7 2018, 8:26 PM
lib/sanitizer_common/sanitizer_common_interceptors.inc
7277

please move to the first assignment

7286

we should check access before referencing
so

for (char *const *pa = path_argv;;++pa) {
     COMMON_INTERCEPTOR_READ_RANGE(ctx, pa, sizeof(char **));
     if (!*pa)
         break;
     COMMON_INTERCEPTOR_READ_RANGE(ctx, *pa, REAL(strlen)(*pa) + 1);
   }
7300

declare ftsent here
and the same for the next

test/sanitizer_common/TestCases/NetBSD/fts.cc
28

NULL or != NULL is not needed

krytarowski edited the summary of this revision. (Show Details)Nov 15 2018, 7:15 PM
krytarowski added a subscriber: tomsun.0.7.
vitalybuka requested changes to this revision.Nov 19 2018, 1:25 PM
This revision now requires changes to proceed.Nov 19 2018, 1:25 PM
  • apply comments from review
  • general enhancements
krytarowski marked 4 inline comments as done.Dec 3 2018, 4:23 PM
This revision is now accepted and ready to land.Dec 3 2018, 4:29 PM
This revision was automatically updated to reflect the committed changes.