aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorDavid Peixotto <peix@meta.com>2025-09-18 08:20:09 -0700
committerGitHub <noreply@github.com>2025-09-18 08:20:09 -0700
commit44a1f7e7cabebff853ccfbbb669f79673a2ec335 (patch)
tree53dca7e6fc24ced5995336a6eb170ce329a8d3af /flang/lib/Frontend/CompilerInvocation.cpp
parent6e47bff24d83ea4db74cf548146baf6170aeb9f0 (diff)
downloadllvm-44a1f7e7cabebff853ccfbbb669f79673a2ec335.zip
llvm-44a1f7e7cabebff853ccfbbb669f79673a2ec335.tar.gz
llvm-44a1f7e7cabebff853ccfbbb669f79673a2ec335.tar.bz2
[lldb] Fix unsafe map mutation in ProcessElfCore::FindModuleUUID (#159444)
The `ProcessElfCore::FindModuleUUID` function can be called by multiple threads at the same time when `target.parallel-module-load` is true. We were using the `operator[]` to lookup the UUID which will mutate the map when the key is not present. This is unsafe in a multi-threaded contex so we now use a read-only `find` operation and explicitly return an invalid UUID when the key is not present. The `m_uuids` map can follow a create-then-query pattern. It is populated in the `DoLoadCore` function which looks like it is only called in a single-threaded context so we do not need extra locking as long as we keep the other accesses read-only. Other fixes I considered * Use a lock to protect access - We don't need to modify the map after creation so we can allow concurrent read-only access. * Store the map in a const pointer container to prevent accidental mutation in other places. - Only accessed in one place currently so just added a comment. * Store the UUID in the NT_FILE_Entry after building the mapping correctly in `UpdateBuildIdForNTFileEntries`. - The map lets us avoid a linear search in `FindModuleUUID`. This commit also reverts the temporary workaround from #159395 which disabled parallel module loading to avoid the test failure. Fixes #159377
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions