Add UID/GID enforcement, pids.max, and OOM isolation (#99 PR 1/6)#100
Merged
Add UID/GID enforcement, pids.max, and OOM isolation (#99 PR 1/6)#100
Conversation
First step toward bare-metal job isolation. Three changes to the executor's cgroup and process setup: 1. **setuid/setgid**: Jobs run as the submitting user's UID/GID instead of root. Uses Command::uid()/gid() when spurd runs as root. Non-root spurd gracefully skips (current behavior preserved). 2. **pids.max**: Limits total processes per job cgroup to prevent fork bombs. Set to max(cpus * 256, 1024). 3. **memory.oom.group**: Kills entire job cgroup on OOM instead of a random process. Prevents partial job survival with corrupted state. These work with both bare-metal and container (Enroot-like) execution paths since cgroup setup happens before process spawn in both cases. Closes: part of #99 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
shiv-tyagi
reviewed
Apr 18, 2026
Comment on lines
+286
to
+291
| if uid > 0 && nix::unistd::geteuid().is_root() { | ||
| use std::os::unix::process::CommandExt; | ||
| cmd.uid(uid); | ||
| cmd.gid(gid); | ||
| debug!(job_id, uid, gid, "job will run as non-root user"); | ||
| } |
Member
There was a problem hiding this comment.
Should we also log a warning for spurd running as non-root user case that setuid and setgid cannot be performed?
Member
|
Posted a doubt around gpu node permissions in #102. |
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First PR in the bare-metal job isolation series (#99). Adds three foundational cgroup + process controls.
Changes
Command::uid()/gid()when spurd is root; graceful skip otherwise.max(cpus*256, 1024).Works with both bare-metal and container (Enroot-like) paths — cgroup setup happens before process spawn in both cases.
Isolation series roadmap
Test plan
:(){ :|:& };:→ pids.max kills cgroup🤖 Generated with Claude Code