[PATCH] D55796: hwasan: Allow range of frame descriptors to be empty.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 17 16:46:04 PST 2018


pcc created this revision.
pcc added a reviewer: eugenis.
Herald added a subscriber: kubamracek.

As of r349413 it's now possible for a binary to contain an empty
hwasan frame section. Handle that case simply by doing nothing.


Repository:
  rL LLVM

https://reviews.llvm.org/D55796

Files:
  compiler-rt/lib/hwasan/hwasan.cc


Index: compiler-rt/lib/hwasan/hwasan.cc
===================================================================
--- compiler-rt/lib/hwasan/hwasan.cc
+++ compiler-rt/lib/hwasan/hwasan.cc
@@ -229,8 +229,8 @@
 void InitFrameDescriptors(uptr b, uptr e) {
   FrameDescription *beg = reinterpret_cast<FrameDescription *>(b);
   FrameDescription *end = reinterpret_cast<FrameDescription *>(e);
-  // Must have at least one entry, which we can use for a linked list.
-  CHECK_GE(end - beg, 1U);
+  if (beg == end)
+    return;
   AllFrames.push_back({beg, end});
   if (Verbosity())
     for (FrameDescription *frame_descr = beg; frame_descr < end; frame_descr++)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55796.178560.patch
Type: text/x-patch
Size: 652 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181218/9b42b235/attachment.bin>


More information about the llvm-commits mailing list