Skip to content

Reject unsupported execution effects before Aeneas lowering - #3848

Open
joshlf wants to merge 1 commit into
G5ql2xwdsnzdupc5d4auj6l5vgi5okgrcfrom
Glga77guruqohhu34sv7kfiu3slnotqyv
Open

joshlf wants to merge 1 commit into
G5ql2xwdsnzdupc5d4auj6l5vgi5okgrcfrom
Glga77guruqohhu34sv7kfiu3slnotqyv

Conversation

@joshlf

@joshlf joshlf commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

An extracted proof cannot account for an effect that translation erased.
Preserve Charon's imported promoted MIR before its transformation passes
and inspect both that snapshot and final LLBC from every discovered
function specification, following callees and unwind paths.

Admit only the reviewed value-and-borrow fragment or an exact registered
external interpretation. Reject unknown operations, unsupported
instantiations and extraction options, missing snapshots, and lost guarded
calls. Refuse optimized-MIR fallback for stolen local bodies.

Preserve compiler-owned doc attributes and their literal source origins
before item selection. This gives later annotation binding evidence from
macro expansion without guessing an impl from its textual header. Treat
only the compiler's exact tuple/unit constructor aliases as the parent
struct's attributes; fields, variants and statements remain distinct.

Omit unused provided-method signatures before they import unrelated
trait dependencies. Reject resolved calls to omitted methods, including
inherited and overridden methods; required slots retain their identities.
Native controls check both omission and annotation-origin behavior.

Bind the report to compiler inputs, source bodies and the patched runtime.
Audit downstream Lean dependencies for failure-erasing adapters, including
uses hidden behind opaque helpers. The checker constrains the trusted
translation boundary; it is not a proof of rustc or Charon's semantics.

Authored by an AI agent acting on joshlf's behalf.


Latest Update: v26 — Compare vs v25

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v25 v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v26 v25 v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v25 v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v24 v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v23 v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v22 v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v21 v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v20 v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v19 v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v18 v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v17 v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v16 v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v15 v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v14 v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v13 v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v12 v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v11 v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v10 v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v9 v8 v7 v6 v5 v4 v3 v2 v1 Base
v8 v7 v6 v5 v4 v3 v2 v1 Base
v7 v6 v5 v4 v3 v2 v1 Base
v6 v5 v4 v3 v2 v1 Base
v5 v4 v3 v2 v1 Base
v4 v3 v2 v1 Base
v3 v2 v1 Base
v2 v1 Base
v1 Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/Glga77guruqohhu34sv7kfiu3slnotqyv && git checkout -b pr-Glga77guruqohhu34sv7kfiu3slnotqyv FETCH_HEAD

Checkout

git fetch origin refs/heads/Glga77guruqohhu34sv7kfiu3slnotqyv && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/Glga77guruqohhu34sv7kfiu3slnotqyv && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/Glga77guruqohhu34sv7kfiu3slnotqyv

Stacked PRs enabled by GHerrit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T00:19:59.409023Z dccb783 PR opened
🔒 Security Review ✅ Completed 2026-10-09T00:16:19.468490Z dccb783 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov-commenter

codecov-commenter commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (G5ql2xwdsnzdupc5d4auj6l5vgi5okgrc@1fd4064). Learn more about missing BASE report.

Additional details and impacted files
@@                         Coverage Diff                          @@
##             G5ql2xwdsnzdupc5d4auj6l5vgi5okgrc    #3848   +/-   ##
====================================================================
  Coverage                                     ?   61.30%           
====================================================================
  Files                                        ?       20           
  Lines                                        ?     3727           
  Branches                                     ?        0           
====================================================================
  Hits                                         ?     2285           
  Misses                                       ?     1442           
  Partials                                     ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dccb7830a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +625 to +626
body = {'call': body['call'], 'on_unwind':
{'span': term['span'], 'id': 0, 'statements': []}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Classify referenced cleanup blocks as unwind paths

When an unstructured Call has an on_unwind target, this replaces it with an empty block; cfg() later scans the referenced block independently with unwind=False. Consequently, cleanup blocks containing supported-looking Assign or Call effects bypass the restricted unwind-effect check. If Charon subsequently removes that ignored cleanup path, the final LLBC stage cannot catch the omitted effect, so admission can certify execution that Aeneas does not model. Traverse blocks according to their unwind edges, or otherwise mark every cleanup target and apply the unwind restrictions to it.

Useful? React with 👍 / 👎.

Comment on lines +677 to +680
if value and (name in {'RUSTFLAGS', 'CARGO_ENCODED_RUSTFLAGS',
'CARGO_BUILD_RUSTFLAGS', 'RUSTC', 'RUSTC_WRAPPER',
'RUSTC_WORKSPACE_WRAPPER', 'CHARON_ARGS'} or
re.fullmatch(r'CARGO_TARGET_.*_RUSTFLAGS', name)):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject Cargo build-level compiler wrapper overrides

The override check omits Cargo's configuration-derived environment variables such as CARGO_BUILD_RUSTC, CARGO_BUILD_RUSTC_WRAPPER, and CARGO_BUILD_RUSTC_WORKSPACE_WRAPPER. In particular, a workspace wrapper composes with Charon's own RUSTC_WRAPPER, so setting it allows an additional executable to participate in compilation while both pre- and post-extraction identities remain unchanged because the variable is neither rejected nor hashed. Reject these aliases alongside their direct RUSTC* equivalents before treating the MIR pipeline as controlled.

Useful? React with 👍 / 👎.

Comment on lines +195 to +200
if (not isinstance(evidence, dict) or evidence.get('version') != 1 or
evidence.get('sources') != manifest.get('sources') or
evidence.get('registry') != admission.digest(root / 'verification/aeneas/external.json') or
evidence.get('inputs') != admission.input_identity(root) or
set(evidence.get('stages', {})) != {'before', 'llbc'} or
any(stage.get('roots') != roots for stage in evidence['stages'].values())):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind admission evidence to the compiled Lean model

For a verified-live project, this validates Rust sources, registry, toolchain inputs, stages, and roots but never compares manifest["model"] with the current Zerocopy/Funs.lean and Types.lean. If either generated model is edited after assembly— including during the proof-check window—lake clean rebuilds and audits that edited model while stale admission evidence is still accepted; an altered pure definition can therefore make the proofs pass without corresponding to the inspected LLBC. Recompute the model fingerprint before and after proof checking, just as the Rust input identity is checked.

Useful? React with 👍 / 👎.

Comment on lines +405 to +411
if tag == 'Call':
function, args = body
if variant(function['kind'])[0] != 'Fun':
raise ValueError('Unresolved constant producer')
for arg in args:
self.constant(arg)
self.visit(function['kind']['Fun'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate generic arguments on constant calls

For a ConstantExpr::Call, this visits only the generic function declaration and ignores the concrete generics stored on the function operand. A constant or promoted call to the opaque transmute_unchecked can therefore match its generic registry prototype with an instantiation other than the sole admitted u8 → bool case, bypassing the explicit instantiation check used for ordinary calls. Apply the same concrete type/const/dictionary validation and boundary recording to constant calls before accepting their producer.

Useful? React with 👍 / 👎.

Comment on lines +464 to +468
leaf = 'core::num::{usize}::unchecked_' + op.lower()
if not any(row['rust'] == leaf for row in self.registry):
raise ValueError(f'No reviewed interpretation for {leaf}')
self.calls.append({'caller': self.current, 'callee': leaf,
'implicit': True})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Record implicit unchecked operations as interpretations

This branch records an implicit unchecked_add or unchecked_mul only in calls, while check_translation() validates failure-capable signatures exclusively for entries in the executions list. Thus, when the primitive appears only as the expected UB-mode BinaryOp, its generated Lean signature is never checked; an infallible translation that erases the unsafe precondition can pass admission unless the same leaf happens to be visited independently. Record the selected registry interpretation in executions, or make the translation check consume these implicit call records directly.

Useful? React with 👍 / 👎.

for path in sorted(paths):
combined.update(str(path.relative_to(root)).encode())
combined.update(path.read_bytes())
tools = Path(os.environ['AENEAS_TOOLCHAIN_DIR'])

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fall back to the default toolchain directory

run.sh supports an unset AENEAS_TOOLCHAIN_DIR by assigning tools_dir to target/aeneas/toolchain, but neither that assignment nor toolchain.sh exports the variable. On the normal CI invocation (bash verification/aeneas/run.sh with no override), the first admission.py inputs call therefore reaches this direct environment lookup and raises KeyError before extraction starts. Use the same repository-relative default here or explicitly export the resolved directory in the driver.

Useful? React with 👍 / 👎.

Comment on lines +467 to +469
name = rust_identity(file, owner['path'])
annotations.source_body_digests.setdefault(name, []).append(
hashlib.sha256(encoded[owner['open']:owner['close']]).hexdigest())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bind opaque helpers to their expanded dependencies

The trust check hashes only the lexical bytes between each function's body braces. transmute_unchecked, for example, invokes the crate-local static_assert! macro, so changing that macro—or the implementation of any local helper called by an opaque boundary—changes the compiled execution without changing this digest. Although the project identity records that some source changed, it is not compared with a reviewed expected project identity, so the unchanged registry entry still selects the old trusted interpretation. Hash the expanded/MIR body or include all transitive local dependencies in the registered boundary identity.

Useful? React with 👍 / 👎.

Comment on lines +314 to +318
if current == `Aeneas.Std.Option.ofResult then
throwError "Extracted execution depends on unsupported failure erasure: {current}"
if let some owner := env.getModuleIdxFor? current then
let moduleName := env.allImportedModuleNames[owner.toNat]!
if moduleName.getRoot == `Aeneas && !auditModules.contains owner then continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Verify whole-domain laws of registered unsafe models

This dependency walk only rejects the exact Aeneas.Std.Option.ofResult adapter; it never compares the registered transmute_unchecked, copy_unchecked, or unchecked-arithmetic implementations with their required guards and bad-input behavior. An axiom-free Lean definition that returns .ok for an invalid Boolean, oversized copy, or overflowing arithmetic therefore passes both this walk and the axiom audit, and the generated-template check establishes only a Result-typed signature. Add compiled definitional or theorem checks covering each registered primitive's complete input domain before accepting its interpretation.

Useful? React with 👍 / 👎.

@joshlf
joshlf force-pushed the G5ql2xwdsnzdupc5d4auj6l5vgi5okgrc branch from 7846f80 to 6bd1390 Compare October 9, 2026 02:21
@joshlf
joshlf force-pushed the G5ql2xwdsnzdupc5d4auj6l5vgi5okgrc branch from f9211b5 to 9f142e4 Compare October 14, 2026 18:32
@joshlf
joshlf force-pushed the Glga77guruqohhu34sv7kfiu3slnotqyv branch from c678614 to 3c4fe9b Compare October 14, 2026 18:32
@joshlf
joshlf force-pushed the G5ql2xwdsnzdupc5d4auj6l5vgi5okgrc branch from 9f142e4 to b03b22f Compare October 14, 2026 21:43
@joshlf
joshlf force-pushed the Glga77guruqohhu34sv7kfiu3slnotqyv branch from 3c4fe9b to 556d864 Compare October 14, 2026 21:43
@joshlf
joshlf force-pushed the G5ql2xwdsnzdupc5d4auj6l5vgi5okgrc branch from b03b22f to f561c6e Compare October 15, 2026 00:40
@joshlf
joshlf force-pushed the Glga77guruqohhu34sv7kfiu3slnotqyv branch from 556d864 to 5345d5d Compare October 15, 2026 00:40
An extracted proof cannot account for an effect that translation erased.
Preserve Charon's imported promoted MIR before its transformation passes
and inspect both that snapshot and final LLBC from every discovered
function specification, following callees and unwind paths.

Admit only the reviewed value-and-borrow fragment or an exact registered
external interpretation. Reject unknown operations, unsupported
instantiations and extraction options, missing snapshots, and lost guarded
calls. Refuse optimized-MIR fallback for stolen local bodies.

Preserve compiler-owned doc attributes and their literal source origins
before item selection. This gives later annotation binding evidence from
macro expansion without guessing an impl from its textual header. Treat
only the compiler's exact tuple/unit constructor aliases as the parent
struct's attributes; fields, variants and statements remain distinct.

Omit unused provided-method signatures before they import unrelated
trait dependencies. Reject resolved calls to omitted methods, including
inherited and overridden methods; required slots retain their identities.
Native controls check both omission and annotation-origin behavior.

Bind the report to compiler inputs, source bodies and the patched runtime.
Audit downstream Lean dependencies for failure-erasing adapters, including
uses hidden behind opaque helpers. The checker constrains the trusted
translation boundary; it is not a proof of rustc or Charon's semantics.

gherrit-pr-id: Glga77guruqohhu34sv7kfiu3slnotqyv
Agent-authored-by: AI agent acting on joshlf's behalf

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants