[all-commits] [llvm/llvm-project] 009e3e: [lldb/MCDisasm] Simplify predicates in MCDisasmIns...

Vedant Kumar via All-commits all-commits at lists.llvm.org
Fri Jan 31 16:33:34 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 009e3e53c1fe4848916a3b7de1dff60a2644fa46
      https://github.com/llvm/llvm-project/commit/009e3e53c1fe4848916a3b7de1dff60a2644fa46
  Author: Vedant Kumar <vsk at apple.com>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp

  Log Message:
  -----------
  [lldb/MCDisasm] Simplify predicates in MCDisasmInstance, NFC


  Commit: 14135f50a036af4d3a64b8e2e0dc2ecda5260533
      https://github.com/llvm/llvm-project/commit/14135f50a036af4d3a64b8e2e0dc2ecda5260533
  Author: Vedant Kumar <vsk at apple.com>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    A lldb/packages/Python/lldbsuite/test/functionalities/optimized_code/Makefile
    A lldb/packages/Python/lldbsuite/test/functionalities/optimized_code/TestNoASanExceptionAfterEvalOP_piece.py
    A lldb/packages/Python/lldbsuite/test/functionalities/optimized_code/main.cpp
    M lldb/source/Core/ValueObjectVariable.cpp
    A lldb/test/Shell/SymbolFile/DWARF/DW_OP_piece-smaller-than-struct.s

  Log Message:
  -----------
  [lldb/Value] Avoid reading more data than the host has available

Value::GetValueByteSize() reports the size of a Value as the size of its
underlying CompilerType. However, a host buffer that backs a Value may
be smaller than GetValueByteSize().

This situation arises when the host is only able to partially evaluate a
Value, e.g. because the expression contains DW_OP_piece.

The cleanest fix I've found to this problem is Greg's suggestion, which
is to resize the Value if (after evaluating an expression) it's found to
be too small. I've tried several alternatives which all (in one way or
the other) tried to teach the Value/ValueObjectChild system not to read
past the end of a host buffer, but this was flaky and impractical as it
isn't easy to figure out the host buffer's size (Value::GetScalar() can
point to somewhere /inside/ a host buffer, but you need to walk up the
ValueObject hierarchy to try and find its size).

This fixes an ASan error in lldb seen when debugging a clang binary.
I've added a regression test in test/functionalities/optimized_code. The
point of that test is not specifically to check that DW_OP_piece is
handled a particular way, but rather to check that lldb doesn't crash on
an input that it used to crash on.

Testing: check-lldb, and running the added tests using a sanitized lldb

--

Thanks to Jim for pointing out that an earlier version of this patch,
which simply changed the definition of Value::GetValueByteSize(), would
interact poorly with the ValueObject machinery.

Thanks also to Pavel who suggested a neat way to test this change
(which, incidentally, caught another ASan issue still present in the
original version of this patch).

rdar://58665925

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


  Commit: 14394a42096ad610954aaaf00bdeedd9c267aa06
      https://github.com/llvm/llvm-project/commit/14394a42096ad610954aaaf00bdeedd9c267aa06
  Author: Vedant Kumar <vsk at apple.com>
  Date:   2020-01-31 (Fri, 31 Jan 2020)

  Changed paths:
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

  Log Message:
  -----------
  [lldb/TypeSystemClang] Use references in a static helper, NFC


Compare: https://github.com/llvm/llvm-project/compare/338beff4dc7b...14394a42096a


More information about the All-commits mailing list