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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 5 08:08:21 PST 2023


https://github.com/ldionne requested changes to this pull request.

As-is, landing this patch will break most users who use `-fsanitize=address` and use libc++ in their code. Indeed, vendors ship a single version of `libc++.dylib` right now and that version is not instrumented, which means that the extern template instantiations in `libc++.dylib` will cause problems.

I'm worried that this will be a significant regression. Ideally, we'd address the issue by having a proper plan for shipping an instrumented library and having the driver select it based on `-fsanitize=address`. But barring that, we'll need to either
1. make the `string` annotations opt-in, or
2. disable the extern template instantiation declarations under asan
3. only enable these annotations when the dylib was built with support for ASAN

(1) basically negates the benefit of this patch since almost nobody will turn it on
(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.

I think (3) is probably what makes the most sense, since that wouldn't be a temporary solution. It would only mean that most platforms don't get this support by default because the dylib isn't built with instrumentation, but the minute we ship a library that does support that, everything would still work out of the box.

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


More information about the libcxx-commits mailing list