[Lldb-commits] [PATCH] D140067: Fix an ASAN bug I introduced in debugserver, accessing off the end of an array intentionally
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 4 13:47:57 PST 2023
jasonmolenda updated this revision to Diff 486385.
jasonmolenda added a comment.
Update the patch to use a case statement for fp/sp/lr/pc instead of conditionals; both Adrian and Jonas preferred it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140067/new/
https://reviews.llvm.org/D140067
Files:
lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
Index: lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
===================================================================
--- lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
+++ lldb/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.cpp
@@ -2022,10 +2022,41 @@
switch (set) {
case e_regSetGPR:
if (reg <= gpr_pc) {
- if (reg == gpr_pc || reg == gpr_lr || reg == gpr_sp || reg == gpr_fp)
- value->value.uint64 = clear_pac_bits(m_state.context.gpr.__x[reg]);
- else
+ switch (reg) {
+#if __has_feature(ptrauth_calls) && defined(__LP64__)
+ case gpr_pc:
+ value->value.uint64 = clear_pac_bits(
+ reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_pc));
+ break;
+ case gpr_lr:
+ value->value.uint64 = clear_pac_bits(
+ reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_lr));
+ break;
+ case gpr_sp:
+ value->value.uint64 = clear_pac_bits(
+ reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_sp));
+ break;
+ case gpr_fp:
+ value->value.uint64 = clear_pac_bits(
+ reinterpret_cast<uint64_t>(m_state.context.gpr.__opaque_fp));
+ break;
+#else
+ case gpr_pc:
+ value->value.uint64 = clear_pac_bits(m_state.context.gpr.__pc);
+ break;
+ case gpr_lr:
+ value->value.uint64 = clear_pac_bits(m_state.context.gpr.__lr);
+ break;
+ case gpr_sp:
+ value->value.uint64 = clear_pac_bits(m_state.context.gpr.__sp);
+ break;
+ case gpr_fp:
+ value->value.uint64 = clear_pac_bits(m_state.context.gpr.__fp);
+ break;
+#endif
+ default:
value->value.uint64 = m_state.context.gpr.__x[reg];
+ }
return true;
} else if (reg == gpr_cpsr) {
value->value.uint32 = m_state.context.gpr.__cpsr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140067.486385.patch
Type: text/x-patch
Size: 1970 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230104/c407c6ee/attachment.bin>
More information about the lldb-commits
mailing list