[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1.1-100-g76f4c56

Service Account noreply at mpich.org
Mon Jul 14 16:08:29 CDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  76f4c56e8ee67010a816291c9d45ccc745960a1e (commit)
       via  4efc8b2e54965ba79e634b6c93f91d7669644805 (commit)
       via  998a8a0bd9747847e37b03c9976bff4476d28324 (commit)
       via  1b016bb2d7463eb884e1a9dc478fd596b7303743 (commit)
      from  299bfd406a68b22ee0b14a10f60780d5acf30129 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/76f4c56e8ee67010a816291c9d45ccc745960a1e

commit 76f4c56e8ee67010a816291c9d45ccc745960a1e
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Mon Jul 14 12:46:05 2014 -0500

    Increase buffer size to cover longer cvar strings
    
    Signed-off-by: Sangmin Seo <sseo at anl.gov>

diff --git a/src/env/mpivars.c b/src/env/mpivars.c
index 772f8f5..080aedd 100644
--- a/src/env/mpivars.c
+++ b/src/env/mpivars.c
@@ -112,7 +112,7 @@ int PrintControlVars( FILE *fp )
 {
     int          i, num_cvar, nameLen, verbosity, descLen, binding, scope;
     int          hasValue;
-    char         name[MAX_NAME_LEN], desc[MAX_DESC_LEN], varValue[21];
+    char         name[MAX_NAME_LEN], desc[MAX_DESC_LEN], varValue[512];
     MPI_T_enum   enumtype;
     MPI_Datatype datatype;
 
@@ -166,7 +166,7 @@ int PrintPerfVars( FILE *fp )
 {
     int          i, numPvar, nameLen, descLen, verbosity, varClass;
     int          binding, isReadonly, isContinuous, isAtomic;
-    char         name[MAX_NAME_LEN], desc[MAX_DESC_LEN], varValue[21];
+    char         name[MAX_NAME_LEN], desc[MAX_DESC_LEN], varValue[512];
     MPI_T_enum   enumtype;
     MPI_Datatype datatype;
 

http://git.mpich.org/mpich.git/commitdiff/4efc8b2e54965ba79e634b6c93f91d7669644805

commit 4efc8b2e54965ba79e634b6c93f91d7669644805
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Mon Jul 14 10:56:12 2014 -0500

    Allocate mem. for a cvar when its type is MPI_CHAR
    
    https://svn.mpi-forum.org/trac/mpi-forum-web/ticket/405 says :
    "The use of the datatype MPI_CHAR in the MPI tool information interface implies a
    null-terminated character array, i.e. a string in the C language. If a variable has
    type MPI_CHAR, the value of the count parameter returned by MPI_T_CVAR_HANDLE_ALLOC
    and MPI_T_PVAR_HANDLE_ALLOC will include the null-terminating character."
    
    Unlike cvars of type MPI_INT etc, MPI_CHAR cvars need explicit memory allocation for their storage.
    Note: In MPI standard, MPI_CHAR is not in types of pvar.
    
    Fixes #2021
    
    Signed-off-by: Sangmin Seo <sseo at anl.gov>

diff --git a/src/mpi_t/mpit.c b/src/mpi_t/mpit.c
index 62f602c..d25ec93 100644
--- a/src/mpi_t/mpit.c
+++ b/src/mpi_t/mpit.c
@@ -315,7 +315,19 @@ void MPIR_T_CVAR_REGISTER_impl(
         cvar->datatype = dtype;
         cvar->name = MPIU_Strdup(name);
         MPIU_Assert(cvar->name);
-        cvar->addr = (void *)addr;
+        if (dtype != MPI_CHAR) {
+            cvar->addr = (void *)addr;
+        } else {
+            cvar->addr = MPIU_Malloc(count);
+            MPIU_Assert(cvar->addr);
+            if (defaultval.str == NULL) {
+                ((char *)(cvar->addr))[0] = '\0';
+            } else {
+                /* Use greater (>), since count includes the terminating '\0', but strlen does not */
+                MPIU_Assert(count > strlen(defaultval.str));
+                strcpy(cvar->addr, defaultval.str);
+            }
+        }
         cvar->count = count;
         cvar->verbosity = verb;
         cvar->bind = binding;
diff --git a/src/mpi_t/mpit_finalize.c b/src/mpi_t/mpit_finalize.c
index 5e2e1aa..5ef7a9e 100644
--- a/src/mpi_t/mpit_finalize.c
+++ b/src/mpi_t/mpit_finalize.c
@@ -102,6 +102,7 @@ static void MPIR_T_cvar_env_finalize(void)
             cvar = (cvar_table_entry_t *)utarray_eltptr(cvar_table, i);
             MPIU_Free((void *)cvar->name);
             MPIU_Free((void *)cvar->desc);
+            if (cvar->datatype == MPI_CHAR) MPIU_Free(cvar->addr);
         }
 
         /* Free pvar_table itself */

http://git.mpich.org/mpich.git/commitdiff/998a8a0bd9747847e37b03c9976bff4476d28324

commit 998a8a0bd9747847e37b03c9976bff4476d28324
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Mon Jul 14 10:51:47 2014 -0500

    Added assertion to protect cvars of type MPI_CHAR
    
    Make sure user buf wont overflow cvar which is a string
    
    Signed-off-by: Sangmin Seo <sseo at anl.gov>

diff --git a/src/mpi_t/cvar_write.c b/src/mpi_t/cvar_write.c
index 519f11f..b88959e 100644
--- a/src/mpi_t/cvar_write.c
+++ b/src/mpi_t/cvar_write.c
@@ -71,6 +71,7 @@ int MPIR_T_cvar_write_impl(MPI_T_cvar_handle handle, void *buf)
             ((double *)addr)[i] = ((double *)buf)[i];
         break;
     case MPI_CHAR:
+        MPIU_Assert(count > strlen(buf)); /* Make sure buf will not overflow this cvar */
         MPIU_Strncpy(addr, buf, count);
         break;
     default:

http://git.mpich.org/mpich.git/commitdiff/1b016bb2d7463eb884e1a9dc478fd596b7303743

commit 1b016bb2d7463eb884e1a9dc478fd596b7303743
Author: Junchao Zhang <jczhang at mcs.anl.gov>
Date:   Mon Jul 14 10:43:22 2014 -0500

    Set MPIR_CVAR_MAX_STRLEN to a smaller value
    
    The old value (4096) was arbitrarily chosen. To save memory and to make cvar
    tests cover the MPI_CHAR case easily, we set it to a smaller value, which is
    still big enough to hold reasonable cvar strings.
    
    Signed-off-by: Sangmin Seo <sseo at anl.gov>

diff --git a/maint/extractcvars.in b/maint/extractcvars.in
index e95e393..bb2eca3 100755
--- a/maint/extractcvars.in
+++ b/maint/extractcvars.in
@@ -173,7 +173,7 @@ print OUTPUT_H <<EOT;
 #define ${ns}_assert MPIU_Assert
 
 /* Arbitrary, simplifies interaction with external interfaces like MPI_T_ */
-#define ${uc_ns}_MAX_STRLEN (4096)
+#define ${uc_ns}_MAX_STRLEN (384)
 
 #endif /* $hdr_guard */
 EOT

-----------------------------------------------------------------------

Summary of changes:
 maint/extractcvars.in     |    2 +-
 src/env/mpivars.c         |    4 ++--
 src/mpi_t/cvar_write.c    |    1 +
 src/mpi_t/mpit.c          |   14 +++++++++++++-
 src/mpi_t/mpit_finalize.c |    1 +
 5 files changed, 18 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list