Skip to content

Set supplementary groups for non-root job processes (#107)#108

Merged
shiv-tyagi merged 1 commit intomainfrom
users/powderluv/fix-107-supplementary-groups
Apr 19, 2026
Merged

Set supplementary groups for non-root job processes (#107)#108
shiv-tyagi merged 1 commit intomainfrom
users/powderluv/fix-107-supplementary-groups

Conversation

@powderluv
Copy link
Copy Markdown
Collaborator

Summary

Fixes #107 — calls initgroups() in pre_exec so non-root job processes inherit supplementary groups (video, render, etc.) needed for GPU device access.

Problem

Command::uid().gid() only sets primary UID/GID. GPU devices are typically root:video or root:render. Without supplementary groups, non-root jobs get EACCES on /dev/dri and /dev/kfd.

Fix

Added libc::initgroups(username, gid) call in pre_exec before the process execs. This reads /etc/group and sets all supplementary groups the user belongs to.

Test plan

  • Submit job as non-root user → verify id shows video/render groups
  • Verify rocm-smi works inside non-root job
  • Verify stat /dev/kfd accessible inside non-root job
  • Compiles clean

🤖 Generated with Claude Code

Call initgroups() in pre_exec to inherit supplementary groups
(video, render, etc.) when running jobs as non-root users.
Without this, GPU device nodes (/dev/dri, /dev/kfd) are
inaccessible because they require video/render group membership.

Fixes #107

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@powderluv powderluv requested a review from shiv-tyagi April 19, 2026 08:19
Copy link
Copy Markdown
Member

@shiv-tyagi shiv-tyagi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @powderluv.

@shiv-tyagi shiv-tyagi merged commit a248fd5 into main Apr 19, 2026
6 checks passed
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.

Ensure GPU nodes permissions to job process when running as non root

2 participants