Make Linux read_maps handle large /proc/self/maps output
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.7k
- Forks
- 144
- Avg merge
- 12h 21m
- Merged PRs (30d)
- 146
Description
`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](https://github.com/microsoft/litebox/actions/runs/34246791132/job/102130959539)); 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at LinuxUserland::read_maps and the litebox_runner_linux_userland::run::brokered_getrandom test; review how Platform::new reaches the mapping snapshot. Confirm the implementation reads until EOF, handles allocation failure, and preserves the stale-snapshot limitation. Done means large /proc/self/maps output no longer triggers the fixed-buffer panic and the targeted test covers the behavior without implying a reservation guarantee.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, rust
- Domain
- operating-systems, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100