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/crash_dump.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'debuggerd/crash_dump.cpp') diff --git a/debuggerd/crash_dump.cpp b/debuggerd/crash_dump.cpp index 087ebaea8..0cd2350a8 100644 --- a/debuggerd/crash_dump.cpp +++ b/debuggerd/crash_dump.cpp @@ -295,6 +295,13 @@ static void ReadCrashInfo(unique_fd& fd, siginfo_t* siginfo, case 3: process_info->abort_msg_address = crash_info->data.s.abort_msg_address; *siginfo = crash_info->data.s.siginfo; + if (signal_has_si_addr(siginfo)) { + // Make a copy of the ucontext field because otherwise it is not aligned enough (due to + // being in a packed struct) and clang complains about that. + ucontext_t ucontext = crash_info->data.s.ucontext; + process_info->has_fault_address = true; + process_info->fault_address = get_fault_address(siginfo, &ucontext); + } regs->reset(unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentArch(), &crash_info->data.s.ucontext)); break; -- cgit v1.2.3