[PATCH] D131001: [BoundsChecking] Fix merging of sizes

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 10:55:21 PDT 2022


aeubanks created this revision.
Herald added subscribers: Enna1, hiraditya.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

BoundsChecking uses ObjectSizeOffsetEvaluator to keep track of the
underlying size/offset of pointers in allocations.  However,
ObjectSizeOffsetVisitor (something ObjectSizeOffsetEvaluator
uses to check for constant sizes/offsets)
doesn't quite treat sizes and offsets the same way as
BoundsChecking.  BoundsChecking wants to know the size of the
underlying allocation and the current pointer's offset within
it, but ObjectSizeOffsetVisitor only cares about the size
from the pointer to the end of the underlying allocation.

This only comes up when merging two size/offset pairs. Add a new mode to
ObjectSizeOffsetVisitor which cares about the underlying size/offset
rather than the size from the current pointer to the end of the
allocation.

Fixes a false positive with -fsanitize=bounds.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131001

Files:
  llvm/include/llvm/Analysis/MemoryBuiltins.h
  llvm/lib/Analysis/MemoryBuiltins.cpp
  llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp
  llvm/test/Instrumentation/BoundsChecking/simple.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131001.449347.patch
Type: text/x-patch
Size: 4979 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220802/ef7908af/attachment.bin>


More information about the llvm-commits mailing list