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();
 }


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();
 }
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to