From f03af8844acbd63f257c51577834d2c126a41f47 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 20 Mar 2020 18:09:00 -0700 Subject: Read fault address on arm64 using proposed kernel API. On aarch64, the top 8 bits of the address (i.e. the tag bits) of the fault address in si_addr are always clear. This isn't ideal for MTE which will require these bits in order to correctly diagnose tag mismatches. A proposed kernel patch [1] exposes the full fault address including the tag bits as part of the ucontext. Change debuggerd to read this fault address if available. [1] https://patchwork.kernel.org/patch/11435077/ Bug: 135772972 Change-Id: Ia05be574113860f4e9ecc36a310c4b740e0c4afb --- debuggerd/libdebuggerd/tombstone.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'debuggerd/libdebuggerd/tombstone.cpp') diff --git a/debuggerd/libdebuggerd/tombstone.cpp b/debuggerd/libdebuggerd/tombstone.cpp index b3f059c1c..70b8817be 100644 --- a/debuggerd/libdebuggerd/tombstone.cpp +++ b/debuggerd/libdebuggerd/tombstone.cpp @@ -154,16 +154,16 @@ static void dump_probable_cause(log_t* log, const siginfo_t* si, unwindstack::Ma } static void dump_signal_info(log_t* log, const ThreadInfo& thread_info, - unwindstack::Memory* process_memory) { + const ProcessInfo& process_info, unwindstack::Memory* process_memory) { char addr_desc[64]; // ", fault addr 0x1234" - if (signal_has_si_addr(thread_info.siginfo)) { - void* addr = thread_info.siginfo->si_addr; + if (process_info.has_fault_address) { + size_t addr = process_info.fault_address; if (thread_info.siginfo->si_signo == SIGILL) { uint32_t instruction = {}; - process_memory->Read(reinterpret_cast(addr), &instruction, sizeof(instruction)); - snprintf(addr_desc, sizeof(addr_desc), "%p (*pc=%#08x)", addr, instruction); + process_memory->Read(addr, &instruction, sizeof(instruction)); + snprintf(addr_desc, sizeof(addr_desc), "0x%zx (*pc=%#08x)", addr, instruction); } else { - snprintf(addr_desc, sizeof(addr_desc), "%p", addr); + snprintf(addr_desc, sizeof(addr_desc), "0x%zx", addr); } } else { snprintf(addr_desc, sizeof(addr_desc), "--------"); @@ -384,7 +384,7 @@ static bool dump_thread(log_t* log, unwindstack::Unwinder* unwinder, const Threa dump_thread_info(log, thread_info); if (thread_info.siginfo) { - dump_signal_info(log, thread_info, unwinder->GetProcessMemory().get()); + dump_signal_info(log, thread_info, process_info, unwinder->GetProcessMemory().get()); } std::unique_ptr gwp_asan_crash_data; -- cgit v1.2.3