diff options
author | Peter Collingbourne <pcc@google.com> | 2020-11-13 10:54:13 -0800 |
---|---|---|
committer | Peter Collingbourne <pcc@google.com> | 2020-11-13 16:08:27 -0800 |
commit | ebc78cc8523b1047d9d7eca1cf183f39a6b06480 (patch) | |
tree | 52d8542d6504ce5f78c8fcce07000a9f37463f0a /debuggerd/libdebuggerd/utility.cpp | |
parent | 13e33f7f80443ce63bfa410442d15151227f427c (diff) |
Switch to the new kernel API for obtaining fault address tag bits.
The discussion on LKML is converging on v16 of the fault address tag
bits patch [1]. In this version of the patch the presence of the tag
bits in si_addr is controlled by a sa_flags bit, and a protocol is
introduced to allow userspace to detect kernel support for sa_flags
bits. Update the tombstone signal handler to use this API to read
the tag bits, update the interceptors in libsigchain to implement
the flag support detection protocol and hide the tag bits in si_addr
from chained signal handlers that did not request them to match the
kernel behavior.
[1] https://lore.kernel.org/linux-arm-kernel/cover.1605235762.git.pcc@google.com/
Change-Id: I57f24c07c01ceb3e5b81cfc15edf559ef7dfc740
Diffstat (limited to 'debuggerd/libdebuggerd/utility.cpp')
-rw-r--r-- | debuggerd/libdebuggerd/utility.cpp | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/debuggerd/libdebuggerd/utility.cpp b/debuggerd/libdebuggerd/utility.cpp index 4e6df09c9..d7067ca6e 100644 --- a/debuggerd/libdebuggerd/utility.cpp +++ b/debuggerd/libdebuggerd/utility.cpp @@ -451,40 +451,3 @@ void log_backtrace(log_t* log, unwindstack::Unwinder* unwinder, const char* pref _LOG(log, logtype::BACKTRACE, "%s%s\n", prefix, unwinder->FormatFrame(i).c_str()); } } - -#if defined(__aarch64__) -#define FAR_MAGIC 0x46415201 - -struct far_context { - struct _aarch64_ctx head; - __u64 far; -}; -#endif - -uintptr_t get_fault_address(const siginfo_t* siginfo, const ucontext_t* ucontext) { - (void)ucontext; -#if defined(__aarch64__) - // This relies on a kernel patch: - // https://patchwork.kernel.org/patch/11435077/ - // that hasn't been accepted into the kernel yet. TODO(pcc): Update this to - // use the official interface once it lands. - auto* begin = reinterpret_cast<const char*>(ucontext->uc_mcontext.__reserved); - auto* end = begin + sizeof(ucontext->uc_mcontext.__reserved); - auto* ptr = begin; - while (1) { - auto* ctx = reinterpret_cast<const _aarch64_ctx*>(ptr); - if (ctx->magic == 0) { - break; - } - if (ctx->magic == FAR_MAGIC) { - auto* far_ctx = reinterpret_cast<const far_context*>(ctx); - return far_ctx->far; - } - ptr += ctx->size; - if (ctx->size % sizeof(void*) != 0 || ptr < begin || ptr >= end) { - break; - } - } -#endif - return reinterpret_cast<uintptr_t>(siginfo->si_addr); -} |