<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-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;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
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="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">You mean before making the call to ReadProcessMemory?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The address that is passed to ReadProcessMemory is already cast to a void* which is the correct input for the function. I am also not sure whether it is possible for ReadProcessMemory to always set the output size to a wrong value when
 it fails (so we should always set the size to 0 regardless).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">-Stella<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>From:</b> Zachary Turner <zturner@google.com> <br>
<b>Sent:</b> Tuesday, July 10, 2018 4:01 PM<br>
<b>To:</b> Stella Stamenova <stilis@microsoft.com><br>
<b>Cc:</b> reviews+D49159+public+f5176ed1b1117dd2@reviews.llvm.org; aaron.lee.smith <aaron.lee.smith@gmail.com>; llvm-commits@lists.llvm.org<br>
<b>Subject:</b> Re: [PATCH] D49159: [windows] Fix out-of-memory failure in some of the tests<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Should we try to set protections on the page? What happens in vs if you do *((int*)unmapped address)<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Jul 10, 2018 at 3:44 PM Stella Stamenova <<a href="mailto:stilis@microsoft.com">stilis@microsoft.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">The memory address that we are reading from is invalid in the test that is failing – it has not been initialized, so it points to an invalid location. ReadProcessMemory can fail
 for a number of reasons and in this case I believe it’s because it doesn’t have access to read from that particular memory location.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thanks,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">-Stella<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b>From:</b> Zachary Turner <<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>>
<br>
<b>Sent:</b> Tuesday, July 10, 2018 3:38 PM<br>
<b>To:</b> <a href="mailto:reviews%2BD49159%2Bpublic%2Bf5176ed1b1117dd2@reviews.llvm.org" target="_blank">
reviews+D49159+public+f5176ed1b1117dd2@reviews.llvm.org</a><br>
<b>Cc:</b> Stella Stamenova <<a href="mailto:stilis@microsoft.com" target="_blank">stilis@microsoft.com</a>>; aaron.lee.smith <<a href="mailto:aaron.lee.smith@gmail.com" target="_blank">aaron.lee.smith@gmail.com</a>>;
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<b>Subject:</b> Re: [PATCH] D49159: [windows] Fix out-of-memory failure in some of the tests<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Any idea Why does the call fail?<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">On Tue, Jul 10, 2018 at 3:26 PM Stella Stamenova via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt">stella.stamenova created this revision.<br>
stella.stamenova added reviewers: asmith, zturner.<br>
Herald added a subscriber: llvm-commits.<br>
<br>
When ReadProcessMemory fails, bytes_read is sometimes set to a large garbage value. In that case, we need to set it back to zero before returning or the garbage value will be used to allocate memory later causing LLDB to crash with an out of memory error.<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.llvm.org%2FD49159&data=02%7C01%7Cstilis%40microsoft.com%7C80ff83845cc34705457908d5e6b90333%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636668604654845146&sdata=qcoocUDGhIqcuQvvOEKyi1JB9Op4fvCDCSOBoiAePlo%3D&reserved=0" target="_blank">https://reviews.llvm.org/D49159</a><br>
<br>
Files:<br>
  source/Plugins/Process/Windows/Common/ProcessWindows.cpp<o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>