[llvm] f9fce49 - [ORC] Fix potential stack corruption in Platform::lookupInitSymbols.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 22 16:51:57 PDT 2025
Author: Lang Hames
Date: 2025-06-23T09:51:50+10:00
New Revision: f9fce4975bbad835deba6e639c21a62154dd8c14
URL: https://github.com/llvm/llvm-project/commit/f9fce4975bbad835deba6e639c21a62154dd8c14
DIFF: https://github.com/llvm/llvm-project/commit/f9fce4975bbad835deba6e639c21a62154dd8c14.diff
LOG: [ORC] Fix potential stack corruption in Platform::lookupInitSymbols.
We can't exit early when on error here as some threads may still be holding
references to LookupMutex.
Since we don't need high performance in the error case the easy solution is to
drop the early-exit in the error case and wait for all tasks to complete before
returning the error.
Thanks to Jameson Nash for spotting this bug!
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/Core.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp
index 88bdba0ccc642..f47b7ecdcc7bb 100644
--- a/llvm/lib/ExecutionEngine/Orc/Core.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp
@@ -1530,7 +1530,7 @@ Expected<DenseMap<JITDylib *, SymbolMap>> Platform::lookupInitSymbols(
}
std::unique_lock<std::mutex> Lock(LookupMutex);
- CV.wait(Lock, [&] { return Count == 0 || CompoundErr; });
+ CV.wait(Lock, [&] { return Count == 0; });
if (CompoundErr)
return std::move(CompoundErr);
More information about the llvm-commits
mailing list