[PATCH] D75695: [StackProtector] Catch direct out-of-bounds when checking address-takenness

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 09:37:10 PDT 2020


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/StackProtector.cpp:197-198
+      // object.
+      Type *ToType = I->getType()->getPointerElementType();
+      Type *FromType = I->getOperand(0)->getType()->getPointerElementType();
+      if (DL.getTypeAllocSize(ToType) > DL.getTypeAllocSize(FromType))
----------------
john.brawn wrote:
> arsenm wrote:
> > This is introducing new dependences on the deprecated pointee type. No decisions should be made based on this
> I don't see anything in Type.h about getPointerElementType being deprecated, but looking at Instructions.h I see mention of "opaque pointer types", is this what you're talking about? Looking at http://lists.llvm.org/pipermail/llvm-dev/2019-December/137684.html (which is the best I could find for what it means) it looks like instead of
> 
> ```
> %var = alloca i32, align 4
> %bitcast = i32* %var to %i64
> store i64 0, i32* %bitcast
> ```
> we'll have
> ```
> %var = alloca i32, align 4
> store i64 0, p0 %var
> ```
> So it looks like I should be checking the type at the load/store instead?
Yes, pointer types should be assumed to be opaque now. Only the type on the use instruction is meaningful 


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

https://reviews.llvm.org/D75695





More information about the llvm-commits mailing list