<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Hi ,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I have verified this commit, it works well. When can we got a formal &nbsp;release includes this commit?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">thanks.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Matt Johnston [mailto:matt@ucc.asn.au]
<br>
<b>Sent:</b> 2016</span><span style="font-size:10.0pt;font-family:SimSun">��</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">4</span><span style="font-size:10.0pt;font-family:SimSun">��</span><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">29</span><span style="font-size:10.0pt;font-family:SimSun">��</span><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">
<span lang="EN-US">23:18<br>
<b>To:</b> ZHANG Hui P<br>
<b>Cc:</b> dropbear@ucc.asn.au<br>
<b>Subject:</b> Re: a bug detected in dropbear v071<o:p></o:p></span></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Hi,<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">I think this problem should be solved by the commit<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><a href="https://secure.ucc.asn.au/hg/dropbear/rev/432b0a030fd6">https://secure.ucc.asn.au/hg/dropbear/rev/432b0a030fd6</a><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Thank you for the detailed report.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Cheers,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Matt<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span lang="EN-US">On Wed 20/4/2016, at 2:44 pm, ZHANG Hui P &lt;<a href="mailto:Hui.P.Zhang@alcatel-sbell.com.cn">Hui.P.Zhang@alcatel-sbell.com.cn</a>&gt; wrote:<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">Hi:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I am a software engineer of Alcatel-Lucent. In our product we use dropbear v071 under the OS:
 Linux version 3.4.24. At most time it works perfectly, but recently we got a problem: sometimes a child-process of dropbear occupied nearly 100% CPU (we use ARM1176, single-core). After I investigated it ,I found it is cause by a misuse of KEX_REKEY_TIMEOUT.<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="text-indent:21.0pt"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">KEX_REKEY_TIMEOUT is defined as 8hours. that means when a session lasts more than 8 hours, the server and client will re-exchange
 their KEY for security reason. The timestamp of last-time KEY-EXCHANGED is recorded in variable &quot;ses.kexstate.lastkextime&quot;.<span class="apple-converted-space">&nbsp;</span><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="text-indent:21.0pt"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">&nbsp;The child dropbear process decides the &quot;timeout&quot; parameter of &quot;select&quot; function by calling &quot;select_timeout&quot;. we can see it checks
 the timeout-events like KEX_REKEY_TIMEOUT, AUTH_TIMEOUT, keepalive_secs. If there is a timeout occurs, the &quot;update_timeout&quot; function returns a negative value, then &quot;select_timeout&quot; modifies it to ZREO by this:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">/* clamp negative timeouts to zero - event has already triggered */<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return MAX(timeout, 0);<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp; if &quot;select_timeout&quot; returns ZERO, the next &quot;select&quot; call (in &quot;session_loop&quot;) will return immediately. Then it will check timeout events by this:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">/* check for auth timeout, rekeying required etc */<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; checktimeouts();<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp; in the function &quot; checktimeouts &quot;, when it find the timeout is reached or to many data has been sent, it will send a SSH_MSG_KEXINIT message to peer. Normally
 this message will trigger a new KEY-EXCHANGE. However, when there is a network problem that the peer can't receive the message , this bug occurs: the timestamp ses.kexstate.lastkextime is only updated by calling&nbsp; &quot;switch_keys&quot;--&gt;&quot; kexinitialise &quot;, unfortunately
 this calling sequence is driven by ssh-messages, either SSH_MSG_KEXDH_INIT or SSH_MSG_NEWKEYS. When there is no ssh-message received , the child dropbear process enters dead-loop &quot;select&quot; with ZERO-timeout parameter caused by KEX_REKEY_TIMEOUT.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">&gt; &nbsp;&nbsp;&nbsp;&nbsp; So there is a very simple way to reproduce this bug: first define the KEX_REKEY_TIMEOUT as small as possible( I set it to 8 seconds), then start a ssh-session
 , the child dropbear process is forked. then plug out the network wire, after 8 seconds the child dropbear thread will occupy 100% CPU. Could you kindly check it? thanks.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">&nbsp;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="text-indent:21.0pt"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">Best regards<o:p></o:p></span></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
</div>
</div>
</body>
</html>