[all-commits] [llvm/llvm-project] 52d0a7: [libunwind] Fix CIE v1 return address parsing

Ryan Prichard via All-commits all-commits at lists.llvm.org
Wed Jul 15 19:14:09 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 52d0a78b831584c46eda78b7cf349ab93ce13df0
      https://github.com/llvm/llvm-project/commit/52d0a78b831584c46eda78b7cf349ab93ce13df0
  Author: Ryan Prichard <rprichard at google.com>
  Date:   2020-07-15 (Wed, 15 Jul 2020)

  Changed paths:
    M libunwind/src/DwarfParser.hpp

  Log Message:
  -----------
  [libunwind] Fix CIE v1 return address parsing

 - For CIE version 1 (e.g. in DWARF 2.0.0), the return_address_register
   field is a ubyte [0..255].

 - For CIE version 3 (e.g. in DWARF 3), the field is instead a ULEB128
   constant.

Previously, libunwind accepted a CIE version of 1 or 3, but always
parsed the field as ULEB128.

Clang always outputs CIE version 1 into .eh_frame. (It can output CIE
version 3 or 4, but only into .debug_frame.)

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


  Commit: fd802cc4dea4ed1a233ff725f98c686dc2836bf3
      https://github.com/llvm/llvm-project/commit/fd802cc4dea4ed1a233ff725f98c686dc2836bf3
  Author: Ryan Prichard <rprichard at google.com>
  Date:   2020-07-15 (Wed, 15 Jul 2020)

  Changed paths:
    M libunwind/src/AddressSpace.hpp

  Log Message:
  -----------
  [libunwind] Fix getSLEB128 on large values

Previously, for large-enough values, getSLEB128 would attempt to shift
a signed int in the range [0..0x7f] by 28, 35, 42... bits, which is
undefined behavior and likely to fail.

Avoid shifting (-1ULL) by 70 for large values. e.g. For INT64_MAX, the
last two bytes will be:
 - 0x7f [bit==56]
 - 0x00 [bit==63]

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


Compare: https://github.com/llvm/llvm-project/compare/537b16e9b8da...fd802cc4dea4


More information about the All-commits mailing list