[libcxx-commits] [PATCH] D136765: [ASan][libcxx] Annotating std::vector with all allocators

Hans Wennborg via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 27 13:39:19 PST 2023


hans added a comment.

> I think it's pretty clear that what you are doing is UB, so IMO we want to catch this generally. I don't think there is an easy way to unpoison the memory other than running the destructors. We could add an escape hatch through the allocator traits, but that would of course mean that you don't get the additional coverage for that allocator.

I'm not sure it is UB actually. (At least not the part that recycles the vector storage memory.) In any case it's not an unreasonable pattern; for example Clang does the same for its AST with ASTContext::Allocator -- the AST nodes' destructors never run, and one could imagine a scenario where the memory is re-used.

> @hans If Chromium knowingly drops destructors, can you just upoison the entire range there, by arena allocator?

Yes, I think that would work for us. (You mean just with `__asan_unpoison_memory_region` right?)
I'll give it a try tomorrow.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136765/new/

https://reviews.llvm.org/D136765



More information about the libcxx-commits mailing list