I'm torn on this one. On the one hand, I think this is probably the most performant solution. On the other hand, it feels icky; a more clean solution would be to use hdr->type to determine the size to copy. What do others think?
Brian On 10/17/12 9:06 PM, "Kawashima, Takahiro" <t-kawash...@jp.fujitsu.com> wrote: >Hi Open MPI developers, > >I found another issue in Open MPI. > >In MCA_PML_OB1_RECV_FRAG_INIT macro in ompi/mca/pml/ob1/pml_ob1_recvfrag.h >file, we copy a PML header from an arrived message to another buffer, >as follows: > > frag->hdr = *(mca_pml_ob1_hdr_t*)hdr; > >On this copy, we cast hdr to mca_pml_ob1_hdr_t, which is a union >of all actual header structs such as mca_pml_ob1_match_hdr_t. >This means we copy the buffer of the size of the largest header >even if the arrived message is smaller than it. This can cause >SEGV if the arrived message is small and it is laid on the bottom >of the page. Actually, my tofu BTL, the BTL component of Fujitsu >MPI for K computer, suffered from this. > >The attached patch will be one of possible fixes for this issue. >This fix assume that the arrived header has at least segs[0].seg_len >bytes. This is always true for current Open MPI code because hdr >equals to segs[0].seg_addr.pval. There may exist a smarter fix. > >Regards, > >Takahiro Kawashima, >MPI development team, >Fujitsu > -- Brian W. Barrett Scalable System Software Group Sandia National Laboratories