mossberg updated this revision to Diff 233442.
mossberg added a comment.
Updated to get permissions information from the Process rather than the Section.
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
@@ -8,6 +8,7 @@
#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Core/Section.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Symbol/Block.h"
@@ -126,6 +127,17 @@
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.");
+ return;
+ } else if (!(permissions & ePermissionsExecutable)) {
+ LLDB_LOGF(log, "Return address did not point to executable memory.");
+ return;
+ }
+
Breakpoint *return_bp = m_thread.CalculateTarget()
->CreateBreakpoint(m_return_addr, true, false)
.get();
Index: lldb/source/Target/ThreadPlanStepOut.cpp
===================================================================
--- lldb/source/Target/ThreadPlanStepOut.cpp
+++ lldb/source/Target/ThreadPlanStepOut.cpp
@@ -8,6 +8,7 @@
#include "lldb/Target/ThreadPlanStepOut.h"
#include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Core/Section.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Symbol/Block.h"
@@ -126,6 +127,17 @@
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.");
+ return;
+ } else if (!(permissions & ePermissionsExecutable)) {
+ LLDB_LOGF(log, "Return address did not point to executable memory.");
+ return;
+ }
+
Breakpoint *return_bp = m_thread.CalculateTarget()
->CreateBreakpoint(m_return_addr, true, false)
.get();
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits