[all-commits] [llvm/llvm-project] 203296: [BoundsChecking] Fix merging of sizes

aeubanks via All-commits all-commits at lists.llvm.org
Wed Aug 3 17:21:43 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 203296d642c385da07a62098050b08493ed8b236
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2022-08-03 (Wed, 03 Aug 2022)

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

  Log Message:
  [BoundsChecking] Fix merging of sizes

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

Fixes a false positive with -fsanitize=bounds.

Reviewed By: vitalybuka, asbirlea

Differential Revision: https://reviews.llvm.org/D131001

More information about the All-commits mailing list