Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] False positive from valgrind in sec_basic.c
From: Ralph Castain (rhc_at_[hidden])
Date: 2014-05-21 20:34:53


Wow, that is hilarious. I see no problem with adding the extra characters :-)

Scheduled it for 1.8.2 (copied you on ticket)

On May 21, 2014, at 3:29 PM, W Spector <w6ws_at_[hidden]> wrote:

> Hi,
>
> When running under valgrind, I get warnings from each MPI process at MPI_Init time. The warnings come from function sec_basic.c at lines 70 and 71 (openmpi v1.8.1):
>
> my_cred.credential = strdup("12345");
> my_cred.size = strlen(my_cred.credential)+1; // include the NULL
>
> This is because strdup(3c) and strlen(3c) are apparently optimized to use 4-byte integer loads to speed up the copy and search operations, and "overrun" the malloced area. (In fact, since malloc tends to pad allocations, it is safe. But valgrind doesn't know that.)
>
> Since the "12345" appears to be a dummy string, would it be ok to add a couple of additional characters in the strdup call to:
>
> my_cred.credential = strdup("1234567");
>
> This gives an 8 byte string (counting the NULL) and quiets valgrind down.
>
> Walter
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users