[mpich-devel] uninit status_static_array

Daniel Ibanez dan.a.ibanez at gmail.com
Sat Jan 9 19:14:49 CST 2016


Well, here is what I think is a legitimate fix based on the MPICH 3.2
tarball,
to the file src/mpi/coll/helper_fns.c


--- helper_fns_old.c 2016-01-09 19:21:21.000000000 -0500
+++ helper_fns.c 2016-01-09 19:22:19.000000000 -0500
@@ -760,6 +760,8 @@
         to check for the error bit in the tag below, we should initialize
all
         tag fields here. */
         status_array[i].MPI_TAG = 0;
+        /* Same as above for MPI_SOURCE */
+        status_array[i].MPI_SOURCE = MPI_PROC_NULL;

         /* Convert the MPID_Request objects to MPI_Request objects */
         request_ptrs[i] = requests[i]->handle;


Seems like the MPID refactoring introduced both the status_static_array
optimization and properly caught the uninitialized MPI_TAG:

https://github.com/jeffhammond/mpich/commit/54362c008ee413b40d5e4f654b72ee45091f1c33#diff-068b13839481e0ca992aee507263aa37R720

Then subsequent continuations of that work added MPI_SOURCE
as something that is checked but didn't go back and initialize it:

https://github.com/jeffhammond/mpich/commit/9a1ae5a841cd9cc5b2d258aa52fe1cb7ade4f498#diff-d340830666b4a17d656744365b99dcf3R4562

Apologies for the lack of version control coherence,
I'm not sure what the optimal way is to propose changes.

Please let me know if you can apply this patch.

Thanks

On Sat, Jan 9, 2016 at 10:18 AM, Daniel Ibanez <dan.a.ibanez at gmail.com>
wrote:

> Hello,
>
> Using MPICH 3.2, I get the following from Valgrind:
>
> ==80605== Conditional jump or move depends on uninitialised value(s)
> ==80605==    at 0x100198C14: MPIC_Waitall (mpiimpl.h:4394)
> ==80605==    by 0x100061D82: MPI_Dist_graph_create (dist_gr_create.c:380)
> ==80605==    by 0x100000EC5: main (uninit.c:21)
> ==80605==  Uninitialised value was created by a stack allocation
> ==80605==    at 0x100198ADD: MPIC_Waitall (helper_fns.c:735)
>
> When I run this program with 2 ranks:
>
> int main(int argc, char** argv)
> {
>   MPI_Init(&argc, &argv);
>   int n[2] = {1,1};
>   int sources[2] = {0,1};
>   int degrees[2] = {0,2};
>   int destinations_1[2] = {0,1};
>   int* destinations[2] = {0, destinations_1};
>   int weights_1[2] = {1,1};
>   int* weights[2] = {0, weights_1};
>   int rank;
>   MPI_Comm_rank(MPI_COMM_WORLD, &rank);
>   MPI_Comm new_comm;
>   MPI_Dist_graph_create(MPI_COMM_WORLD, n[rank], &sources[rank],
>       &degrees[rank], destinations[rank], weights[rank],
>       MPI_INFO_NULL, 0, &new_comm);
>   MPI_Comm_free(&new_comm);
>   MPI_Finalize();
> }
>
> It seems to come from the status_static_array at
> src/mpi/coll/helper_fns.c:740
>
> It looks like status->MPI_SOURCE, when checked by MPIR_Process_status at
> src/include/mpiimpl.h:4394
> might not be initialized by MPIR_Waitall_impl
> (I checked the other things used in that if statement and I'm
> pretty sure its MPI_SOURCE).
> I had a hard time tracing through the code further than that though.
>
> I just switched from MPICH 3.1.4 and this didn't show up in that version.
> I tend to like MPICH for its lack of Valgrind issues,
> so let me know how I can help get this fixed.
>
> Thank you,
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/devel/attachments/20160109/06587dc8/attachment.html>


More information about the devel mailing list