Skip to content

fix: Decouple arch-specific constants from PagingConstsTrait trait definitions, fix specifications, and prove axioms.#532

Draft
rikosellic wants to merge 32 commits into
asterinas:mainfrom
rikosellic:paging-const
Draft

fix: Decouple arch-specific constants from PagingConstsTrait trait definitions, fix specifications, and prove axioms.#532
rikosellic wants to merge 32 commits into
asterinas:mainfrom
rikosellic:paging-const

Conversation

@rikosellic

@rikosellic rikosellic commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

The current verification design maps hard-coded x86-specific constants to the PagingConstsTrait abstraction, which is incorrect because we can never extend the proof to other architectures. The new design is to prove the properties of abstractions (e.g., CursorOwner based on PageTableConfig) purely with the const declarations in PagingConstTrait. And only use the arch-specific constants (controlled by attributes) when proving definitions instantiated with PagingConsts.

@hiroki-chen

This comment was marked as resolved.

@hiroki-chen hiroki-chen mentioned this pull request Jun 16, 2026
@hiroki-chen

This comment was marked as resolved.

@rikosellic rikosellic marked this pull request as draft June 17, 2026 03:13
@rikosellic rikosellic changed the title Fix PagingConsts axioms fix: Decouple arch-specific constants from PagingConstsTrait trait definitions, fix specifications, and prove axioms. Jun 17, 2026
@rikosellic rikosellic added the model design Model or specification of system design label Jun 17, 2026
@rikosellic

rikosellic commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

And it turns out to be a big change, because CursorOwner::inv is actually defined with the x86-specific constants. We have something like

&&& self.level <= 4 ==> {...}`
&&& self.level <= 3 ==> {....}

This is wrong because there are 3-level page tables in other architectures.

@rikosellic rikosellic added the verification bug Unsoundness, verification panics, or unsupported features label Jun 17, 2026
@rikosellic

Copy link
Copy Markdown
Collaborator Author

This PR is currently suspended.

@rikosellic

This comment was marked as resolved.

Resolved conflicts between paging-const genericization and upstream
changes (PRs asterinas#531, asterinas#534, asterinas#537). Adapted upstream's new proven proofs
to use generic C::NR_LEVELS()/nr_subpage_per_huge::<C>() forms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Marsman1996 Marsman1996 added the AI-assist AI-aided proof or generation label Jun 20, 2026
@Marsman1996

Copy link
Copy Markdown
Collaborator

Reduce from 215 newly added assumes to 25 assumes

/// Proves the concrete values of `vaddr_make` for the x86_64 paging configuration.
///
/// For any `C: PagingConstsTrait`, since all configs share
/// `BASE_PAGE_SIZE == 4096`, `nr_subpage_per_huge == 512`, and `NR_LEVELS == 4`:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This looks suspicious. I do not think this assumption holds for all trait implementations.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think LLM is misguided by the requirements in PagingConstsTrait.

Comment thread ostd/src/mm/mod.rs
// FIXME: remove this once we have a more general
Self::BASE_PAGE_SIZE() == PAGE_SIZE,
Self::NR_LEVELS() == NR_LEVELS,
Self::BASE_PAGE_SIZE() / Self::PTE_SIZE() == NR_ENTRIES,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We should remove these hard-coded constant requirements here.

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

Labels

AI-assist AI-aided proof or generation model design Model or specification of system design verification bug Unsoundness, verification panics, or unsupported features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants