[Mauiusers] Buffer overrun bug in latest maui (3.2.6p16-snap.1161376679)

Josh Butikofer josh at clusterresources.com
Mon Oct 23 10:42:13 MDT 2006


Ake,

These fixes, and others that resolved issues created by the changes, are included in the snapshot: 
maui-3.2.6p16-snap.1161621752.tar.gz.

Thanks,

-- 
Joshua Butikofer
Cluster Resources, Inc.

josh at clusterresources.com
Voice: (801) 717-3707
Fax:   (801) 717-3738
--------------------------


Åke Sandgren wrote:
> Hi!
> Almost immediately on starting the newest maui we where hit by a buffer
> overrun.
> 
> Attached patch fixes the problem and hopefully doesn't destroy anything.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> diff -ru site/include/moab-proto.h x86_deb30/include/moab-proto.h
> --- site/include/moab-proto.h	2006-10-20 22:37:59.000000000 +0200
> +++ x86_deb30/include/moab-proto.h	2006-10-23 11:34:10.000000000 +0200
> @@ -405,7 +405,7 @@
>  int MJobDistributeTasks(mjob_t *,mrm_t *,mnalloc_t *,short *);
>  int MJobTrap(mjob_t *);
>  char *MJobGetName(mjob_t *,char *,mrm_t *,char *,int,enum MJobNameEnum);
> -int MJobGetStartPriority(mjob_t *,int,double *,int,char *);
> +int MJobGetStartPriority(mjob_t *,int,double *,int,char **, int *);
>  int MJobGetRunPriority(mjob_t *,int,double *,char *);
>  int MJobGetBackfillPriority(mjob_t *,unsigned long,int,double *,char *);
>  int MJobGetPartitionAccess(mjob_t *);
> diff -ru site/src/moab/MPriority.c x86_deb30/src/moab/MPriority.c
> --- site/src/moab/MPriority.c	2006-10-21 19:27:39.000000000 +0200
> +++ x86_deb30/src/moab/MPriority.c	2006-10-23 14:01:04.000000000 +0200
> @@ -109,7 +109,7 @@
>  */
>          
>  /* Contains:                                  *
> - *   int MJobGetStartPriority(J,PIndex,Priority,Buffer) *
> + *   int MJobGetStartPriority(J,PIndex,Priority,Bptr,BSpace) *
>   *   int __MJobStartPrioComp(a,b)             *
>   *                                            */
>  
> @@ -140,7 +140,8 @@
>    int     PIndex,   /* I */
>    double *Priority, /* O */
>    int     Mode,     /* I */
> -  char   *Buffer)   /* O (optional,minsize=MMAX_BUFFER) */
> +  char   **BPtr, /* O (optional,minsize=MMAX_BUFFER) */
> +  int *BSpace)   /* O (optional) */
>  
>    {
>    double        Prio;
> @@ -203,9 +204,6 @@
>  
>    unsigned long MinWCLimit;
>  
> -  char         *BPtr;
> -  int           BSpace;
> -
>    const char *FName = "MJobGetStartPriority";
>  
>    DBG(6,fSCHED) DPrint("%s(%s,%d,%s,%s)\n",
> @@ -213,7 +211,7 @@
>      (J != NULL) ? J->Name : "[NONE]",
>      PIndex,
>      (Priority != NULL) ? "Priority" : "NULL",
> -    (Buffer != NULL) ? "Buffer" : "NULL");
> +    (BPtr != NULL && *BPtr != NULL) ? "Buffer" : "NULL");
>  
>    /* NOTE:  NULL 'J' allowed */
>  
> @@ -226,7 +224,7 @@
>  
>    if (X.XJobGetStartPriority != (int (*)())0)
>      {
> -    return((*X.XJobGetStartPriority)(X.xd,J,Priority,Buffer));
> +    return((*X.XJobGetStartPriority)(X.xd,J,Priority,*BPtr));
>      }
>  
>    for (index = 1;index < MAX_MPRIOCOMPONENT;index++)
> @@ -594,9 +592,7 @@
>          }
>        }    /* END if (CWeight[mpcUsage] != 0) */
>  
> -    MUSNInit(&BPtr,&BSpace,Buffer,MMAX_BUFFER);
> -
> -    MUSNPrintF(&BPtr,&BSpace,"%-20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n",
> +    MUSNPrintF(BPtr,BSpace,"%-20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n",
>        "Job",
>        "PRIORITY",
>        '*',
> @@ -615,7 +611,7 @@
>        (int)strlen(CHeader[mpcUsage]),
>        CHeader[mpcUsage]);
>  
> -    MUSNPrintF(&BPtr,&BSpace,"%20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n",
> +    MUSNPrintF(BPtr,BSpace,"%20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n",
>        "Weights",
>        "--------",
>        ' ',
> @@ -634,7 +630,7 @@
>        (int)strlen(CWLine[mpcUsage]),
>        CWLine[mpcUsage]);
>  
> -    MUSNPrintF(&BPtr,&BSpace,"\n");
> +    MUSNPrintF(BPtr,BSpace,"\n");
>  
>      DBG(5,fUI) DPrint("INFO:     %s header created\n",
>        FName);
> @@ -747,9 +743,9 @@
>          }
>        }    /* END for (cindex) */
>  
> -    MUSNPrintF(&BPtr,&BSpace,"\n");
> +    MUSNPrintF(BPtr,BSpace,"\n");
>  
> -    MUSNPrintF(&BPtr,&BSpace,"%-20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n",
> +    MUSNPrintF(BPtr,BSpace,"%-20s %10s%c %*s%*s%*s%*s%*s%*s%*s\n",
>        "Percent Contribution",
>        "--------",
>        ' ',
> @@ -768,9 +764,9 @@
>        (int)strlen(CFooter[mpcUsage]),
>        CFooter[mpcUsage]);
>  
> -    MUSNPrintF(&BPtr,&BSpace,"\n");
> +    MUSNPrintF(BPtr,BSpace,"\n");
>  
> -    MUSNPrintF(&BPtr,&BSpace,"* indicates system prio set on job\n");
> +    MUSNPrintF(BPtr,BSpace,"* indicates system prio set on job\n");
>  
>      return(SUCCESS);
>      }  /* END if (Mode == 2) */
> @@ -1223,7 +1219,7 @@
>      APrio += ABS((double)CWeight[index] * CFactor[index]);
>      }  /* END for (index) */
>  
> -  if (Buffer != NULL)
> +  if (BPtr != NULL && *BPtr != NULL)
>      {
>      TotalPriority += APrio;
>  
> @@ -1496,7 +1492,7 @@
>          }
>        }    /* END if (CWeight[mpcUsage] != 0) */
>  
> -    MUSNPrintF(&BPtr,&BSpace,"%-20s %10.0lf%c %*s%*s%*s%*s%*s%*s%*s\n",
> +    MUSNPrintF(BPtr,BSpace,"%-20s %10.0lf%c %*s%*s%*s%*s%*s%*s%*s\n",
>        J->Name,
>        Prio,
>        (J->SystemPrio > 0) ? '*' : ' ',
> @@ -1514,7 +1510,7 @@
>        CLine[mpcRes],
>        (int)strlen(CLine[mpcUsage]),
>        CLine[mpcUsage]);
> -    } /* END if (Buffer != NULL) */
> +    } /* END if (BPtr != NULL) */
>  
>    /* clip prio at min value */
>  
> diff -ru site/src/moab/MQueue.c x86_deb30/src/moab/MQueue.c
> --- site/src/moab/MQueue.c	2006-10-21 19:27:39.000000000 +0200
> +++ x86_deb30/src/moab/MQueue.c	2006-10-23 14:00:27.000000000 +0200
> @@ -199,7 +199,7 @@
>        {
>        J = MJob[JobIndex[jindex]];
>  
> -      MJobGetStartPriority(J,0,&tmpD,0,NULL);
> +      MJobGetStartPriority(J,0,&tmpD,0,NULL,NULL);
>   
>        J->StartPriority = (unsigned long)tmpD;
>  
> @@ -221,7 +221,7 @@
>  
>      for (J = Q[0]->Next;J != Q[0];J = J->Next)
>        {
> -      MJobGetStartPriority(J,0,&tmpD,0,NULL);
> +      MJobGetStartPriority(J,0,&tmpD,0,NULL,NULL);
>  
>        J->StartPriority = (unsigned long)tmpD;
>  
> diff -ru site/src/server/UserI.c x86_deb30/src/server/UserI.c
> --- site/src/server/UserI.c	2006-10-21 19:27:39.000000000 +0200
> +++ x86_deb30/src/server/UserI.c	2006-10-23 12:30:11.000000000 +0200
> @@ -5186,6 +5186,8 @@
>    double tmpD;
>   
>    mjob_t *J;
> +  char *BPtr;
> +  int BSpace;
>   
>    const char *FName = "UIDiagnosePriority";
>   
> @@ -5193,14 +5195,14 @@
>      FName,
>      (P != NULL) ? P->Name : "NULL");
>   
> -  Buffer[0] = '\0';
> +  MUSNInit(&BPtr,&BSpace,Buffer,(int)*BufSize);
>   
> -  sprintf(Buffer,"diagnosing job priority information (partition: %s)\n\n",
> +  MUSNPrintF(&BPtr, &BSpace, "diagnosing job priority information (partition: %s)\n\n",
>      P->Name);
>   
>    /* initialize priority statistics */
>   
> -  MJobGetStartPriority(NULL,P->Index,NULL,1,Buffer);
> +  MJobGetStartPriority(NULL,P->Index,NULL,1,&BPtr, &BSpace);
>   
>    JobCount = 0;
>   
> @@ -5214,7 +5216,7 @@
>      DBG(5,fUI) DPrint("INFO:     diagnosing priority for job '%s'\n",
>        J->Name);
>   
> -    MJobGetStartPriority(J,P->Index,&tmpD,0,Buffer); 
> +    MJobGetStartPriority(J,P->Index,&tmpD,0,&BPtr, &BSpace); 
>   
>      J->StartPriority = (long)tmpD;
>   
> @@ -5223,7 +5225,7 @@
>   
>    if (JobCount > 0)
>      {
> -    MJobGetStartPriority(NULL,P->Index,NULL,2,Buffer);
> +    MJobGetStartPriority(NULL,P->Index,NULL,2,&BPtr, &BSpace);
>      }
>    else
>      {
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> mauiusers mailing list
> mauiusers at supercluster.org
> http://www.supercluster.org/mailman/listinfo/mauiusers


More information about the mauiusers mailing list