Repository navigation
Stop the OTP 28 segfault in scans and the RSR oracle (PinSites miscompile) - #1062
Conversation
OTP 28.0-28.3 miscompile PinSites.walk/4 (compiler bug OTP-19951, fixed in OTP 28.4 / compiler 9.0.5). Its `seen <> <<c>>` accumulator gets an in-place append (private_append) while `seen` is still referenced, and the VM segfaults in garbage collection (sweep_off_heap, exit 139). Callers pinned to OTP 28.3 lost the Hypatia scan and the RSR oracle. Reproduced on zig-dnssec fa8d500 with OTP 28.3 + Elixir 1.19.4: `mix hypatia.rsr_score` crashed 6/6. Bisecting the compiled modules isolated PinSites alone. With the destructive-update pass turned off for this module only, it passes 10/10; OTP 28.5.0.8 passes unchanged. A test checks that the compile option stays in place. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7Zo6VBPrBWYUmDJZR1H
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Build Test Images / Integration Status: not caused by this PR. This PR changes one Elixir module and adds one Elixir test. The image build fails while compiling the Rust CLI, in files this PR does not touch:
The same failure is on every recent PR (see the comment on #1057). Generated by Claude Code |
rsr-template-repo af8665c crashes `mix hypatia.rsr_score` on OTP 28.5.0.8 with main (4/4, exit 139) and passes with this branch (4/4). The same input passes on OTP 28.3 and OTP 27; zig-dnssec fa8d500 crashes on 28.3 only. So OTP 28.4's fix for OTP-19951 does not cover this case, and the removal condition in the comment was wrong. Comment and test doc now say OTP 28 and name both reproductions. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7Zo6VBPrBWYUmDJZR1H
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
Rust Dependency Audit (and Security Status): not caused by this PR. The audit fails on advisory Generated by Claude Code |
…lay corpus (#1064) ## What Hypatia's rules read repositories. Nothing read what a failed run left behind, so infrastructure reds (rate limits, merge-ref races, cancelled runs, dead tokens, unreachable hosts, lock pins) looked the same as code failures. This PR adds `Hypatia.Rules.CiFailureTriage`: - **19 rules**, with ids `hypatia/ci_failure_triage/<name>` (standards A5 form, no wildcards). - **Precedence**: four layers, platform > config > toolchain > code. The earliest layer is the cause, so a rate limit outranks the test failure it caused. - **One action per rule**: `none` · `rerun` · `fix` · `owner` · `report` · `upstream`. - **Loop limit**: `decide/2` escalates a transient rule to the owner (`persistent: true`) once its rerun budget is spent. Every budget is at most 2, so a rerun loop always ends. - **Never**: admin merge, required-check or ruleset edits, licence or SPDX edits, loosening a canon gate, skipping tests (`forbidden_actions/0`, and a test checks that no rule takes one). - `check_gate/2` finds required checks that never report, and names a near match when only the case differs. - `check_scanner_pin_drift/1` finds panic-attack pinned at different commits. Today it finds four: `ac68bbae` (hypatia estate-rescan), `b689a74d` (fleet report-back), `410a8f82` (standards Hypatia lane and fork-governance) and `b5530834` (deep-recon). - **WF029** in `WorkflowAudit.audit/3` catches an `if: always()` job that downloads its needs' artifacts. Such a job turns red on a cancelled run; the recipe is `if: ${{ !cancelled() }}`. It fired once across 165 local estate workflows, on cicd-squabbler `static-analysis-gate.yml` `deposit-findings`. - The rules are wired to `mix hypatia.ci_triage log|gate|pins|rules`. It runs offline, prints JSONL and exits 3 when it finds something. ## Evidence The replay corpus in `test/fixtures/ci_failure_triage/` has 20 cases: - 12 seed signatures reconstructed from the reported text. - 8 real excerpts of hypatia's own failed runs, with the run id in the file name. The real logs first exposed five classes the rules missed: a dead PAT (401), GitHub API 5xx, an unresolvable lock pin, a diff-range commit missing from the checkout, and a rollup cascade. I added a rule for each. Fixtures are `.txt` because `.gitignore` drops `*.log`. The segfault rule escalates instead of rerunning. The estate case is the deterministic OTP 28 miscompile (#1062). ## Testing I ran this locally on Elixir 1.17.3 / OTP 25, because this sandbox can't reach repo.hex.pm. The harness leaves out the web tier and the neural tier, and takes jason and gen_stage from git. - `test/rules` plus every test touching WorkflowAudit or the CLI: **776 tests, 0 failures**. The baseline before this change was 571/571 in `test/rules`. - `mix format --check-formatted` is clean on the changed files. - `scripts/check-readme-claims.sh` passes. README and CLAUDE.md counts were re-measured, and `docs/rules/catalogue.adoc` was regenerated. The full `mix test` on CI's OTP 27 lane has not been run by me. CI is the first full run. --- _Generated by [Claude Code](https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT)_ --------- Co-authored-by: CLAUDE <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
|
Validate Documentation: not caused by this PR. The failing step is "Rule registry (hypatia_rules_praxis.deed) matches the code and lints": the committed registry is stale. The diff shows new Generated by Claude Code |
…1103) Minted repos keep segfaulting (exit 139) in the RSR oracle and the Hypatia scan because they pin an old Hypatia (`be98f74`), from before the #1062 crash fix. This was confirmed by MMT/Autoformalisation on Apodeixis.jl#25: syncing the pins from the template fixed it. The pin sits in five places that must move together, and the template itself splits them. This adds a static check, in the same shape as the existing panic-attack `scanner_pin_drift`. ## What - `check_hypatia_pin_drift/1` reads these Hypatia pin sites: - `HYPATIA_SHA:` env (block or flow form) - `--hypatia-ref <sha>` - a checkout of `repository: hyperpolymath/hypatia` with a sibling `ref:`, in either order - `hypatia-rule-order.json` `scanner.commit` (only when `scanner.repository` is `hyperpolymath/hypatia`) - When more than one commit is pinned, it reports every site. The new `hypatia_pin_drift` rule is report-only: routed to the owner, never auto-fixed. YAML comments are stripped, so a kept "old pin" comment is not a second pin. `${{ … }}` values are not pins. - `mix hypatia.ci_triage pins` runs it alongside the panic-attack check and accepts the policy JSON. ## Proof On rsr-template-repo main `d183b32`, `mix hypatia.ci_triage pins .github/workflows/*.yml .machine_readable/policies/hypatia-rule-order.json` exits 3 and reports all five sites: dogfood-gate's oracle at `51539ab`, and the scan, both verdict-grid flags and the policy at `6693f9a`. On main it reports nothing for the same files. ## Tests - 7 new tests: - the template's split, with all 5 sites reported - one pin everywhere is clean - a checkout of another repository is not a Hypatia pin - a commented-out old pin is ignored - a policy naming another scanner is not a Hypatia pin - `ref:` before `repository:` is still read - a variable `HYPATIA_SHA` is not a pin All fail on main. - `mix test test/rules`: 887 tests, 0 failures. - `gen-rules-praxis.sh --check` (deed regenerated, 438 rules), `check-readme-claims.sh` and `rules-praxis-test.sh` (22/22) are clean, and the self-scan reports no findings. ## Not in scope - Whether a pin contains #1062 needs the Hypatia history, so this static check doesn't decide it. - The template's own fix (one pin everywhere, and `check-workflow-edges.sh` covering `dogfood-gate.yml`) belongs to rsr-template-repo. --- _Generated by [Claude Code](https://claude.ai/code/session_0136P7ZkGCWGEyedTtdEHAPT)_ --------- Co-authored-by: Claude <[email protected]>
Root cause of the exit 139 on #30: Lintel pinned Hypatia be98f74 (2026-10-27). That revision predates hyperpolymath/hypatia#1062, which compiles Hypatia.Rules.PinSites with :no_ssa_opt_destructive_update. Without it, the compiler's in-place binary append (`out <> <<c>>` in PinSites.do_mask/3) corrupts the VM's writable-binary list (p->wrt_bins head BinRef with next = 0xd8, in the core dump), and the GC crashes in sweep_off_heap. Both jobs that build Hypatia now use rsr-template-repo's pins, the estate's "one Hypatia revision": static-analysis-gate.yml hypatia-scan 6693f9a, OTP 27.3.4.19 (strict), patch level in the cache key dogfood-gate.yml rsr-score-self 6693f9a, OTP 27.3.4.19 Evidence, 44 inputs (Lintel main, the #29 and #30 merge refs, a minimised tree and 40 random subsets of the workflows), escripts built on each runtime: 27.3.4.19 28.3.3 28.5.0.8 be98f74 (old pin) 3 crash 5 crash 3 crash 6693f9a (new pin) 0 0 0 The scan step from this file passes on the main and #30 trees (exit 0, critical=0 high=2 medium=5). `mix hypatia.rsr_score` on the #30 tree passes 3/3. check-lock-sync.sh and check-invisible-characters.sh pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01J4QvDiFtqASJYm1U8JRY6P
## What `hypatia-cli.sh` no longer `exec`s the escript. It runs it as a child and stays as transparent as `exec`: - stdin, stdout and stderr pass through; - TERM, INT and HUP are forwarded; - the exit code is unchanged. When the escript dies by SEGV, BUS, ABRT or ILL, the wrapper prints the signal and the OTP and erts version to **stderr only**. It gets them from the installation's `OTP_VERSION` file and `erl +V`, without evaluating code. It then re-raises the same signal on itself. Because of the re-raise, callers still get exit 139, and their shell still prints `Segmentation fault … hypatia-cli.sh`. So the `toolchain_segfault` triage rule and its fixture keep matching. Also in this PR: - `tests/hypatia-cli-signal-test.sh`: six cases using fake escripts, wired into `escript-soundness.yml` right after the consumer-shaped invocation. - A `ci_failure_triage` fixture and row: the wrapper's report alone classifies as `toolchain_segfault`. ## Why metadatastician/lintel#30 failed with `Hypatia scanner execution failed with exit 139`, which reads as a scanner fault or as a finding about that repository. - Lintel still pinned `be98f74`, which predates #1062. Its core dump shows the #1062 signature: in-place binary append in `PinSites.do_mask/3`, the head of the process's `wrt_bins` list with `next = 0xd8`, and `sweep_off_heap` crashing in the GC. - The fix for Lintel is metadatastician/lintel#33, which pins `6693f9a` on OTP 27.3.4.19. - This PR addresses the general problem: a VM crash should say so wherever a consumer calls the wrapper. ## Evidence - `bash tests/hypatia-cli-signal-test.sh` → 6 of 6 PASS, with and without `erl` on PATH. - **Negative control:** the same test against the old wrapper (`main`'s `hypatia-cli.sh`) fails the SIGSEGV case only (`err=` empty). - **Real crash:** the new wrapper in front of the unfixed `be98f74` escript, on Lintel `d7bdc21`'s tree, with OTP 28.3.3: ``` [hypatia] The Erlang VM running the scanner (beam.smp) was killed by SIGSEGV (exit 139) on OTP 28.3.3 (erts 16.2.2). ``` The caller's shell still prints `Segmentation fault … hypatia-cli.sh`, rc is 139, and stdout is empty. - `mix test test/rules/ci_failure_triage_test.exs` → 200 tests, 0 failures (OTP 27.3.4.19, Elixir 1.19.4). `mix format --check-formatted` passes on the changed test file. - `shellcheck -S warning` passes on `hypatia-cli.sh` and the new test. - A self-scan with the `6693f9a` escript reports 0 findings on the changed shell files. An earlier draft that used `erl -eval` was flagged `eval_in_shell` and has been rewritten. **For #1062's notes.** A stress run over 44 inputs (Lintel trees plus 40 random subsets of its workflows) used escripts built natively on each runtime: | Revision | OTP 27.3.4.19 | OTP 28.3.3 | OTP 28.5.0.8 | |---|---|---|---| | `be98f74` (unfixed) | 3/44 crash | 5/44 crash | 3/44 crash | | `6693f9a` (fixed) | 0/44 | 0/44 | 0/44 | So OTP 27 is **not** immune without the #1062 compile option. The OTP 27.3.4.19 pin (ruling R2) protects only together with a revision that carries the fix. ## Not done - CI on this branch has not run yet. It is the check for `escript-soundness.yml`. - No erlang/otp report has been filed. The upstream compiler bug is still open (see #1062, "Not in this PR"). - No change to `ci_failure_triage`'s reason text. It still says OTP 27 is unaffected, which the table above contradicts. That's the owner's wording to change. --- _Generated by [Claude Code](https://claude.ai/code/session_01J4QvDiFtqASJYm1U8JRY6P)_ --------- Co-authored-by: Claude <[email protected]>



Summary
Callers on OTP 28 lose the Hypatia scan and the RSR oracle to a segmentation fault (exit 139). Reported on bactrian
e0b9b65and quintessence02fec30(scan, OTP 28.3), zig-dnssecfa8d500(mix hypatia.rsr_score, OTP 28.3) and rsr-template-repoaf8665c(mix hypatia.rsr_score, OTP 28.5.0.8).Cause. OTP 28 miscompiles
Hypatia.Rules.PinSites.walk/4(seen on 28.3 and 28.5.0.8; OTP 27 is fine). Itsseen <> <<c>>accumulator gets an in-place append (private_append) whileseenis still referenced. The VM then crashes in garbage collection (sweep_off_heapinerl_gc.c, called frombeam_jit_bs_init_bits). The OTP 28.4 fix for OTP-19951 is in the same pass but does not cover this case: 28.5.0.8 still crashes. Which input crashes depends on memory layout.Fix.
@compile :no_ssa_opt_destructive_updateonPinSitesonly, with a comment that says when to remove it. The cost is one copy per appended byte on one YAML line.Evidence (local, OTP 27.3.4.19, 28.3 and 28.5.0.8; Elixir 1.19.4 as the failing jobs pin)
mix hypatia.rsr_score <zig-dnssec fa8d500> --ssot rsr-criteria-v2.a2ml:mainno_ssa_opt_destructive_updatemainmix hypatia.rsr_score <rsr-template-repo af8665c>(the input of run 43139798509):mainmainmain.beamsets swapped by halves) isolatedElixir.Hypatia.Rules.PinSites.beam; that file alone from the bad set reproduces the crash.sweep_off_heap←do_minor←garbage_collect←beam_jit_bs_init_bits.PinSiteson every workflow throughWorkflowAudit, so it runs the same miscompiled code; this PR covers it, but the scan side is verified by the oracle path, not by its own reproduction.Not in this PR
Moving to OTP 28.5 does not avoid the bug. rsr-template-repo
mainnow pins OTP27.3.4.19, which is not affected; 28 estate repos still pin28.3in stale workflow copies. The estate's reusable workflow (standardshypatia-scan-reusable.yml) and Hypatia'srsr-oracle.ymldefault to28.5.0.8, which is affected. Those are changes outside this PR. The bug should also be reported upstream to erlang/otp with these reproductions.Test plan
test/pin_sites_compile_guard_test.exs: the compile option is recorded inPinSites.module_info(:compile). Fails when the attribute is removed.mix compile --warnings-as-errorsclean; changed files formatted.https://claude.ai/code/session_0136P7Zo6VBPrBWYUmDJZR1H
Generated by Claude Code