Skip to content

Pinning bumpalo::boxed::Box is unsound #186

Open
@Lej77

Description

A pinned bumpalo::boxed::Box might not uphold Pin's Drop guarantee. Specifically if a pinned bumpalo::boxed::Box is forgotten then the memory backing it might still be freed. (This differs from how std::boxed::Box is implemented.)

To soundly give out pinned references from a Bump one could keep a counter of the number of pinned allocations that still need to be freed and if that counter isn't zero when Bump is dropped then it could leak all of its memory. However decrementing this counter when a Box is dropped would require bumpalo::boxed::Box to store a reference to Bump which would double the Box's size (two pointers).

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions