Commit b29297c
committed
fix(icicle): extend mutex scope to protect NTT domain operations
Fix race condition where the nttDomainMu mutex was released before
ReleaseDomain() and InitDomain() operations completed, allowing concurrent
threads to corrupt domain state.
Issue: When multiple ProvingKey instances with different domain sizes are
initialized concurrently, Thread A could begin InitDomain() while Thread B
simultaneously calls ReleaseDomain(), causing undefined behavior in the
ICICLE C++ backend.
Solution: Use defer to hold the mutex for the entire critical section,
including the async domain operations. This ensures atomic domain
initialization and prevents interleaved domain management.
Impact:
- Prevents silent domain corruption that could lead to invalid proofs
- Eliminates potential panics from concurrent domain operations
- Critical for production environments with concurrent circuit initialization
The mutex now protects:
1. Reading/updating nttDomainMaxByDevice map
2. ReleaseDomain() execution (if needed)
3. InitDomain() execution
4. Waiting for domain operations to complete1 parent cd78741 commit b29297c
File tree
5 files changed
+10
-5
lines changed- backend/accelerated/icicle
- groth16
- bls12-377
- bls12-381
- bn254
- bw6-761
- internal/generator/templates
5 files changed
+10
-5
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
113 | 115 | | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
118 | | - | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
0 commit comments