[libcxx-commits] [libcxx] [ASan][libc++] std::basic_string annotations (PR #72677)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 5 09:14:58 PST 2023


AdvenamTacet wrote:

> And if a user uses a dylib that is built with instrumentation and doesn't pass -fsanitize=address, I'm not sure what would happen but we should make it work.

I don't think we can make it work, linking is going to fail in that case. It already cannot work, string annotations have no impact on it.

> 2. disable the extern template instantiation declarations under asan
> [...]
> (2) is still not correct because of ODR violations, but it should make most basic use cases work. It would still be a temporary solution.

While I agree, it's far from perfect, we already assume that ASan has no stable ABI and when compiling with ASan we should use the same version of libc++ and LLVM.
Therefore, temporarily (2) plus opt-out makro for less basic cases with non-instrumented dylib seem good for me.
A significant advantage of this solution is that all users will now have annotated strings.

But (3) sounds ok as well, if we just have a makro in `__config_site`, it's future-proof and easy to implement in libc++. 
Biggest downside is fact that users don't compile libc++ with ASan already, they have to be aware of that change to benefit from it, until we figure out how we can automatically choose a dylib based on `-fsanitize=address` flag.

@ldionne should we go with(3)?

https://github.com/llvm/llvm-project/pull/72677


More information about the libcxx-commits mailing list