Why does Xcode define _LIBCPP_HAS_NO_ASAN when creating an address-protected assembly?

Xcode 7 allows you to use a sanitizer to search for memory problems in C / C ++.

https://github.com/google/sanitizers/wiki/AddressSanitizer

The inclusion of an address sanitizer passes the compilation and linker flag -fsanitize=address, and also determines _LIBCPP_HAS_NO_ASAN.

When I create my library from the command line and run tests in a sanitized assembly without definition, _LIBCPP_HAS_NO_ASANI see non-recurring memory access problems associated with addressing-disinfection. Determining _LIBCPP_HAS_NO_ASANhow Xcode does this gets rid of disinfectant problems, but I'm curious why this is needed.

Why do I need to detect _LIBCPP_HAS_NO_ASANusing AppleClang7 to avoid memory access issues in libcxx?

+4
source share
1 answer

From a discussion with Sean McBride (who is not in StackOverflow), there are known issues with false memory errors outside boundaries when mixing instrumental and non-instrumental code:

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

"As a rule, you don’t need to rebuild any code that is associated with a sanitized code."

" ++ , . , lib++ ( ASan) , Address Sanitizer false (, , std::vector, . Push_back . , .)"

, - , . , .

+2

Source: https://habr.com/ru/post/1649923/


All Articles