<html 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=Windows-1252">
<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:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-AU">
<div class="WordSection1">
<p class="MsoNormal">Hi,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m trying to use lldb 6.0 on Linux to debug a process that has an SGX enclave inside it. One of the data structures there (the “TCS”) only permits access to certain fields. The problem is that when I try to access those fields in LLDB,
it tries to read an entire page of memory from the guest, even if I only wanted to read one word. It then fails the operation when access to later parts of the page fails.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">e.g., this LLDB command:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">(lldb) x/1g 0x200005000</p>
<p class="MsoNormal">error: memory read failed for 0x200005000</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Triggered this series of failures in the lldb-server process:</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">read(7, "$x200005000,200#ed", 8192) = 18</p>
<p class="MsoNormal">gettid() = 18169</p>
<p class="MsoNormal">process_vm_readv(18174, [{iov_base=0x556a00151cf0, iov_len=512}], 1, [{iov_base=0x200005000, iov_len=512}], 1, 0) = -1 EFAULT (Bad address)</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005000, [NULL]) = 0</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005008, [NULL]) = 0</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005010, [0xd000]) = 0</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005018, [0x300000001]) = 0</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005020, [0x1d950]) = 0</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005028, [0x3fffc00be750]) = 0</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005030, [0xa000]) = 0</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005038, [0xb000]) = 0</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005040, [0xffffffffffffffff]) = 0</p>
<p class="MsoNormal">ptrace(PTRACE_PEEKDATA, 18174, 0x200005048, 0x7ffc96125858) = -1 EIO (Input/output error)</p>
<p class="MsoNormal">write(7, "$E08#ad", 7) = 7</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">How can I convince lldb to access just the words I asked it for?</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,</p>
<p class="MsoNormal">Andrew</p>
</div>
</body>
</html>