From a293170a2cc65718cdbb37c7976e76fc9e7a8533 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Thu, 17 Sep 2020 14:19:54 -0700 Subject: [PATCH] Fix x86_64 check for signal handler. The check for a signal handler was checking for the instruction after the syscall. On cuttlefish 64 bit, the instruction was not a nop, so the check failed, and the signal handler was not working. Only check the instructions up to the syscall instead. Bug: 168806886 Test: Ran on x86_64. Change-Id: I605ed22248748f525939e55d734caa5b08c80bb2 --- libunwindstack/RegsX86_64.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libunwindstack/RegsX86_64.cpp b/libunwindstack/RegsX86_64.cpp index c9e245d2f..26d9f6578 100644 --- a/libunwindstack/RegsX86_64.cpp +++ b/libunwindstack/RegsX86_64.cpp @@ -141,15 +141,14 @@ bool RegsX86_64::StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* proc return false; } - uint16_t data2; - if (!elf_memory->ReadFully(elf_offset + 8, &data2, sizeof(data2)) || data2 != 0x0f05) { + uint8_t data2; + if (!elf_memory->ReadFully(elf_offset + 8, &data2, sizeof(data2)) || data2 != 0x05) { return false; } // __restore_rt: // 0x48 0xc7 0xc0 0x0f 0x00 0x00 0x00 mov $0xf,%rax // 0x0f 0x05 syscall - // 0x0f nopl 0x0($rax) // Read the mcontext data from the stack. // sp points to the ucontext data structure, read only the mcontext part.