Skip to content

Commit 6c84883

Browse files
committed
Merge remote-tracking branch 'upstream/main' into rwlock-drop
2 parents d3f1fb6 + ee46c21 commit 6c84883

22 files changed

Lines changed: 438 additions & 133 deletions

File tree

ostd/specs/mm/page_table/node/child.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<'a, C: PageTableConfig> OwnerOf for ChildRef<'a, C> {
5252
Self::None => owner.is_absent(),
5353
}
5454
}
55-
}
55+
}
5656

5757
impl<C: PageTableConfig> Child<C> {
5858

ostd/specs/mm/page_table/node/entry_owners.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use vstd_extra::ghost_tree::*;
77
use vstd_extra::ownership::*;
88

99
use crate::mm::frame::meta::mapping::{frame_to_index, meta_to_frame};
10+
use crate::mm::frame::meta::REF_COUNT_UNUSED;
1011
use crate::mm::page_prop::PageProperty;
1112
use crate::mm::page_table::*;
1213
use crate::mm::{Paddr, PagingConstsTrait, PagingLevel, Vaddr};
13-
use crate::mm::frame::meta::REF_COUNT_UNUSED;
1414
use crate::specs::arch::mm::{NR_ENTRIES, NR_LEVELS, PAGE_SIZE};
1515
use crate::specs::arch::paging_consts::PagingConsts;
1616
use crate::specs::arch::*;

ostd/specs/mm/page_table/node/owners.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<C: PageTableConfig> Inv for NodeOwner<C> {
106106
impl<C: PageTableConfig> NodeOwner<C> {
107107
/// Returns a NodeOwner with children_perm updated at the given index.
108108
/// Used to specify the state after storing a new PTE for an allocated child.
109-
pub open spec fn set_children_perm(self, idx: usize, pte: C::E) -> Self;
109+
pub uninterp spec fn set_children_perm(self, idx: usize, pte: C::E) -> Self;
110110

111111
#[verifier::external_body]
112112
pub axiom fn set_children_perm_axiom(self, idx: usize, pte: C::E)

ostd/specs/mm/page_table/owners.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ use vstd_extra::ghost_tree::*;
1313
use vstd_extra::ownership::*;
1414
use vstd_extra::prelude::TreeNodeValue;
1515

16-
use crate::mm::{
17-
page_table::EntryOwner,
18-
Paddr, PagingLevel, Vaddr, MAX_NR_LEVELS,
19-
};
16+
use crate::mm::{page_table::EntryOwner, Paddr, PagingLevel, Vaddr, MAX_NR_LEVELS};
2017

2118
use crate::mm::frame::frame_to_index;
22-
use crate::mm::page_table::{PageTableGuard, PageTableEntryTrait};
19+
use crate::mm::page_table::{PageTableEntryTrait, PageTableGuard};
2320

2421
use crate::specs::arch::*;
2522
use crate::specs::mm::frame::meta_region_owners::MetaRegionOwners;

ostd/specs/mm/virt_mem_newer.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,12 @@ impl MemView {
360360
///
361361
/// ## Preconditions
362362
/// - `this.split_spec(vaddr, len) == (lhs, rhs)`.
363+
/// - Every mapping in `this` starts at or after `vaddr`.
364+
/// - Every physical frame tracked by `this.memory` is reachable from some
365+
/// virtual address at or after `vaddr`.
363366
///
364367
/// ## Postconditions
365-
/// - `this == lhs.join_spec(rhs)`.
366-
#[verifier::external_body]
368+
/// - `lhs.join_spec(rhs)` has the same mappings and memory contents as `this`.
367369
pub proof fn lemma_split_join_identity(
368370
this: MemView,
369371
lhs: MemView,
@@ -373,10 +375,15 @@ impl MemView {
373375
)
374376
requires
375377
this.split_spec(vaddr, len) == (lhs, rhs),
378+
forall|m: Mapping|
379+
#[trigger] this.mappings.contains(m) ==> vaddr <= m.va_range.start < m.va_range.end,
380+
forall|pa: Paddr|
381+
#[trigger] this.memory.contains_key(pa) ==> exists|va: usize|
382+
vaddr <= va && #[trigger] this.is_mapped(va, pa),
376383
ensures
377-
this == lhs.join_spec(rhs),
384+
this.mappings =~= lhs.join_spec(rhs).mappings,
385+
this.memory =~= lhs.join_spec(rhs).memory,
378386
{
379-
// Auto.
380387
}
381388
}
382389

ostd/specs/mm/vm_space.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,6 @@ impl<'a> VmSpaceOwner<'a> {
247247
}
248248
}
249249

250-
/// The basic invariant between a VM space and its owner.
251-
#[deprecated(note = "We removed the `exec` fields in VmSpace so this is no longer needed.")]
252-
pub open spec fn inv_with(&self, vm_space: VmSpace<'a>) -> bool {
253-
true
254-
}
255-
256250
/// Determines whether a new reader can be safely instantiated within the VM address space.
257251
///
258252
/// This specification function enforces memory isolation by ensuring that the

ostd/src/mm/frame/frame_ref.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ impl<M: AnyFrameMeta> FrameRef<'_, M> {
6767
pub(in crate::mm) fn borrow_paddr(raw: Paddr) -> Self {
6868
proof {
6969
broadcast use crate::mm::frame::meta::mapping::group_page_meta;
70+
7071
old(regions).inv_implies_correct_addr(raw);
7172
}
7273

ostd/src/mm/frame/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,8 @@ impl<'a, M: AnyFrameMeta> Frame<M> {
417417
pub fn borrow(&self) -> FrameRef<'a, M> {
418418
assert(regions.slot_owners.contains_key(self.index()));
419419
broadcast use crate::mm::frame::meta::mapping::group_page_meta;
420-
421420
// SAFETY: Both the lifetime and the type matches `self`.
421+
422422
#[verus_spec(with Tracked(&perm.points_to))]
423423
let paddr = self.start_paddr();
424424

0 commit comments

Comments
 (0)