Skip to content

Commit f9fce49

Browse files
committed
[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!
1 parent 9844085 commit f9fce49

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/ExecutionEngine/Orc/Core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ Expected<DenseMap<JITDylib *, SymbolMap>> Platform::lookupInitSymbols(
15301530
}
15311531

15321532
std::unique_lock<std::mutex> Lock(LookupMutex);
1533-
CV.wait(Lock, [&] { return Count == 0 || CompoundErr; });
1533+
CV.wait(Lock, [&] { return Count == 0; });
15341534

15351535
if (CompoundErr)
15361536
return std::move(CompoundErr);

0 commit comments

Comments
 (0)