[all-commits] [llvm/llvm-project] 46282f: [Sanitizer] Use CreateDirectoryA for report dirs

Choongwoo Han via All-commits all-commits at lists.llvm.org
Fri Dec 3 12:34:36 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 46282fad060f623019686919832741eea4ff8bfc
  Author: Choongwoo Han <choongwoo.han at microsoft.com>
  Date:   2021-12-03 (Fri, 03 Dec 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_win.cpp

  Log Message:
  [Sanitizer] Use CreateDirectoryA for report dirs

Using `_mkdir` of CRT in Asan Init leads to launch failure and hanging in Windows.

You can trigger it by calling:
> set ASAN_OPTIONS=log_path=a/a/a
> .\asan_program.exe

And their crash dump shows the following stack trace:
_mkdir(const char * path)

I guess there could be a cfg guard in CRT, which may lead to calling uninitialized cfg guard function address. Also, `_mkdir` supports UTF-8 encoding of the path and calls _wmkdir, but that's not necessary for this case since other file apis in sanitizer_win.cpp assumes only ANSI code case, so it makes sense to use CreateDirectoryA matching other file api calls in the same file.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D114760

More information about the All-commits mailing list