[lldb-dev] Accessing only specific words in guest memory

Andrew Baumann via lldb-dev lldb-dev at lists.llvm.org
Thu Jun 21 11:20:16 PDT 2018


Hi,

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.

e.g., this LLDB command:

(lldb) x/1g 0x200005000
error: memory read failed for 0x200005000

Triggered this series of failures in the lldb-server process:

read(7, "$x200005000,200#ed", 8192)     = 18
gettid()                                = 18169
process_vm_readv(18174, [{iov_base=0x556a00151cf0, iov_len=512}], 1, [{iov_base=0x200005000, iov_len=512}], 1, 0) = -1 EFAULT (Bad address)
ptrace(PTRACE_PEEKDATA, 18174, 0x200005000, [NULL]) = 0
ptrace(PTRACE_PEEKDATA, 18174, 0x200005008, [NULL]) = 0
ptrace(PTRACE_PEEKDATA, 18174, 0x200005010, [0xd000]) = 0
ptrace(PTRACE_PEEKDATA, 18174, 0x200005018, [0x300000001]) = 0
ptrace(PTRACE_PEEKDATA, 18174, 0x200005020, [0x1d950]) = 0
ptrace(PTRACE_PEEKDATA, 18174, 0x200005028, [0x3fffc00be750]) = 0
ptrace(PTRACE_PEEKDATA, 18174, 0x200005030, [0xa000]) = 0
ptrace(PTRACE_PEEKDATA, 18174, 0x200005038, [0xb000]) = 0
ptrace(PTRACE_PEEKDATA, 18174, 0x200005040, [0xffffffffffffffff]) = 0
ptrace(PTRACE_PEEKDATA, 18174, 0x200005048, 0x7ffc96125858) = -1 EIO (Input/output error)
write(7, "$E08#ad", 7)                  = 7

How can I convince lldb to access just the words I asked it for?

Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180621/33ce8440/attachment-0001.html>


More information about the lldb-dev mailing list