[PATCH] D119495: [sanitizer] Check if directory exists before trying to create

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 10 15:47:34 PST 2022


tejohnson created this revision.
tejohnson added a reviewer: vitalybuka.
tejohnson requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.

Add a DirExists mechanism, modeled after FileExists. Use it to guard
creation of the report path directory.

This should avoid failures running the sanitizer in a sandbox where the
file creation attempt causes hard failures, even for an existing
directory. Problem reported on D109794 <https://reviews.llvm.org/D109794> for ChromeOS in sandbox
(https://issuetracker.google.com/209296420).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119495

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_file.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_file.h
  compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_win.cpp
  compiler-rt/test/asan/TestCases/log-path_test.cpp
  compiler-rt/test/memprof/TestCases/log_path_test.cpp
  compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119495.407710.patch
Type: text/x-patch
Size: 7536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220210/bfd3a861/attachment.bin>


More information about the llvm-commits mailing list