Why does Xcode define _LIBCPP_HAS_NO_ASAN when creating an address-sanitized build?

为君一笑 提交于 2019-12-05 18:05:14

From discussion with Sean McBride (who is not on StackOverflow) there are known issues with spurious memory-out-of-bounds errors when mixing instrumented and non-instrumented code:

From Anna Zaks on http://lists.apple.com/archives/xcode-users/2016/Jan/msg00077.html:

"Generally, one does not need to rebuild any code that is being linked into sanitized code."

"However, there is one corner case in C++ container overflow checking, where this might not always hold. Specifically, if libc++ containers cross from instrumented (rebuilt with ASan) to non-instrumented code, Address Sanitizer might report container overflow false positives. (Imagine two libraries, both using the same std::vector, only one of them is instrumented. Push_back from the non-instrumented module will not mark the memory for the newly added element as valid. Accessing the element from the instrumented code, would trigger a false positive report.)"

I hope this question helps someone else as this problem has consumed a considerable amount of my time. Asan is great but this info was hard to find.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!