<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">


<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C5CAA5.EE22A670">
<title>RE: [Openib-windows] [PATCH v2] Handle RMPP send payload < MAD buffer
length</title>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="time"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="date"/>
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:1627421319 -2147483648 8 0 66047 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        mso-style-noshow:yes;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:navy;}
span.SpellE
        {mso-style-name:"";
        mso-spl-e:yes;}
span.GramE
        {mso-style-name:"";
        mso-gram-e:yes;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */ 
 table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=EN-US link=blue vlink=blue style='tab-interval:.5in'>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I have looked at my suggested <span
class=GramE>fix,</span> and it obviously only makes things worse than before.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>It seems that the following fix might work
however:<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>        </span>CL_<span
class=GramE>ASSERT(</span> <span class=SpellE>h_send</span>-><span
class=SpellE>p_send_mad</span>->size != offset );<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>        </span><span
class=GramE>if(</span> (<span class=SpellE>h_send</span>-><span
class=SpellE>p_send_mad</span>->size - offset) < <span class=SpellE>max_len</span>)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>           
</span><span class=SpellE>max_len</span> = <span class=SpellE>h_send</span>-><span
class=SpellE>p_send_mad</span>->size - <span class=GramE>offset ;</span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'> </span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>        </span><span
class=SpellE>cl_<span class=GramE>memcpy</span></span><span class=GramE>(</span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><span
style='mso-spacerun:yes'>       </span><span
style='mso-spacerun:yes'>     </span><span
class=SpellE>p_rmpp_dst</span> + <span class=SpellE>hdr_len</span>, <span
class=SpellE>p_rmpp_src</span> + offset, <span class=SpellE>max_<span
class=GramE>len</span></span><span class=GramE> )</span>;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I hope this helps.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Tzachi<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>

<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>

<p class=MsoNormal><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> Tzachi Dar
[mailto:tzachid@mellanox.co.il<span class=GramE>] <br>
<b><span style='font-weight:bold'>Sent</span></b></span><b><span
style='font-weight:bold'>:</span></b> </span></font><st1:date Month="10" Day="6"
Year="2005"><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:
 Tahoma'>Thursday, October 06, 2005</span></font></st1:date><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> </span></font><st1:time
Hour="16" Minute="45"><font size=2 face=Tahoma><span style='font-size:10.0pt;
 font-family:Tahoma'>4:45 PM</span></font></st1:time><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'><br>
<b><span style='font-weight:bold'>To:</span></b> 'Fab Tillier';
openib-windows@openib.org<br>
<b><span style='font-weight:bold'>Subject:</span></b> RE: [Openib-windows]
[PATCH v2] Handle RMPP send payload < MAD bu ffer length</span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>Hi Fab,</span></font>
<o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>Please
add the patch also as an attachment to your mail, since Exchange seems to break
the text no meter what we do.</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>In any
case I have manually applied the patch and received a blue screen after a few
hours. (Actually I was receiving this even without your change from time to
time). </span></font><o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>I'm not
so familiar with rmpp, but I think that I know where the problem is:</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>Replace the line:</span></font> <br>
        <font size=2><span style='font-size:
10.0pt'>max_len = h_send->p_send_mad->size - offset;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>with </span></font><br>
        <font size=2><span style='font-size:
10.0pt'>max_len = h_send->p_send_mad->size - offset - hdr_len;</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>(of course I might be wrong here).</span></font>
<o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>I'll try
to run with this change and let you know if there are still problems. Please
note that as the problem is very hard to reproduce it will be hard to tell that
this is indeed a fix.</span></font><o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>Thanks</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>Tzachi</span></font> <o:p></o:p></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>More
info:</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>The line
that caused the problem was</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>      
cl_memcpy(</span></font> <br>
<font size=2><span style='font-size:10.0pt'>           
p_rmpp_dst + hdr_len, p_rmpp_src + hdr_len + offset, max_len );</span></font> <br>
        <font size=2><span style='font-size:
10.0pt'>}</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>The
immediate problem was in the source part - that is:</span></font> <br>
<font size=2><span style='font-size:10.0pt'>p_rmpp_src + hdr_len + offset +
max_len was crossing a page boundary and this page was not found. This
immediately caused a blue screen.</span></font><o:p></o:p></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>Some more
info:</span></font> <br>
<font size=2><span style='font-size:10.0pt'>p_rmpp_hdr->seg_num == 1</span></font>
<o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>I believe
that if you change max_len to be h_send->p_send_mad->size - offset -
hdr_len</span></font> <br>
<font size=2><span style='font-size:10.0pt'>it will solve the problem (at least
in this example):</span></font> <br>
<font size=2><span style='font-size:10.0pt'>=> max_len = 90. And the copy
operation will not access places behind this page.</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>The local
variables are:</span></font> <o:p></o:p></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>     
h_mad_reg = 0x813e733c</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
h_send = 0xfef74570</span></font> <br>
<font size=2><span style='font-size:10.0pt'>       
hdr_len = 0x38</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
offset = 0x38</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     p_rmpp_hdr
= 0xfecf3ee8</span></font> <br>
<font size=2><span style='font-size:10.0pt'>       
max_len = 0xc8</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     p_rmpp_dst
= 0x813beabc "???"</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
p_send_wr = 0xfef745a8</span></font> <br>
<font size=2><span style='font-size:10.0pt'>   p_al_element =
0x813be9c0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     p_rmpp_src
= 0xfecf3ee8 "???"</span></font> <o:p></o:p></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>1: kd>
dt -r2 h_send</span></font> <br>
<font size=2><span style='font-size:10.0pt'>Local var @ 0xf50f0b2c Type
_al_mad_send*</span></font> <br>
<font size=2><span style='font-size:10.0pt'>0xfef74570 </span></font><br>
<font size=2><span style='font-size:10.0pt'>   +0x000
pool_item        : _cl_pool_item</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x000 list_item        : _cl_list_item</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x000 p_next           :
0xfef3af10 </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x004 p_prev           :
0xfef3af10 </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x008 p_list           :
0xfef3af10 </span></font><br>
<font size=2><span style='font-size:10.0pt'>     
+0x00c
pad             
: 0x46200000 </span></font><br>
<font size=2><span style='font-size:10.0pt'>     
+0x010 p_pool           :
0x45484644 </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x000 num_components   : ??</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x004 component_sizes  : ???? </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x008 p_components     : ???? </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x00c num_objects      : ??</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x010 max_objects      : ??</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x014 grow_size        : ??</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x018 pfn_init         : ???? </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x01c pfn_dtor         : ???? </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x020 context          : ???? </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x024 free_list        : _cl_qlist</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x038 alloc_list       : _cl_qlist</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x04c state           
: ??</span></font> <br>
<font size=2><span style='font-size:10.0pt'> (No matching name)</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>   +0x014
p_send_mad       : 0x813be9e8 </span></font><br>
<font size=2><span style='font-size:10.0pt'>     
+0x000 p_next           :
(null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>     
+0x008 context1         : 0x001505e8 </span></font><br>
<font size=2><span style='font-size:10.0pt'>     
+0x010 context2         : (null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>     
+0x018 p_mad_buf        : 0xfecf3ee8 </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x000 base_ver         : 0x1 ''</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x001 mgmt_class       : 0x3 ''</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x002 class_ver        : 0x2 ''</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x003 method           :
0x92 ''</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x004 status           : 0</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x006 class_spec       : 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x008 trans_id         :
0x9b000000`01000000</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x010 attr_id          : 0x1100</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x012
resv             :
0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x014 attr_mod         : 0</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x020 size            
: 0x118</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x024 immediate_data   : 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x028 remote_qp        : 0x1000000</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x030
h_av             :
0x820f0854 </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x000
obj             
: _al_obj</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x0b8 h_ci_av          :
0x813bf248 </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x0c0 av_attr          :
_ib_av_attr</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x0f8 list_item        : _cl_list_item</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x038 send_opt         : 4</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x03c remote_qkey      : 0x180</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x040 resp_expected    : 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x044 timeout_ms       : 0x64</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x048 retry_cnt        : 3</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x04c rmpp_version     : 0 ''</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x050 status           : d (
IB_WCS_UNKNOWN )</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x054 grh_valid        : 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x058 p_grh           
: 0x813bea94 </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x000 ver_class_flow   : 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x004 resv1           
: 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x006 resv2           
: 0 ''</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x007 hop_limit        : 0 ''</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x008 src_gid          : _ib_gid</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x018 dest_gid         : _ib_gid</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x060 recv_opt         : 0</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x064 remote_lid       : 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x066 remote_sl        : 0 ''</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x068 pkey_index       : 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x06a path_bits        : 0 ''</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x070 send_context1    : (null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>     
+0x078 send_context2    : (null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>   +0x018
h_av             :
(null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>   +0x020
mad_wr           : _al_mad_wr</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>      +0x000
list_item        : _cl_list_item</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x000 p_next           :
(null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x004 p_prev           :
(null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x008 p_list           :
(null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>     
+0x00c client_id        : 1</span></font> <br>
<font size=2><span style='font-size:10.0pt'>     
+0x010 client_tid       : 0xd3510000`00000000</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>     
+0x018 send_wr          :
_ib_send_wr</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x000 p_next           :
(null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x008 wr_id           
: 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x010 wr_type          : 1 (
WR_SEND )</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x014 send_opt         : 4</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x018 num_ds           : 0</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>        
+0x020 ds_array         : (null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>        
+0x028 immediate_data   : 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x030
dgrm             :
_send_dgrm</span></font> <br>
<font size=2><span style='font-size:10.0pt'>        
+0x050 remote_ops       : _send_remote_ops</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>   +0x0a8
p_resp_mad       : (null) </span></font><br>
<font size=2><span style='font-size:10.0pt'>   +0x0b0
retry_time       : 0xffffffff`ffffffff</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>   +0x0b8
delay            : 0</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>   +0x0bc
retry_cnt        : 3</span></font> <br>
<font size=2><span style='font-size:10.0pt'>   +0x0c0
canceled         : 0</span></font> <br>
<font size=2><span style='font-size:10.0pt'>   +0x0c4
uses_rmpp        : 1</span></font> <br>
<font size=2><span style='font-size:10.0pt'>   +0x0c8
ack_seg          : 0</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>   +0x0cc
cur_seg          : 2</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>   +0x0d0
seg_limit        : 1</span></font> <br>
<font size=2><span style='font-size:10.0pt'>   +0x0d4
total_seg        : 2</span></font> <br>
<font size=2><span style='font-size:10.0pt'>Memory read error 45484690</span></font>
<o:p></o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
<br style='mso-special-character:line-break'>
<![if !supportLineBreakNewLine]><br style='mso-special-character:line-break'>
<![endif]><o:p></o:p></span></font></p>

<p><font size=2 face="Times New Roman"><span style='font-size:10.0pt'>>-----Original
Message-----</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>From: Fab Tillier [<a
href="mailto:ftillier@silverstorm.com">mailto:ftillier@silverstorm.com</a>]</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>Sent: Tuesday, October 04, 2005
2:42 AM</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>To: openib-windows@openib.org</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>Subject: RE: [Openib-windows]
[PATCH v2] Handle RMPP send payload < MAD</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>buffer length</span></font> <br>
<font size=2><span style='font-size:10.0pt'>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> From: Tillier, Fabian</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>> Sent: Monday, October 03,
2005 4:12 PM</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> Folks,</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> I found a bug in sending
MADs where the last segment of an RMPP send</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>would try</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> to send a full payload's
worth of data in the MAD, which could result in</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> copying data beyond the
end of the source buffer and the corresponding</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>BSOD.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> Here's a patch that
corrects this.  It does not clear the remaining bytes</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>of</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> the MAD, as I wasn't sure
it was needed.  Please take a look and confirm</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>that</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>> what I'm doing is sane,
and I'll check it in.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>Here's an updated version that
adds a line to clear the unused portion of</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>the</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>MAD payload.  This is
probably being overly cautious, but I didn't want to</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>let a</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>previous MAD's potentially
sensitive information be partially</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>retransmitted.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>- Fab</span></font> <br>
<font size=2><span style='font-size:10.0pt'>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>Signed-off-by: Fab Tillier
(ftillier@silverstorm.com)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>Index: core/al/al_mad.c</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>===================================================================</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>---
core/al/al_mad.c    (revision 100)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+++
core/al/al_mad.c    (working copy)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>@@ -1681,6 +1681,7 @@</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>   
al_mad_element_t    *p_al_element;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>   
ib_rmpp_mad_t       *p_rmpp_hdr;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>   
uint8_t            
*p_rmpp_src, *p_rmpp_dst;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+  
uintn_t            
hdr_len, offset, max_len;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>    CL_ENTER(
AL_DBG_MAD_SVC, g_al_dbg_lvl );</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>    p_send_wr =
&h_send->mad_wr.send_wr;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>@@ -1702,28 +1703,32 @@</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>       
p_rmpp_dst = (uint8_t*)(uintn_t)p_al_element->mad_ds.vaddr;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>> #endif</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>       
p_rmpp_src = (uint8_t* __ptr64)h_send->p_send_mad->p_mad_buf;</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>-      
p_rmpp_hdr = (ib_rmpp_mad_t* __ptr64)h_send->p_send_mad->p_mad_buf;</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>+      
p_rmpp_hdr = (ib_rmpp_mad_t*)p_rmpp_src;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>       
if( h_send->p_send_mad->p_mad_buf->mgmt_class == IB_MCLASS_SUBN_ADM</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>)</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-      
{</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
/* Copy the header into the registered send buffer. */</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
cl_memcpy( p_rmpp_dst, p_rmpp_src, IB_SA_MAD_HDR_SIZE );</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
/* Copy this segment's payload into the registered send buffer.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>*/</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
p_rmpp_dst = p_rmpp_dst + IB_SA_MAD_HDR_SIZE;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
p_rmpp_src = p_rmpp_src + IB_SA_MAD_HDR_SIZE +</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-              
( (cl_ntoh32( p_rmpp_hdr->seg_num ) - 1) * IB_SA_DATA_SIZE</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>);</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
cl_memcpy( p_rmpp_dst, p_rmpp_src, IB_SA_DATA_SIZE );</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-      
}</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+          
hdr_len = IB_SA_MAD_HDR_SIZE;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>       
else</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+          
hdr_len = MAD_RMPP_HDR_SIZE;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+      
max_len = MAD_BLOCK_SIZE - hdr_len;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+      
offset = hdr_len + (max_len * (cl_ntoh32( p_rmpp_hdr->seg_num ) -</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>1));</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+      
/* Copy the header into the registered send buffer. */</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+      
cl_memcpy( p_rmpp_dst, p_rmpp_src, hdr_len );</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+      
/* Copy this segment's payload into the registered send buffer. */</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>+      
CL_ASSERT( h_send->p_send_mad->size != offset );</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+      
if( (h_send->p_send_mad->size - offset) < max_len )</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>       
{</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
/* Copy the header into the registered send buffer. */</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
cl_memcpy( p_rmpp_dst, p_rmpp_src, MAD_RMPP_HDR_SIZE );</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
/* Copy this segment's payload into the registered send buffer.</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>*/</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
p_rmpp_dst = p_rmpp_dst + MAD_RMPP_HDR_SIZE;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-          
p_rmpp_src = p_rmpp_src + MAD_RMPP_HDR_SIZE +</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>-              
( (cl_ntoh32( p_rmpp_hdr->seg_num ) - 1) *</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>MAD_RMPP_DATA_SIZE );</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>-          
cl_memcpy( p_rmpp_dst, p_rmpp_src, MAD_RMPP_DATA_SIZE );</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+          
max_len = h_send->p_send_mad->size - offset;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+          
/* Clear unused payload. */</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+          
cl_memclr( p_rmpp_dst + hdr_len + max_len,</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+              
MAD_BLOCK_SIZE - hdr_len - max_len );</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>       
}</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+      
cl_memcpy(</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>+          
p_rmpp_dst + hdr_len, p_rmpp_src + hdr_len + offset, max_len );</span></font> <br>
<font size=2><span style='font-size:10.0pt'>>    }</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>   
p_send_wr->num_ds = 1;</span></font> <br>
<font size=2><span style='font-size:10.0pt'>></span></font> <br>
<font size=2><span style='font-size:10.0pt'>>_______________________________________________</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>openib-windows mailing list</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>>openib-windows@openib.org</span></font>
<br>
<font size=2><span style='font-size:10.0pt'>><a
href="http://openib.org/mailman/listinfo/openib-windows" target="_blank">http://openib.org/mailman/listinfo/openib-windows</a></span></font>
<o:p></o:p></p>

</div>

</div>

</body>

</html>