[compiler-rt] [TySan] Fix false positives with derived classes (PR #126260)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 22 09:01:26 PDT 2025
gbMattN wrote:
> It would be great if you could spell out the differences, and ideally also make this clear in the code comments.
I've added a comment into the code to explain the rational. I will also explain it here.
When you walk up the alias tree, the TDs go from structs to members. If you are accessing a TD in shadow with an offset, you have either an access violation, or are accessing a large struct TD. If you walk up the alias tree of the type you are accessing with, you won't find that struct, since you are accessing it with a TD for a member variable _inside_ said struct.
Therefore we should instead walk up the alias tree of this large struct to find the type we are accessing, and then check to see if the offset of that type in the struct is equal to the offset of our read in shadow memory. Since this method of checking is the opposite to the default way of checking, I've split it out into a separate function.
https://github.com/llvm/llvm-project/pull/126260
More information about the llvm-commits
mailing list