Skip to content

Filesystem operations cannot target workload mount namespaces #829

Description

@recrack

Filesystem operations are currently resolved by vminitd in its own mount namespace. This works for paths visible there, but it cannot address mounts that exist only in a workload container's mount namespace, including block-backed mounts attached by the OCI runtime.

This prevents callers such as apple/container's clean implementation from trimming named volumes through the existing filesystem-operation API.

A safe implementation needs to carry workload identity through the RPC and resolve the target through the managed init process. It must not concatenate an untrusted path with /proc/<pid>/root or re-resolve a numeric PID at operation time because that would introduce traversal, procfs magic-link, and PID-reuse risks.

The proposed implementation:

  • adds an optional container identifier to FilesystemOperationRequest
  • validates canonical container-absolute paths on both sides
  • pins the init process /proc/<pid> descriptor at process start
  • resolves targets with openat2(RESOLVE_IN_ROOT | RESOLVE_NO_MAGICLINKS)
  • preserves the legacy operation path for callers that intentionally target the vminitd namespace

Related to apple/container#1763 and apple/container#1949.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions