Skip to content

Make Linux read_maps handle large /proc/self/maps output #1328

Description

@wdcui

LinuxUserland::read_maps reads /proc/self/maps into a fixed 8 KiB buffer and panics with buffer too small when the file reaches that limit. This caused the litebox_runner_linux_userland::run::brokered_getrandom test to fail in PR #1327 (failed job); the failed job passed on rerun without code changes.

The failure is timing-dependent in in-process runner mode. The runner establishes the broker association before Platform::new, while the broker concurrently starts eight request workers, its readiness notifier, and transport threads. Their stack VMAs are added while read_maps snapshots the process mappings. A traced successful run read about 6.4 KiB while additional workers were still being created; CI scheduled enough thread creation before or during the read to fill the 8 KiB buffer. Repeated targeted local runs passed, confirming the threshold race.

Replace the fixed-size read with an EOF-driven implementation that handles allocation failure explicitly. The fix should also account for the existing stale-snapshot TODO: allocations and mappings created during or after the read may be omitted, so the implementation and tests should avoid implying a stronger reservation guarantee than the platform actually provides.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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