[slurm-dev] Problem with "srun --gid=group_name" option

Skip to first unread message

Don.A...@bull.com

unread,
Aug 12, 2008, 4:17:45 PM8/12/08
to slur...@lists.llnl.gov

The srun man page has the following for option "--gid":

   --gid=group
          If srun is run as root, and the --gid option is used, submit the
          job  with  group's  group  access permissions.  group may be the
          group name or the numerical group ID.

The option does not appear to work. The group_name entered in the
"--gid=group_name" option is passed to the slurmd daemon, but is not
being used when the slurmstepd program sets the uid and gid for the
tasks. For example, running as root:

    root> srun --gid=slurm id
    uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon)

It appears that the gid sent in the slurm message structure is
validated in routine _valid_gid, but not copied to the "pw_gid"
variable in the job structure from which the "effective gid" is set
when the task is launched.  I have added code to the slurmstepd_job.c
routine to do this.  Here is an example of the operation after the
change:

    root> srun --gid slurm id
    uid=0(root) gid=0(root) egid=200(slurm) groups=0(root),1(bin),2(daemon)

The following proposed patch is against SLURM 1.3.2.

Index: slurmstepd/slurmstepd_job.c
===================================================================
RCS file: /cvsroot/slurm/slurm/src/slurmd/slurmstepd/slurmstepd_job.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 slurmstepd_job.c
--- slurmstepd/slurmstepd_job.c 14 Sep 2006 00:08:35 -0000      1.1.1.3
+++ slurmstepd/slurmstepd_job.c 12 Aug 2008 15:18:15 -0000
@@ -121,11 +121,14 @@
        }

        /* Allow user root to use any valid gid */
-       if (pwd->pw_uid == 0)
+       if (pwd->pw_uid == 0) {
+               pwd->pw_gid = *gid;
                return 1;
+       }

        for (i = 0; grp->gr_mem[i]; i++) {
                if (strcmp(pwd->pw_name,grp->gr_mem[i]) == 0) {
+                       pwd->pw_gid = *gid;
                        return 1;
                }
        }

Danny Auble

unread,
Aug 14, 2008, 3:25:28 PM8/14/08
to slur...@lists.llnl.gov
Don, this works perfectly. Thanks for sending in the patch it will be in the next release.

Danny

Reply all
Reply to author
Forward
0 new messages