Repository navigation
Description
Summary
The documented stack requirement (about 17 KiB) understates what each qbit secret-key call needs (32 KiB or more).
Severity: low. Found in the 2026-11-04 review of the v1.0.1 change set (all 1.x.x merges since v1.0.0 plus the open PRs that target it), against 1.x.x 21fee6ee8e; area: #270, #268.
Observed
Confidence: confirmed (from code).
- Location:
doc/subtrees/libbitcoinpqc.md:49anddoc/release-notes-268.md:19at21fee6ee8e;doc/release-notes-1.0.1.md:340-341at261d1b71eb. The behavior is insrc/crypto/pqc.h:37(PQC_STACK_BURN_BYTES = 32 * 1024) andsrc/crypto/pqc.cpp:66(BurnReleasedStack). - Scenario: someone embedding qbit, or packaging it with small thread stacks (musl or Alpine at 128 KiB, custom
QThread::setStackSize, or a future-par-style worker pool that signs), budgets 17 KiB per call. After crypto: clear stack released by PQC secret-key operations #270, everyCPQCKey::MakeNewKey,Set,SignandDerivePQCKeywritesPQC_STACK_BURN_BYTES(32 KiB) plus the frames ofBurnReleasedStack,memory_cleanseandmemsetbelow the caller. That is about 2× the documented figure. The burns run one after another, not nested, so the peak is about max(17 KiB, 32 KiB + ~0.2 KiB). crypto: clear stack released by PQC secret-key operations #270's own description gives a total of about 74 KiB for the deepest RPC-thread path. - Evidence: code (
pqc.cpp:66-70, and the call sites atpqc.cpp:182,:224,:252,:289). The disassembly showsBurnReleasedStackreserving a page-probed 32 KiB frame and every call site present. crypto: clear stack released by PQC secret-key operations #270's testCheckBurnCoversReleasedStackrequiresburn_begin >= PQC_STACK_BURN_BYTES.test_qbit --run_test=pqc_tests,pqc_sigcache_testspasses (50 cases, 2,425 assertions), includingpqc_secret_key_operations_fit_small_thread_stack.
Impact
Operator and integrator guidance does not match the implemented behavior Default thread stacks on the release platforms (512 KiB on macOS, 1–2 MiB on Windows, 8 MiB with glibc) are ample, so this is not a crash risk for v1.0.1 release binaries.
Suggested fix
Change the three texts to "each CPQCKey/DerivePQCKey call needs about 33 KiB of free stack (qbit's 32 KiB burn, #270); direct library calls need about 17 KiB (#268)". When fixing the stale #270 text that #174 already tracks, fold this into the same edit.
Related: new. #174 notes only that #181 still carries the DerivePQCKey known-limitation bullet and the "#270 is not part of this release" text. Those are known: #174 and still present at 261d1b71eb: lines 15-17 of the summary, and lines 492-497.
Activity
doc: correct v1.0.1 notes and docs from the release review
doc: correct v1.0.1 notes and docs from the release review
doc: correct v1.0.1 notes and docs from the release review
doc: correct v1.0.1 notes and docs from the release review
release: prepare v1.0.1 (#181)
release: prepare v1.0.1 (#181)
kiwidream commentedon Nov 12, 2026
Fixed on
1.x.xby #181 (29c0ec9b6c):doc/subtrees/libbitcoinpqc.mdand the v1.0.1 release notes now say that a call made directly to the library needs about 17 KiB of free stack, and that eachCPQCKey::MakeNewKey(),CPQCKey::Set(),CPQCKey::Sign()andDerivePQCKey()call needs at least 32 KiB plus its own frames (#270).doc/release-notes-268.mdis folded into the notes and deleted, and the "#270 is not part of this release" text is gone.Closing by hand, because a merge into
1.x.xdoes not close issues automatically.