Skip to content

Add sandbox-wide guest rlimits#1

Open
enricoschaaf wants to merge 5 commits intomainfrom
baseline-guest-rlimit
Open

Add sandbox-wide guest rlimits#1
enricoschaaf wants to merge 5 commits intomainfrom
baseline-guest-rlimit

Conversation

@enricoschaaf
Copy link
Copy Markdown
Collaborator

@enricoschaaf enricoschaaf commented Apr 3, 2026

Summary

This adds sandbox-wide guest rlimits that are applied by agentd PID 1 during guest startup.

Today microsandbox only supports per-exec rlimits. That is too late for bootstrap scripts and long-lived daemons started during guest init, because they inherit PID 1's baseline limits before any per-exec override runs.

What changed

  • adds sandbox-wide SandboxConfig::rlimits
  • adds SandboxBuilder::rlimit(...) and SandboxBuilder::rlimit_range(...)
  • passes sandbox-wide rlimits into the guest via MSB_RLIMITS
  • applies those limits in agentd before the rest of init runs
  • keeps per-exec rlimits available so one-off execs can still override the baseline

Why this shape

This fixes the real problem for bootstrap daemons and long-lived guest services instead of requiring every process to opt into a higher limit individually.

Validation

  • cargo test --manifest-path /tmp/msb-baseline/crates/agentd/Cargo.toml --lib
  • cargo test --manifest-path /tmp/msb-baseline/crates/microsandbox/Cargo.toml --lib

@enricoschaaf enricoschaaf changed the title Add sandbox-wide default guest rlimits Add sandbox-wide guest rlimits Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant