From b17d7be2e55fc8b866bacbc88d8059b7088dc14c Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 11 Sep 2024 16:23:18 +0000 Subject: [PATCH] debuggerd: recognize jumps to non-executable memory. We have fairly fancy detection of stack pointer issues, but nothing for the program counter... Bug: https://issuetracker.google.com/365602121 Change-Id: I7e7061a1b473089a0f31438df5ebc65b283475bc --- debuggerd/libdebuggerd/tombstone_proto.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debuggerd/libdebuggerd/tombstone_proto.cpp b/debuggerd/libdebuggerd/tombstone_proto.cpp index b6fc4e2dc..ed4fd5369 100644 --- a/debuggerd/libdebuggerd/tombstone_proto.cpp +++ b/debuggerd/libdebuggerd/tombstone_proto.cpp @@ -356,6 +356,9 @@ static void dump_probable_cause(Tombstone* tombstone, unwindstack::AndroidUnwind auto map_info = maps->Find(fault_addr); if (map_info != nullptr && map_info->flags() == PROT_EXEC) { cause = "execute-only (no-read) memory access error; likely due to data in .text."; + } else if (fault_addr == target_thread.registers->pc() && + map_info != nullptr && (map_info->flags() & PROT_EXEC) == 0) { + cause = "trying to execute non-executable memory."; } else { cause = get_stack_overflow_cause(fault_addr, target_thread.registers->sp(), maps); }