Conversation
There was a problem hiding this comment.
In the test plan, we should also verify if a job process running under a non-root uid and gid is correctly able to access the gpu device nodes.
The gpu nodes are restricted to video and render groups, we are setting uid and gid for the process, which doesn't seem to inherit supplementary groups of the user running the commands. I suspect that might lead to GPUs not being accessible to the process.
|
Good catch @shiv-tyagi — you're right that I'll update PR #100 (setuid PR) to call Updated test plan for this PR:
Will add |
…PR 2/6) Jobs now run in isolated PID and mount namespaces (when spurd is root): - PID namespace: jobs see only their own processes - Mount namespace: private /tmp, /dev/shm; GPU /dev/dri restricted to allocated devices via selective bind-mount - Container path: added --pid --fork to existing unshare --mount - TrackedJob: has_pid_namespace flag for correct nsenter in exec_in_job Non-root fallback: skip namespaces, current behavior preserved. Closes: part of #99 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a3b0f99 to
554987b
Compare
Submitted #107 to track this. |
Summary
Second PR in the isolation series (#99). Adds PID and mount namespace isolation for both bare-metal and container execution paths.
Changes
unshare --pid --fork— jobs see only their own processes/tmp,/dev/shmper job; GPU/dev/drirestricted to allocated devices via selective bind-mount--pid --forkto existingunshare --mountin container.rshas_pid_namespaceflag for correct nsenter behavior in exec_in_jobGPU access verification
renderD*devices bind-mounted into private/dev/dri/dev/kfdpreserved for AMD GPU accessAddresses
Test plan
ps auxshows only job processes (not host)ls /tmpis empty (private tmpfs, not host)ls /dev/dri/inside 1-GPU job shows only 1 renderD devicevideo/rendergroup can access/dev/kfdand/dev/dri/renderD*. PR Add UID/GID enforcement, pids.max, and OOM isolation (#99 PR 1/6) #100 needsinitgroups()to inherit supplementary groups — without it, setuid to a non-root UID losesvideo/rendergroup membership and GPU device access fails with EACCES.nsenter --mount --pidenters correct namespacesps auxinside container shows only container processeswhocommand inside job: only shows current session (not host users)hipGetDeviceCountreturns correct count inside namespaceNote on supplementary groups
As @shiv-tyagi pointed out,
Command::uid().gid()sets primary UID/GID but does NOT set supplementary groups. GPU devices are typicallyroot:videoorroot:render. PR #100 (setuid PR) needs to callinitgroups(username, gid)inpre_execto ensure the job process inheritsvideo,render, and other groups. Without this, GPU access will fail for non-root users.🤖 Generated with Claude Code