[PATCH] D58513: [libFuzzer][Windows] Port fork mode to Windows

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 11:20:03 PST 2019


zturner added inline comments.


================
Comment at: compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp:213
+      IterateDirRecursive(Path, DirPreCallback, DirPostCallback, FileCallback);
+    } else if (IsFile(PathAttrs) || IsLink(PathAttrs)) {
+      FileCallback(Path);
----------------
zturner wrote:
> zturner wrote:
> > This doesn't look correct to me.  You can have a reparse point to something that itself isn't a file.  If it's a link, I think you need to check the reparse tag in `FindInfo.dwReserved0` as described [[ https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-_win32_find_dataa | here ]]
> > 
> Another, perhaps less dirty way of handling the `IsLink()` case is to call `CreateFile()` on it with `FILE_FLAG_BACKUP_SEMANTICS`, which will cause it to follow symlinks, then call `GetFileInformationByHandle`.  That's actually probably the safest way, because I think you can have a reparse point which reparses to another reparse point, and rather than deal with all that stuff, it seems better to just let Windows follow the link for you, and then ask it what it opened.
Clarity edit: `FILE_FLAG_BACKUP_SEMANTICS` will jsut cause it to not fail if it's a directory.  It follows symlinks by default (unless you specify `FILE_FLAG_OPEN_REPARSE_POINT`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58513/new/

https://reviews.llvm.org/D58513





More information about the llvm-commits mailing list