[llvm-branch-commits] [llvm] [BOLT] Fix thread-safety of PointerAuthCFIAnalyzer (PR #165365)
Gergely Bálint via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Oct 28 03:39:07 PDT 2025
bgergely0 wrote:
There were two options to implement this fix:
1. the one implemented in this PR: guarding the setIgnored calls with a Mutex.
2. add the functions to ignore to a vector (guarded by a mutex), and do all setIgnored calls on a single thread after the parallel part is done.
To make sure option 1 is correct, we have to look for what members of BC are set by setIgnored, and what members are read in the rest of the parallel part of the pass.
### Writes to BC from the setIgnored call
- [BC.UndefinedSymbols](https://github.com/llvm/llvm-project/blob/main/bolt/lib/Core/BinaryFunction.cpp#L3239)
- [BC.SymbolicDisAsm](https://github.com/llvm/llvm-project/blob/main/bolt/lib/Core/BinaryFunction.cpp#L1620-L1621)
- [BC.SymbolToFunctionMap modified from ScanExternalRefs](https://github.com/llvm/llvm-project/blob/main/bolt/lib/Core/BinaryFunction.cpp#L3811)
### What runOnFunction reads from the BC
- the rest of the parallel function only accesses the AArch64MCPlusBuilder through `BC.MIB`, to get bool information about individual instructions, (e.g. `BC.MIB->isPSignOnLR(Inst)`)
---
For this reason I believe it's sufficient to only guard the `setIgnored` calls without creating a vector to hold to-be-ignored functions, and ignore them later on a single thread.
https://github.com/llvm/llvm-project/pull/165365
More information about the llvm-branch-commits
mailing list