简体   繁体   English

地址清理程序无法在Windows上使用bash

[英]address sanitizer won't work with bash on windows

Currently running llvm, clang, clang-format, and clang-modernize on Ubuntu Bash on Windows. 当前在Windows的Ubuntu Bash上运行llvm,clang,clang-format和clang-modernize。 I would like to use the set of sanitize tools released by google including address, memory, and thread sanitize. 我想使用Google发布的一组清理工具,包括地址,内存和线程清理。 None of the fsanitize options seem to work. fsanitize选项似乎都不起作用。

Here is the code sample for ASAN: 这是ASAN的代码示例:

#include <stdlib.h>
int main() {
  char *x = (char *)malloc(10 * sizeof(char *));
  free(x);
  return x[5];// purposely accessing deallocated memory
}

Here is the clang call in bash on windows: 这是Windows上bash中的clang调用:

$clang++-3.5 -fsanitize=address -o1 -fno-omit-frame-pointer -g main.cpp -o main
$./main

Results 结果

==70==Sanitizer CHECK failed: build/buildd/llvm-toolchain-snapshot-3.5/projects/compiler-rt/lib/sanitizer_common/sanitizer_procmaps_linux.cc:211 ((IsOneOf(*current_, 's', 'p'))) != (0)(0,0)

I'd love suggestions on how to get it working or if I'm missing part of the tool-chain or something. 我很乐意提供有关如何使其工作或缺少工具链之类的建议。

Failing that I suppose I will dual-boot Ubuntu or Debian, because clang for windows is missing simple features like std:out support, though ideally I'd like to be able to compile both for Windows targets and Linux targets. 失败了,我想我将双重引导Ubuntu或Debian,因为Windows的clang缺少诸如std:out支持的简单功能,尽管理想情况下,我希望能够针对Windows目标和Linux目标进行编译。 I'd like to avoid dual-booting though as Ubuntu can't mount windows storage spaces, but they appear to be served to Ubuntu bash on windows quite well. 我想避免双重引导,因为Ubuntu无法安装Windows存储空间,但是它们似乎可以很好地在Windows上的Ubuntu bash中使用。

Taking a quick peek at the source code - MemoryMappingLayout::Next - https://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_linux.cc - it appears the issue is that bash on ubuntu on windows support for the /proc filesystem is incomplete. 快速查看一下源代码-MemoryMappingLayout :: Next- https ://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_procmaps_linux.cc-看来问题是bash出现Windows上的ubuntu对/ proc文件系统的支持不完整。

The code that fails is looking at /proc/self/maps - which actually - appears to be about right. 失败的代码正在查看/ proc / self / maps-实际上,这似乎是正确的。

But I've found other stuff (eg networking ) in /proc completely broken on bashonwindowsonunix - so I'm pretty sure that part is a work in progress. 但是我发现/ proc中的其他内容(例如网络)在bashonwindowsonunix上完全损坏了-因此,我很确定那一部分还在进行中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM