Challenge 4: Memory safety of BTreeMap's btree::node module
- Status: Open
- Tracking Issue: #77
- Start date: 2024/07/01
- End date: 2025/04/10
- Reward: 10,000 USD
Goal
Verify the memory safety of the alloc::collections::btree::node module.
This is one of the main modules used for implementing the BTreeMap collection, and it includes a lot of unsafe code.
Success Criteria
The memory safety of all public functions (especially safe ones) containing unsafe code must be verified, e.g.:
LeafNode::newNodeRef::as_internal_mutNodeRef::lenNodeRef::ascendNodeRef::first_edgeNodeRef::last_edgeNodeRef::first_kvNodeRef::last_kvNodeRef::into_leafNodeRef::keysNodeRef::as_leaf_mutNodeRef::into_leaf_mutNodeRef::as_leaf_dyingNodeRef::pop_internal_levelNodeRef::pushHandle::left_edgeHandle::right_edgeHandle::left_kvHandle::right_kvHandle::descendHandle::into_kvHandle::key_mutHandle::into_val_mutHandle::into_kv_mutHandle::into_kv_valmutHandle::kv_mut
Verification must be unbounded for functions that use recursion or contain loops, e.g.
NodeRef::new_internalHandle::insert_recursingBalancingContext::do_mergeBalancingContext::merge_tracking_child_edgeBalancingContext::steal_leftBalancingContext::steal_rightBalancingContext::bulk_steal_leftBalancingContext::bulk_steal_right
List of UBs
All proofs must automatically ensure the absence of the following undefined behaviors:
- Accessing (loading from or storing to) a place that is dangling or based on a misaligned pointer.
- Reading from uninitialized memory.
- Mutating immutable bytes.
- Producing an invalid value
Note: All solutions to verification challenges need to satisfy the criteria established in the challenge book in addition to the ones listed above.