Skip to content

Conversation

@Freax13
Copy link
Member

@Freax13 Freax13 commented Nov 15, 2025

This PR adds Step implementations for PhysAddr and PhysFrame. This PR also adds kani harnesses to prove the correctness of these new implementations and the unsafe code within them.

Closes #212

We'll have very similar harnesses for PhysAddr, so let's use a module
to avoid name conflicts.
The Step implementation uses unsafe. The kani harnesses should give us
some confidence that the unsafe code is correct.
These harnesses check that PhysFrame behaves like PhysAddr with the
steps scaled by the page size.
Copy link
Contributor

@josephlr josephlr left a comment

Choose a reason for hiding this comment

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

I did a quick look, while nothing seems wrong, there are two things I want to take a closer look at:

  • How the Physical Address stuff interacts with the memory encryption bit. If the C-bit isn't bit 52 (it's usually bit 47), could a valid physical address underflow into an invalid physical address?
  • how the kani::proof stuff works.

@Freax13
Copy link
Member Author

Freax13 commented Nov 20, 2025

  • How the Physical Address stuff interacts with the memory encryption bit. If the C-bit isn't bit 52 (it's usually bit 47), could a valid physical address underflow into an invalid physical address?

No because PhysAddr and PhysFrame are guaranteed not to contain the C-bit/S-bit.

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.

Implement core::iter::Step for PhysFrame and Page

3 participants