It looks like the answer is "no", Jeff - at least, that didn't solve it for folks on the bug tracker cited by George. Setting the CFLAGS seemed the only solution until valgrind resolves the issue, and since that bug is a couple of years old with no further activity, it seems unlikely that will happen.
Note that this only impacts valgrind, not actual operation. Hence, I'm inclined to add the CFLAG recommendation to our valgrind FAQ and leave it at that for now as I'm not sure how else we can resolve the problem - getting all our strdup's to align on 4-byte boundaries would be an impossible task.
On May 22, 2014, at 3:37 AM, Jeff Squyres (jsquyres) <jsquyres_at_[hidden]> wrote:
> Would a better solution be something like:
> char default_credential = "12345";
> char *bar = strdup(default_credential)
> On May 22, 2014, at 12:52 AM, George Bosilca <bosilca_at_[hidden]> wrote:
>> This is more subtle that described here. It's a vectorization problem
>> and frankly it should appear on all loop-based string operations and
>> for most compilers (confirmed with gcc, clang and icc). The proposed
>> patch is merely a band-aid ...
>> More info @ https://bugs.launchpad.net/ubuntu/+source/valgrind/+bug/852760.
>> A better fix for this issue will be to add "-fno-builtin-strdup" to
>> your CFLAGS when compiling Open MPI.
>> On Wed, May 21, 2014 at 5:34 PM, Ralph Castain <rhc_at_[hidden]> wrote:
>>> 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:
>>>> 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.
>>>> users mailing list
>>> users mailing list
>> users mailing list
> Jeff Squyres
> For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
> users mailing list