[Lldb-commits] [PATCH] D152861: Clear non-addressable bits from fp/sp/lr/pc values in RegisterContextUnwind
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 14 13:08:41 PDT 2023
jasonmolenda added a comment.
In D152861#4420223 <https://reviews.llvm.org/D152861#4420223>, @DavidSpickett wrote:
> I'm curious how you would end up with a signed PC value, but given this is unwind it could be a value from a previous frame that was signed when stored to the stack.
The darwin kernel signs sp/pc (and maybe fp too) when they're at rest inside the kernel, I think. When we fetch the values for these with thread_get_state, they need to be run through and auth-and-clear before the values are sent to lldb (in debugserver aka lldb-server). gcore isn't stripping the auth bits when it fetches the register contexts from the kernel, and is putting those values as-is in corefiles.
You're right that this shouldn't happen in a real process. We already strip auth bits from $lr and spilled $lr's on the stack, where the code actually does sign it. This is purely addressing an artifact of how the darwin kernel represents these internally. gcore should really be clearing the auth bits from these register before putting them in a core file, but we need to work on core files that have already been created like this, so I'm starting with an lldb patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152861/new/
https://reviews.llvm.org/D152861
More information about the lldb-commits
mailing list