[svsm-devel] Fallible allocations and smart pointers

Jörg Rödel joro at 8bytes.org
Fri Dec 1 17:31:50 CET 2023


Hi Carlos,

On Thu, Nov 30, 2023 at 01:20:42PM +0100, Carlos López wrote:
> 1. Bring our own implementation from scratch: costly and error-prone.
> 2. fallible-alloc crate [2]: only provides `Box` and `Vec`, so we
>    would need to build the remaining types (for example the upstream
>    alloc crate builds `Arc` and `Rc` out of `Box`, and so on). Costly,
>    but less so than a completely from-scratch implementation.
> 3. fallible-collections crate [3]: supports `Box`, `Vec`, `Rc` and
>    `HashMap`, but not `Arc` (it is listed as deprecated [4], and I
>    suspect the root issue might also affect `Rc`). Same issues as
>    point #2.
> 4. Linux kernel model (copy a subset of the upstream alloc files):
>    requires maintenance to keep up with upstream, and likely means
>    only supporting a specific version of the toolchain (see [5]).

Which of these options would give us the API most similar to the
unstable allocator API? At some point, when the unstable allocator API
becomes stable, we want to switch over with minimal impact.

As another option besides the one you listed, can we import a copy
of the unstable Rust API into the SVSM code-base until it becomes
stable?

Regards,

	Joerg


More information about the Svsm-devel mailing list