[Lldb-commits] [PATCH] D47551: [IRMemoryMap] Fix the alignment adjustment in Malloc

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 30 12:41:45 PDT 2018


vsk created this revision.
vsk added reviewers: labath, zturner, jingham, aprantl.
vsk edited the summary of this revision.

This prevents Malloc from allocating the same chunk of memory twice, as
a byproduct of an alignment adjustment which gave the client access to
unallocated memory.

Prior to this patch, the newly-added test failed with:

  $ lldb-test ir-memory-map ... ir-memory-map-overlap1.test
  Command: malloc(size=8, alignment=16)
  Malloc: address = 0x1000cd000
  Command: malloc(size=16, alignment=8)
  Malloc: address = 0x1000cd010
  Command: malloc(size=64, alignment=32)
  Malloc: address = 0x1000cd020
  Command: malloc(size=1, alignment=8)
  Malloc: address = 0x1000cd060
  Command: malloc(size=64, alignment=32)
  Malloc: address = 0x1000cd080
  Command: malloc(size=64, alignment=8)
  Malloc: address = 0x1000cd0b0
  Malloc error: overlapping allocation detected, previous allocation at [0x1000cd080, 0x1000cd0c0)

I don't see anything controversial here (in fact Jim lgtm'd part of this patch off-list), but as this is unfamiliar territory for me I think it'd help to have a proper review. Depends on https://reviews.llvm.org/D47508.


https://reviews.llvm.org/D47551

Files:
  lit/Expr/Inputs/ir-memory-map-basic.test
  lit/Expr/Inputs/ir-memory-map-overlap1.test
  lit/Expr/TestIRMemoryMap.test
  source/Expression/IRMemoryMap.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47551.149180.patch
Type: text/x-patch
Size: 2785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180530/8f0146b7/attachment.bin>


More information about the lldb-commits mailing list