[torquedev] [Bug 175] New: buffer overruns in cpuset.c

bugzilla-daemon at supercluster.org bugzilla-daemon at supercluster.org
Thu Apr 19 13:36:21 MDT 2012


           Summary: buffer overruns in cpuset.c
           Product: TORQUE
           Version: 3.0.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: blocker
          Priority: P5
         Component: pbs_mom
        AssignedTo: knielson at adaptivecomputing.com
        ReportedBy: siegert at sfu.ca
                CC: torquedev at supercluster.org
   Estimated Hours: 0.0

I am trying to get torque 3.0.4 working in a UV1000 system with 2048 cores.
There are buffer overruns in cpuset.c, add_cpus_to_jobset:
Both cpusbuf and memsbuf are allocated with a fixed length of MAXPATHLEN+1,
however, cpusbuf holds the list (comma separated) of cpus (cores), i.e., its
length must be (# of digits in Ncores + 1) * Ncores, where Ncores is the
number of cores in the system, e.g., for Ncores = 2048 the required length
is 10240; MAXPATHLEN is 1024.
The solution is something like:

char  *cpusbuf;
int len_Ncores = 2, cnt;
for (cnt = Ncores; cnt > 9; cnt /= 10) len_Ncores++;
cpusbuf = (char *)malloc(len_Ncores*Ncores*sizeof(char));

Similarly for memsbuf.
My problem right now is how do I get Ncores (and similarly Nmems) in
For now I can hardcode the length of 10240, but that is going to break as
soon as somebody tries to run on a machine with more than 2048 cores.

- Martin

Configure bugmail: http://www.clusterresources.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the torquedev mailing list