[Lldb-commits] [PATCH] D71372: [lldb] Add additional validation on return address in 'thread step-out'

Mark Mossberg via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 11 16:37:09 PST 2019


mossberg updated this revision to Diff 233470.
mossberg added a comment.

Output return address in logging


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71372/new/

https://reviews.llvm.org/D71372

Files:
  lldb/source/Target/ThreadPlanStepOut.cpp


Index: lldb/source/Target/ThreadPlanStepOut.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepOut.cpp
+++ lldb/source/Target/ThreadPlanStepOut.cpp
@@ -126,6 +126,20 @@
     if (m_return_addr == LLDB_INVALID_ADDRESS)
       return;
 
+    // Perform some additional validation on the return address.
+    uint32_t permissions = 0;
+    if (!m_thread.GetProcess()->GetLoadAddressPermissions(m_return_addr,
+                                                          permissions)) {
+      LLDB_LOGF(log, "Permissions not found for return address (0x%llx).",
+                m_return_addr);
+      return;
+    } else if (!(permissions & ePermissionsExecutable)) {
+      LLDB_LOGF(log,
+                "Return address (0x%llx) did not point to executable memory.",
+                m_return_addr);
+      return;
+    }
+
     Breakpoint *return_bp = m_thread.CalculateTarget()
                                 ->CreateBreakpoint(m_return_addr, true, false)
                                 .get();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71372.233470.patch
Type: text/x-patch
Size: 1057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191212/b525ccf2/attachment.bin>


More information about the lldb-commits mailing list