Repository navigation
[Backport releases/v4.34.0] fix: panic instead of wrapping counts in sharecommon_quick_fn - #15307
Merged
Merged
Conversation
This PR makes maximal sharing, including the kernel's sharing of every theorem it checks, panic when a shared subterm gains more than `INT_MAX` references, instead of eventually freeing the subterm while it is still referenced. On inputs north of 100GB, the possibility of triggering undefined behavior this way, which could be extended into a proof of False, could be excluded. Other kernels such as nanoda or con-leche not based on the Lean runtime or not making use of this specific function were not affected. `sharecommon_quick_fn` takes references to the objects it creates with a raw increment, skipping the sign test of `lean_inc_ref` because these objects are single-threaded. Past `INT_MAX` that increment wrapped the count into the sticky range, and further cache hits walked it back out of that range. The increment now checks its overflow flag and panics, so the hit path keeps its single add plus a branch that is never taken. --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit 1a63aff)
hyperpolymath
added a commit
to hyperpolymath/marches
that referenced
this pull request
Oct 14, 2026
Follow-up to the CodeRabbit review on #36 (thread on `lean-toolchain`, flagged Major / security): pin v4.34.1, the patched release of the 4.34 line. ## Verified against the primary source, not the bot's summary `git log v4.34.0..v4.34.1` in leanprover/lean4 shows: - three runtime reference-count fixes: - leanprover/lean4#15241: preserve sticky counts in deletion cascades - leanprover/lean4#15288: mark the children of objects whose single-threaded count overflowed - leanprover/lean4#15307: panic instead of wrapping counts in `sharecommon_quick_fn` - a `BitVec.ofNatClamp` backport - `chore: prepare release` (`5045d00`, 2026-09-24) marches checks only its own proofs, not untrusted input, so the practical risk was low. Still, this is a same-line patch bump, it costs nothing, and it keeps the estate's 4.34 soundness floor on the patched build. ## Change - `lean-toolchain`: `v4.34.0` → `v4.34.1` - `README.adoc`: the two version mentions - `STATE.adoc`: a dated entry. The v4.34.0 results are now marked historical. No source change. ## Gates (v4.34.1) ``` $ rm -rf .lake && lake build Build completed successfully (15 jobs). $ grep -rnw sorry Marches/ Marches.lean ; echo $? 1 $ lake env lean Marches/BadGadget.lean [(false, false), (true, true), (false, false), (true, true)] ``` ## Note on the stack #38 (rung-3 docs) is independent of this PR. Both add a `STATE.adoc` entry at the top, so whichever merges second will need a trivial merge, which I'll handle. CI here shows the same two pre-existing reds as `main` (`CI` `startup_failure` from `actions.lock` drift, and `estate-audit` from the cicd-suite pipefail bug). Both are diagnosed in #37. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VTeVWDEJgdYKsUNr4uhnXX --- _Generated by [Claude Code](https://claude.ai/code/session_01VTeVWDEJgdYKsUNr4uhnXX)_ Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport 1a63aff from #15289.