[llvm-bugs] [Bug 45606] New: Internal error in AddressSanitizer on Windows on "bad" %PATH% format: "double backslashes in args unsupported"
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Apr 19 02:16:41 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45606
Bug ID: 45606
Summary: Internal error in AddressSanitizer on Windows on "bad"
%PATH% format: "double backslashes in args
unsupported"
Product: compiler-rt
Version: 10.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: asan
Assignee: unassignedbugs at nondot.org
Reporter: andre.brand at mailbox.org
CC: llvm-bugs at lists.llvm.org
Created attachment 23389
--> https://bugs.llvm.org/attachment.cgi?id=23389&action=edit
Minimal example to trigger the issue
=Overview=
ASAN crashes on Windows during error reporting:
> AddressSanitizer CHECK failed: C:\src\llvm_package_901-final\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_symbolizer_win.cc:234 "((!internal_strstr(arg, "\\\\") && "double backslashes in args unsupported")) != (0)" (0x0, 0x0)
when you add LLVM to the environment via
> set "PATH=%PATH%;C:\Program Files\LLVM\\bin"
(Note the double backslashes.)
This happens a lot in Windows when you use other environment variables:
> set "PATH=%PATH%;%LLVM_DIR%\bin"
People often add the extra backslash because you don't know if %LLVM_DIR% ends
with a backslash and it usually does no harm.
It took me a while to track that down because you kind of suspect that the
issue lies within the application path or some kind of Short/Long path
weirdness in Windows.
=Steps to Reproduce=
Add LLVM to the %PATH% via (adjust install dir if necessary):
> set "PATH=%PATH%;C:\Program Files\LLVM\\bin"
Then run a minimal example with ASAN:
> clang-cl main.cpp -fsanitize=address && main.exe
I attached a simple example that triggers ASAN (main.cpp) and the compiler
invocations that lead to the crash (compile_bad.bat). I confirmed that it works
without the double backslashes (compile_good.bat).
=Actual Results=
ASAN crashes on Windows during error reporting:
> ==27040==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x11a6dd900278 at pc 0x7ff6c8411077 bp 0x000d84effc00 sp 0x000d84effc48
> WRITE of size 4 at 0x11a6dd900278 thread T0
> ==27040==AddressSanitizer CHECK failed: C:\src\llvm_package_901-final\llvm\projects\compiler-rt\lib\sanitizer_common\sanitizer_symbolizer_win.cc:234 "((!internal_strstr(arg, "\\\\") && "double backslashes in args unsupported")) != (0)" (0x0, 0x0)
=Expected Results=
Of course, it would be nice if it just worked even with the double backslashes.
But since it is trivial to work around that as a user as soon as you know which
path is the problem, it would be a huge win if you extend the error message:
"... where args=C:\Program Files\LLVM\\bin".
So you can find that out without having to compile clang.
=Build Date & Hardware=
Tested with clang-9.0.1 and clang-10.0.0 on Windows 7 and Windows 10 Version
1909. I am quite certain that my hardware doesn't matter.
=Additional Builds and Platforms=
See above.
=Additional Information=
I guess this is easy to reproduce. If not, I'd be happy to provide further
information, callstacks, etc.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200419/ec62bba8/attachment.html>
More information about the llvm-bugs
mailing list