[all-commits] [llvm/llvm-project] 7ad073: [lldb] Change Module to have a concrete UnwindTabl...
Jason Molenda via All-commits
all-commits at lists.llvm.org
Thu Aug 1 17:43:46 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7ad073a45b411d3752668dff61963d356c98145d
https://github.com/llvm/llvm-project/commit/7ad073a45b411d3752668dff61963d356c98145d
Author: Jason Molenda <jmolenda at apple.com>
Date: 2024-08-01 (Thu, 01 Aug 2024)
Changed paths:
M lldb/include/lldb/Core/Module.h
M lldb/include/lldb/Symbol/UnwindTable.h
M lldb/source/Core/Module.cpp
M lldb/source/Symbol/UnwindTable.cpp
Log Message:
-----------
[lldb] Change Module to have a concrete UnwindTable, update (#101130)
Currently a Module has a std::optional<UnwindTable> which is created
when the UnwindTable is requested from outside the Module. The idea is
to delay its creation until the Module has an ObjectFile initialized,
which will have been done by the time we're doing an unwind.
However, Module::GetUnwindTable wasn't doing any locking, so it was
possible for two threads to ask for the UnwindTable for the first time,
one would be created and returned while another thread would create one,
destroy the first in the process of emplacing it. It was an uncommon
crash, but it was possible.
Grabbing the Module's mutex would be one way to address it, but when
loading ELF binaries, we start creating the SymbolTable on one thread
(ObjectFileELF) grabbing the Module's mutex, and then spin up worker
threads to parse the individual DWARF compilation units, which then try
to also get the UnwindTable and deadlock if they try to get the Module's
mutex.
This changes Module to have a concrete UnwindTable as an ivar, and when
it adds an ObjectFile or SymbolFileVendor, it will call the Update
method on it, which will re-evaluate which sections exist in the
ObjectFile/SymbolFile. UnwindTable used to have an Initialize method
which set all the sections, and an Update method which would set some of
them if they weren't set. I unified these with the Initialize method
taking a `force` option to re-initialize the section pointers even if
they had been done already before.
This is addressing a rare crash report we've received, and also a
failure Adrian spotted on the -fsanitize=address CI bot last week, it's
still uncommon with ASAN but it can happen with the standard testsuite.
rdar://128876433
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list