Skip to content

IsolatedPinset drop may delete staging TempDir while open_ipfs reads from it #268

@lthibault

Description

@lthibault

Problem

When IsolatedPinset is dropped, Rust drops fields in declaration order. The TempDir field's drop deletes the staging directory. If any in-progress open_ipfs calls are still reading from that staging directory (the guest has an open fd), those reads could fail or see deleted files.

Additionally, the spawned background unpin tasks from Drop could race with TempDir deletion if staging cleanup is added (see #266).

Fix

Use Arc<TempDir> or convert via TempDir::into_path() with an Arc<PathBuf> so the staging dir survives until all references are dropped. Alternatively, ensure all guest fds are closed before the IsolatedPinset drops (process exit ordering).

Context

Found by adversarial review on #263. Low severity in practice since IsolatedPinset drops at process exit when all guest fds are already closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — planned improvementenhancementNew feature or requesttrack:ipfs-cacheIPFS cache + filesystem interceptor track

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions