llvm-project/lldb
Jordan Rupprecht 1f3def30ca Fix heap-use-after-free when clearing DIEs in fission compile units.
D131437 caused heap-use-after-free failures when testing TestCreateAfterAttach.py in asan mode, and "regular" crashes outside of asan.

This appears to be due to a mismatch in a couple places where we choose to clear the DIEs. When we clear the DIE of a skeleton unit, we unconditionally clear the DIE of the DWO unit if it exists. However, `~ScopedExtractDIEs()` only looks at the skeleton unit when deciding to clear. If we decide to clear the skeleton unit because it is now unused, we end up clearing the DWO unit that _is_ used. This change adds a guard by checking `m_cancel_scopes` to prevent clearing the DWO unit.

This is 100% reproducible by running TestCreateAfterAttach.py in asan mode, although it only seems to reproduce in our internal build, so no test case is added here. If someone has suggestions on how to write one, I can add it.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D133790
2022-09-14 06:52:47 -07:00
..
bindings [Formatters][NFCI] Replace 'is_regex' arguments with an enum. 2022-09-13 12:50:55 -07:00
cmake Revert "[CMake] Avoid `LLVM_BINARY_DIR` when other more specific variable are better-suited" 2022-08-25 11:13:46 -04:00
docs [lldb] Fixed a number of typos 2022-09-13 10:38:38 -07:00
examples [lldb] Fixed a number of typos 2022-09-13 10:38:38 -07:00
include/lldb Add mach-o corefile support for platform binaries 2022-09-13 15:46:18 -07:00
packages/Python/lldbsuite Revert "Be more careful to maintain quoting information when parsing commands." 2022-09-13 14:59:21 -07:00
resources
scripts
source Fix heap-use-after-free when clearing DIEs in fission compile units. 2022-09-14 06:52:47 -07:00
test [lldb] Enable (un-xfail) some dwarf tests for arm 2022-09-14 11:35:16 +02:00
third_party/Python/module [lldb] Remove uses of six module (NFC) 2022-08-11 19:06:15 -07:00
tools [lldb][fuzz] Allow expression fuzzer to be passed as a flag. 2022-09-13 15:39:15 -07:00
unittests Fix DW_OP_convert to resolve the CU relative offset correctly. 2022-09-12 16:53:19 -07:00
utils Fix a bug in lldb-dotest that was uncovered by setting no value for dotest_args_str. 2022-08-31 18:00:18 -07:00
.clang-format
.clang-tidy [LLDB] Applying clang-tidy modernize-use-override over LLDB 2022-04-22 13:29:47 -07:00
.gitignore
CMakeLists.txt lldb: Disable unittests if llvm_gtest target does not exist 2022-08-10 16:56:08 -07:00
CODE_OWNERS.txt [CODE OWNERS] Add wallace as code owner 2022-01-12 12:36:30 -08:00
LICENSE.TXT
use_lldb_suite_root.py