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

John Brawn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 10:22:45 PST 2020


john.brawn created this revision.
john.brawn added reviewers: probinson, eli.friedman, arsenm.
Herald added subscribers: hiraditya, wdng.
Herald added a project: LLVM.

With -fstack-protector-strong we check if a non-array variable has its address taken in a way that could cause a potential out-of-bounds access. However what we don't catch is when the address is directly used to create an out-of-bounds memory access.

Fix this by examining the offsets of GEPs that are ultimately derived from allocas, and checking if the resulting address is out-of-bounds.

Fixes PR43478.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75695

Files:
  llvm/lib/CodeGen/StackProtector.cpp
  llvm/test/CodeGen/Generic/stack-guard-oob.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75695.248522.patch
Type: text/x-patch
Size: 11179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200305/6e16cb47/attachment.bin>


More information about the llvm-commits mailing list