You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I came across a bug which manifests when allocating with an alignment other than 0.
The problem manifests when we get a candidate range which can fit our allocation, but in order
to respect the alignment properties the allocated range starts one byte after the start of the candidate node.
In this case we try to add back an InnerNode of size 1.
This should work, but the constructor of RangeInclusive fails due to this check which is meant to check
for ranges bigger than u64::MAX + 1.
MRE:
use vm_allocator::{AddressAllocator,AllocPolicy};fnmain(){letmut allocator = AddressAllocator::new(1,1000).unwrap();//This should return us range [2,11] let addr = allocator.allocate(10,2,AllocPolicy::FirstMatch)// but it will fail because internally the allocator which will try to// create a Node with Range [1,1] which will fail.unwrap();println!("Allocated address: {}", addr.start());}
Above will fail with:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidRange(1, 1)', src/main.rs:9:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The text was updated successfully, but these errors were encountered:
I came across a bug which manifests when allocating with an alignment other than 0.
The problem manifests when we get a candidate range which can fit our allocation, but in order
to respect the alignment properties the allocated range starts one byte after the start of the candidate node.
In this case we try to add back an
InnerNode
of size 1.This should work, but the constructor of
RangeInclusive
fails due to this check which is meant to checkfor ranges bigger than
u64::MAX + 1
.MRE:
Above will fail with:
The text was updated successfully, but these errors were encountered: