<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" 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@01C4D641.8A7A5DB0">
<!--[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:PunctuationKerning/>
  <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
  <w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
  <w:Compatibility>
   <w:SpaceForUL/>
   <w:BalanceSingleByteDoubleByteWidth/>
   <w:DoNotLeaveBackslashAlone/>
   <w:ULTrailSpace/>
   <w:DoNotExpandShiftReturn/>
   <w:AdjustLineHeightInTable/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:PMingLiU;
        panose-1:2 2 3 0 0 0 0 0 0 0;
        mso-font-alt:PMingLiU;
        mso-font-charset:136;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:3 137232384 22 0 1048577 0;}
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 3 0 0 0 0 0 0 0;
        mso-font-charset:136;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:3 137232384 22 0 1048577 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0cm;
        margin-bottom:.0001pt;
        mso-pagination:none;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:PMingLiU;
        mso-font-kerning:1.0pt;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;
        text-underline:single;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        mso-style-noshow:yes;
        mso-ansi-font-size:9.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-fareast-font-family:PMingLiU;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:windowtext;}
span.SpellE
        {mso-style-name:"";
        mso-spl-e:yes;}
span.GramE
        {mso-style-name:"";
        mso-gram-e:yes;}
 /* Page Definitions */
 @page
        {mso-page-border-surround-header:no;
        mso-page-border-surround-footer:no;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        mso-header-margin:42.55pt;
        mso-footer-margin:49.6pt;
        mso-paper-source:0;
        layout-grid:18.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */ 
 table.MsoNormalTable
        {mso-style-name:\8868\683C\5167\6587;
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
        mso-para-margin:0cm;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=ZH-TW link=blue vlink=purple style='tab-interval:24.0pt;text-justify-trim:
punctuation'>

<div class=Section1 style='layout-grid:18.0pt'>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial'>I know it’s probably
been a while since you look into the <span class=SpellE>elfboot</span> code. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial'>In the <span class=SpellE>elfboot.c</span><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial'>When it tries to build the
ELF segment list, it checks if the segment address is valid by walking through the
table of valid memory ranges. What is the reason to do this? <span
style='mso-spacerun:yes'> </span>Below is the code, the “<span
class=GramE>if ”</span> statement seems only guarantee that the new
addresses INTERSECT with the valid memory range, not fully contained. <span
style='mso-spacerun:yes'> </span><o:p></o:p></span></font></p>

<div style='border:none;border-bottom:double windowtext 2.25pt;padding:0cm 0cm 1.0pt 0cm'>

<p class=MsoNormal style='border:none;mso-border-bottom-alt:double windowtext 2.25pt;
padding:0cm;mso-padding-alt:0cm 0cm 1.0pt 0cm'><font size=1 face=Arial><span
lang=EN-US style='font-size:9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial'><span
style='mso-spacerun:yes'> </span><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;mso-bidi-font-size:10.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

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

<p class=MsoNormal><span class=GramE><font size=3 face="Times New Roman"><span
lang=EN-US style='font-size:12.0pt'>for(</span></font></span><span
class=SpellE><span lang=EN-US>i</span></span><span lang=EN-US> = 0; <span
class=SpellE>i</span> < <span class=SpellE>mem_entries</span>; <span
class=SpellE>i</span>++) {<o:p></o:p></span></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><span style='mso-tab-count:2'>                </span><span
class=GramE>uint64_t</span> <span class=SpellE>mstart</span>, mend;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><span style='mso-tab-count:2'>                </span><span
class=GramE>uint32_t</span> <span class=SpellE>mtype</span>;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><span style='mso-tab-count:2'>                </span><span
class=SpellE><span class=GramE>mtype</span></span> = <span class=SpellE>mem</span>->map[<span
class=SpellE>i</span>].type;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><span style='mso-tab-count:2'>                </span><span
class=SpellE><span class=GramE>mstart</span></span> = <span class=SpellE>mem</span>->map[<span
class=SpellE>i</span>].start;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><span style='mso-tab-count:2'>                </span><span
class=GramE>mend</span> = <span class=SpellE>mstart</span> + <span
class=SpellE>mem</span>->map[<span class=SpellE>i</span>].size;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><span style='mso-tab-count:2'>                </span><span
class=GramE>if</span> ((<span class=SpellE>mtype</span> == LB_MEM_RAM)
&& (start < mend) && (end > <span class=SpellE>mstart</span>))
{<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><span style='mso-tab-count:3'>                        </span><span
class=GramE>break</span>;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><span style='mso-tab-count:2'>                </span>}<o:p></o:p></span></font></p>

<div style='border:none;border-bottom:double windowtext 2.25pt;padding:0cm 0cm 1.0pt 0cm'>

<p class=MsoNormal style='border:none;mso-border-bottom-alt:double windowtext 2.25pt;
padding:0cm;mso-padding-alt:0cm 0cm 1.0pt 0cm'><font size=3
face="Times New Roman"><span lang=EN-US style='font-size:12.0pt'><span
style='mso-tab-count:1'>        </span>}<o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-US
style='font-size:12.0pt'><span style='mso-tab-count:1'>        </span><o:p></o:p></span></font></p>

</div>

</body>

</html>