[PATCH] D80299: [DebugInfo] - Fix multiple issues in DWARFDebugFrame::parse().

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 21 18:57:36 PDT 2020


MaskRay added a comment.

> Fix multiple issues in DWARFDebugFrame::parse().

Better to call out the exact problems: truncated contents issues.



================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp:381
+    // If the Length is 0, then this CIE is a terminator. We add it because some
+    // tools, like llvm-objdump might need it do print something special for
+    // such entries.
----------------
aprantl wrote:
> do -> to
> 
> what is "something special"?
Do you mean `readelf -wf`/`objdump -Wf` output `ZERO terminator`?

This code here is correct. According to D46566: glibc unwind-dw2-fde.c classify_object_over_fdes has (I just checked, it still has) an oob problem if there is no ZERO terminator.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp:388
+      CIEs[StartOffset] = Cie.get();
+      Entries.emplace_back(std::move(Cie));
+      break;
----------------
Minor nit: `push_back` (does not require a special constructor)


================
Comment at: llvm/test/DebugInfo/X86/eh-frame-truncated.s:4
+
+# RUN: llvm-mc -triple x86_64-unknown-linux %s -filetype=obj -o %t
+# RUN: not llvm-dwarfdump -debug-frame %t 2>&1 | FileCheck %s
----------------
`-unknown-linux` can be dropped (generic ELF behavior)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80299/new/

https://reviews.llvm.org/D80299





More information about the llvm-commits mailing list