[PATCH] D66461: [CaptureTracker] Comparisons of allocation pointers do not capture

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 09:39:01 PDT 2019


jdoerfert added a comment.

In D66461#1639246 <https://reviews.llvm.org/D66461#1639246>, @hfinkel wrote:

> I'm missing something here. If I have two pointers (e.g., returned from malloc), and I compare them so I know they're equal, then I've learned that the pointers are equal -- and, thus, if I know all of the bits of one pointer I now know all of the bits of the other pointer. As a result, I can still reconstruct it later using that information.


I'll try to explain why I think this is fine:
If you compare the same pointer (or derived from the same), you need to capture at least one from them "explicitly" to learn the bits. You cannot use ICmps between them for that (without leaving the categories specified) so you need an "explicit" capture somehow. The comparison we would allow here might give you the offset of the second pointer, which, assuming you know the bits of the first, tells you the second one. However, I think this is no more information than the captured pointer alone, assuming "capturing" does not only leak the bits of the pointer but the address range of the whole underlying object.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66461





More information about the llvm-commits mailing list