[libcxx-commits] [libcxx] [libc++] Fix vector sanitization annotations on destruction (PR #121031)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jan 13 03:42:27 PST 2025
https://github.com/AdvenamTacet approved this pull request.
Thank you for noticing it!
Let's make sure that the commit message mentions removal of `void __clear()`.
Please wait for a green light from @philnik777 before merging.
> breaks the invariant that the value of old_mid should match the value of new_mid from the previous call to __sanitizer_annotate_contiguous_container()
It shouldn't be observed by a user as we actually do not want to enforce that "invariant" (we want to keep it only to easier ensure correctness of the implementation while testing).
Reasoning is that there are situations where users may want to (un)poison containers memory. We worked on making sure that annotation functions work with modified annotations (including over-unpoisoned memory), so it should not result in any error.
I support that change as keeping that "invariant" helps to avoid annotation errors in future, but unless I missed something, it's not necessary change. Users using public vectors API won't notice that.
Unpoisoning memory from [D144155](https://reviews.llvm.org/D144155) is necessary, but poisoning here is not.
> Part of the problem is that the two codepaths being changed call __annotate_delete() immediately after the clear()
I don't think we can test it in a reasonable way as it shouldn't be observable by using public vector functions. But if someone has an idea, I'm happy to learn how to do it (without cluttering vectors implementation or recompiling compiler-rt).
https://github.com/llvm/llvm-project/pull/121031
More information about the libcxx-commits
mailing list