From 29f02d88c69259afbdc8c9d3f48d2a41f18933e8 Mon Sep 17 00:00:00 2001 From: Matthias Jurenz Date: Fri, 30 Apr 2010 10:04:26 +0000 Subject: [PATCH] - fixed buffer overflow which occurred if marker or event comment records generated - fixed bug in MPI-I/O tracing: tracking MPI file handles even if MPI_File_open isn't recorded - fixed compiler warnings in the PAPI component - incremented version number to 5.8.2 This commit was SVN r23074. --- ompi/contrib/vt/vt/ChangeLog | 6 +++ ompi/contrib/vt/vt/VERSION | 2 +- ompi/contrib/vt/vt/doc/UserManual.html | 2 +- ompi/contrib/vt/vt/doc/UserManual.pdf | Bin 376896 -> 376896 bytes ompi/contrib/vt/vt/vtlib/vt_metric_papi.c | 50 +++++++++++++--------- ompi/contrib/vt/vt/vtlib/vt_mpiwrap.c | 5 ++- ompi/contrib/vt/vt/vtlib/vt_otf_gen.c | 32 +++++++------- 7 files changed, 59 insertions(+), 38 deletions(-) diff --git a/ompi/contrib/vt/vt/ChangeLog b/ompi/contrib/vt/vt/ChangeLog index 5ad98642d4..ab73b37337 100644 --- a/ompi/contrib/vt/vt/ChangeLog +++ b/ompi/contrib/vt/vt/ChangeLog @@ -1,3 +1,9 @@ +5.8.2openmpi + - fixed buffer overflow which occurred if marker or event comment + records generated + - fixed bug in MPI-I/O tracing: tracking MPI file handles even if + MPI_File_open isn't recorded + 5.8.1openmpi - updated version of internal OTF to 1.6.5openmpi (see extlib/otf/ChangeLog) diff --git a/ompi/contrib/vt/vt/VERSION b/ompi/contrib/vt/vt/VERSION index 5c5c533cf0..bf41f933fd 100644 --- a/ompi/contrib/vt/vt/VERSION +++ b/ompi/contrib/vt/vt/VERSION @@ -1 +1 @@ -5.8.1openmpi +5.8.2openmpi diff --git a/ompi/contrib/vt/vt/doc/UserManual.html b/ompi/contrib/vt/vt/doc/UserManual.html index 519cc7ef97..af707ab677 100644 --- a/ompi/contrib/vt/vt/doc/UserManual.html +++ b/ompi/contrib/vt/vt/doc/UserManual.html @@ -62,7 +62,7 @@ body {font-family: sans-serif;}

-VampirTrace 5.8.1 User Manual +VampirTrace 5.8.2 User Manual


diff --git a/ompi/contrib/vt/vt/doc/UserManual.pdf b/ompi/contrib/vt/vt/doc/UserManual.pdf index 8861ee84ac2f61d356298feab81c721d7f86d4e6..ed6434619b9089e498410898fa47f93d3283d8c9 100644 GIT binary patch delta 187 zcmX@mAby}he1o49)1n!Z1Eefj-po&qZ0?n6@0DT%VkRJF24a@&y;7{}k{FGq+tjj_ z@t7DJ7#f%wm>Ovt7){?-%PNi{vi)H#>wm`tBNszsCsStwCqp+^XD15_69Y3-H%CiL t3j;%A3nv33I|UnpN@5l4?6`_c5{pVIic-_KjLi%TOij2{RbBnvxB$M@Gs6G? delta 187 zcmX@mAby}he1o49lhW+T0aBJMuMZ_hH1|ri_ewDWF%u9o12N0?UMbdfNsNZmZE9J| zc#Mq949$$qjLfwS45#m_Wfeye+5WJW^}l0+nWd?Lxq*|pg@KEup^2lpqoskdv6F?V tnWedrfu)JDoq`QPC9w*2c3j0JiA5z9MX70A#%2ZvrY2mfs;>TSTmWP5GVTBX diff --git a/ompi/contrib/vt/vt/vtlib/vt_metric_papi.c b/ompi/contrib/vt/vt/vtlib/vt_metric_papi.c index 62586b32b2..a23b2a036c 100644 --- a/ompi/contrib/vt/vt/vtlib/vt_metric_papi.c +++ b/ompi/contrib/vt/vt/vtlib/vt_metric_papi.c @@ -66,18 +66,18 @@ struct metric uint32_t props; }; -typedef struct eventmap_t // we need an eventset for each component +typedef struct eventmap_t /* we need an eventset for each component */ { - int EventId; // eventset id - long_long Values[VT_METRIC_MAXNUM]; // return values for the eventsets - int nEvents; // number of recorded events in this set + int EventId; /* eventset id */ + long_long Values[VT_METRIC_MAXNUM]; /* return values for the eventsets */ + int nEvents; /* number of recorded events in this set */ int ComponentId; }eventmap_t; struct vt_metv { - struct eventmap_t * EventSet[VT_METRIC_MAXNUM]; // a struct for each active component - long_long * Values[VT_METRIC_MAXNUM]; // for each counter a pointer, that points to the eventsets return values + struct eventmap_t * EventSet[VT_METRIC_MAXNUM]; /* a struct for each active component */ + long_long * Values[VT_METRIC_MAXNUM]; /* for each counter a pointer, that points to the eventsets return values */ }; /* @@ -339,16 +339,17 @@ static void metric_test(void) EventSet[i] = NULL; for (i=0; i < nmetrics; i++) { #ifdef PAPIC - // Preset-counter belong to Component 0! + /* Preset-counter belong to Component 0! */ component = PAPI_COMPONENT_INDEX(metricv[i]->papi_code); #else component = 0; #endif + /* search for the eventset that matches the counter */ j=0; - while (EventSet[j]!=NULL && j < VT_METRIC_MAXNUM && EventSet[j]->ComponentId!=component){ // search for the eventset that matches the counter + while (EventSet[j]!=NULL && j < VT_METRIC_MAXNUM && EventSet[j]->ComponentId!=component){ j++; } - if (EventSet[j]==NULL) // create eventset, if no matching found + if (EventSet[j]==NULL) /* create eventset, if no matching found */ { EventSet[j] = malloc(sizeof(eventmap_t)); EventSet[j]->EventId=PAPI_NULL; @@ -366,7 +367,8 @@ static void metric_test(void) } vt_cntl_msg(2, "Event %s added to event set", metricv[i]->name); } - for (i=0; i < VT_METRIC_MAXNUM && EventSet[i]!=NULL; i++) // foreach used eventset + /* foreach used eventset */ + for (i=0; i < VT_METRIC_MAXNUM && EventSet[i]!=NULL; i++) { retval = PAPI_cleanup_eventset(EventSet[i]->EventId); if ( retval != PAPI_OK ) @@ -391,6 +393,7 @@ int vt_metric_open() int forceprop; PAPI_event_info_t info; metricmap_t* mapv = NULL; + metricmap_t* map; /* read environment variable "VT_METRICS". Return if uset and no PAPI timer used. */ @@ -431,7 +434,7 @@ int vt_metric_open() else forceprop=0; /* search metricmap for a suitable definition */ - metricmap_t* map = mapv; + map = mapv; /*printf("Token%d: <%s>\n", nmetrics, token);*/ while (map != NULL) { if ( strcmp(map->event_name, token) == 0 ) { @@ -535,24 +538,26 @@ struct vt_metv* vt_metric_create() metv = (struct vt_metv*)malloc(sizeof(struct vt_metv)); if ( metv == NULL ) vt_error(); - + /* create event set */ for (i=0; iEventSet[i] = NULL; - for (i=0; i < nmetrics; i++) { + struct eventmap_t *eventset; + #ifdef PAPIC component = PAPI_COMPONENT_INDEX(metricv[i]->papi_code); #else component = 0; #endif + /* search for the eventset that matches the counter */ j=0; - while (metv->EventSet[j]!=NULL && j < VT_METRIC_MAXNUM && metv->EventSet[j]->ComponentId!=component){ // search for the eventset that matches the counter + while (metv->EventSet[j]!=NULL && j < VT_METRIC_MAXNUM && metv->EventSet[j]->ComponentId!=component){ j++; } - if (metv->EventSet[j]==NULL) // no event of this component yet! + if (metv->EventSet[j]==NULL) /* no event of this component yet! */ { metv->EventSet[j] = (struct eventmap_t*)malloc(sizeof(eventmap_t)); metv->EventSet[j]->EventId=PAPI_NULL; @@ -562,17 +567,19 @@ struct vt_metv* vt_metric_create() metric_error(retval, "PAPI_create_eventset"); metv->EventSet[j]->ComponentId=component; } - struct eventmap_t *eventset = metv->EventSet[j]; + eventset = metv->EventSet[j]; /* add event to event set */ retval = PAPI_add_event(eventset->EventId, metricv[i]->papi_code); if ( retval != PAPI_OK ) metric_error(retval, "PAPI_add_event"); - metv->Values[i] = &(eventset->Values[eventset->nEvents]); // for demux the values from eventset -> returnvector + /* for demux the values from eventset -> returnvector */ + metv->Values[i] = &(eventset->Values[eventset->nEvents]); eventset->nEvents++; } - for (i=0; i < VT_METRIC_MAXNUM && metv->EventSet[i]!=NULL; i++) // foreach used eventset + /* foreach used eventset */ + for (i=0; i < VT_METRIC_MAXNUM && metv->EventSet[i]!=NULL; i++) { retval = PAPI_start(metv->EventSet[i]->EventId); if ( retval != PAPI_OK ) @@ -592,7 +599,8 @@ void vt_metric_free(struct vt_metv* metv) /* treat PAPI failures at this point as non-fatal */ - for (i=0; i < VT_METRIC_MAXNUM && metv->EventSet[i]!=NULL; i++) // foreach used eventset + /* foreach used eventset */ + for (i=0; i < VT_METRIC_MAXNUM && metv->EventSet[i]!=NULL; i++) { retval = PAPI_stop(metv->EventSet[i]->EventId, papi_vals); if ( retval != PAPI_OK ) { @@ -640,7 +648,9 @@ void vt_metric_read(struct vt_metv* metv, uint64_t offsets[], if ( metv == NULL ) return; - for (i=0; i < VT_METRIC_MAXNUM && metv->EventSet[i]!=NULL; i++) // foreach used eventset + + /* foreach used eventset */ + for (i=0; i < VT_METRIC_MAXNUM && metv->EventSet[i]!=NULL; i++) { retval = PAPI_read(metv->EventSet[i]->EventId, metv->EventSet[i]->Values ); if ( retval != PAPI_OK ) diff --git a/ompi/contrib/vt/vt/vtlib/vt_mpiwrap.c b/ompi/contrib/vt/vt/vtlib/vt_mpiwrap.c index e8c28d3785..3cda16043a 100644 --- a/ompi/contrib/vt/vt/vtlib/vt_mpiwrap.c +++ b/ompi/contrib/vt/vt/vtlib/vt_mpiwrap.c @@ -4201,15 +4201,18 @@ VT_MPI_INT MPI_File_open( MPI_Comm comm, if (IS_MPI_TRACE_ON) { + uint32_t fid; + MPIIO_ENTER_IO_W_HANDLE(VT__MPI_FILE_OPEN); CALL_PMPI_5(MPI_File_open, comm, filename, amode, info, fh, result, 0, was_recorded, &time); time = vt_pform_wtime(); + fid = vt_mpifile_create(*fh, filename); + if (was_recorded) { - uint32_t fid = vt_mpifile_create(*fh, filename); if (result == MPI_SUCCESS) { vt_ioend(&time, fid, handleid, VT_IOOP_OPEN, 0); diff --git a/ompi/contrib/vt/vt/vtlib/vt_otf_gen.c b/ompi/contrib/vt/vt/vtlib/vt_otf_gen.c index 1649ee5993..ae1eed0b34 100644 --- a/ompi/contrib/vt/vt/vtlib/vt_otf_gen.c +++ b/ompi/contrib/vt/vt/vtlib/vt_otf_gen.c @@ -40,28 +40,28 @@ if (gen == NULL) vt_error_msg("Abort: Uninitialized trace buffer") #define VTGEN_ALLOC_DEF(gen, bytes) \ - if ((uint64_t)(gen->buf->pos - gen->buf->mem) > \ - (uint64_t)(gen->buf->size - (bytes))) \ - VTGen_flush(gen, 0, vt_pform_wtime(), NULL); + if ((uint64_t)((gen)->buf->pos - (gen)->buf->mem) > \ + (uint64_t)((gen)->buf->size - (bytes))) \ + VTGen_flush((gen), 0, vt_pform_wtime(), NULL); #define VTGEN_ALLOC_EVENT(gen, bytes) \ - if ((uint64_t)(gen->buf->pos - gen->buf->mem) > \ - (uint64_t)(gen->buf->size - (bytes))) { \ - VTGen_flush(gen, 0, *time, time); \ - if(gen->flushcntr == 0) return; \ + if ((uint64_t)((gen)->buf->pos - (gen)->buf->mem) > \ + (uint64_t)((gen)->buf->size - (bytes))) { \ + VTGen_flush((gen), 0, *time, time); \ + if((gen)->flushcntr == 0) return; \ } #define VTGEN_ALIGN_LENGTH(bytes) \ - ( bytes % SIZEOF_VOIDP ) ? \ - ( bytes / SIZEOF_VOIDP + 1 ) * SIZEOF_VOIDP : bytes + ( (bytes) % SIZEOF_VOIDP ) ? \ + ( (bytes) / SIZEOF_VOIDP + 1 ) * SIZEOF_VOIDP : (bytes) #define VTGEN_JUMP(gen, bytes) \ - gen->buf->pos += length + gen->buf->pos += (bytes) -#define VTGEN_IS_TRACE_ON(gen) (gen->mode & VT_MODE_TRACE) != 0 -#define VTGEN_IS_SUM_ON(gen) (gen->mode & VT_MODE_STAT) != 0 +#define VTGEN_IS_TRACE_ON(gen) ((gen)->mode & VT_MODE_TRACE) != 0 +#define VTGEN_IS_SUM_ON(gen) ((gen)->mode & VT_MODE_STAT) != 0 #define VTGEN_IS_SUM_PROP_ON(gen, prop) \ - (VTGEN_IS_SUM_ON(gen) && (gen->sum_props & prop) != 0) + (VTGEN_IS_SUM_ON((gen)) && ((gen)->sum_props & (prop)) != 0) /* *----------------------------------------------------------------------------- @@ -1993,7 +1993,8 @@ void VTGen_write_COMMENT(VTGen* gen, uint64_t* time, VTBuf_Entry_Comment* new_entry; uint32_t length = - VTGEN_ALIGN_LENGTH(sizeof(VTBuf_Entry_Comment)); + VTGEN_ALIGN_LENGTH((sizeof(VTBuf_Entry_Comment) + + (strlen(comment) * sizeof(char)))); VTGEN_ALLOC_EVENT(gen, length); @@ -2020,7 +2021,8 @@ void VTGen_write_MARKER(VTGen* gen, uint64_t* time, uint32_t mid, VTBuf_Entry_Marker* new_entry; uint32_t length = - VTGEN_ALIGN_LENGTH(sizeof(VTBuf_Entry_Marker)); + VTGEN_ALIGN_LENGTH((sizeof(VTBuf_Entry_Marker) + + (strlen(mtext) * sizeof(char)))); VTGEN_ALLOC_EVENT(gen, length);