[Lldb-commits] [PATCH] D61310: [lldb] [Process/NetBSD] Fix handling EOF in PT_IO when reading memory

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 30 06:56:09 PDT 2019


mgorny created this revision.
mgorny added reviewers: labath, krytarowski, joerg.

Fix NativeProcessNetBSD::ReadMemory() to account for the possibility
of the ptrace() PT_IO call returning piod_len == 0, to indicate EOF.
This could happen if LLDB attempts to read past vm.maxaddress,
e.g. as a result of RBP containing large (invalid) value.  Previously,
the 0 return caused the function to retry reading via PT_IO
indefinitely, effectively deadlooping lldb-server.


https://reviews.llvm.org/D61310

Files:
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===================================================================
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -700,7 +700,7 @@
 
     bytes_read = io.piod_len;
     io.piod_len = size - bytes_read;
-  } while (bytes_read < size);
+  } while (bytes_read < size && bytes_read != 0);
 
   return Status();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61310.197319.patch
Type: text/x-patch
Size: 459 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190430/97d56199/attachment.bin>


More information about the lldb-commits mailing list