From dd04c658c34c769107e13c106e0cd6df5d889da2 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 15 Apr 2019 13:03:48 -0700 Subject: [PATCH] crasher: add execute-only memory ("xom"). Test: `crasher thread-xom` Change-Id: Ia121848df966040968370e1e9cb840034d780e4f --- debuggerd/crasher/crasher.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debuggerd/crasher/crasher.cpp b/debuggerd/crasher/crasher.cpp index f0bdfbfde..304166472 100644 --- a/debuggerd/crasher/crasher.cpp +++ b/debuggerd/crasher/crasher.cpp @@ -193,6 +193,7 @@ static int usage() { fprintf(stderr, " kuser_memory_barrier call kuser_memory_barrier\n"); fprintf(stderr, " kuser_cmpxchg64 call kuser_cmpxchg64\n"); #endif + fprintf(stderr, " xom read execute-only memory\n"); fprintf(stderr, "\n"); fprintf(stderr, " LOG_ALWAYS_FATAL call liblog LOG_ALWAYS_FATAL\n"); fprintf(stderr, " LOG_ALWAYS_FATAL_IF call liblog LOG_ALWAYS_FATAL_IF\n"); @@ -314,6 +315,11 @@ noinline int do_action(const char* arg) { } else if (!strcasecmp(arg, "seccomp")) { set_system_seccomp_filter(); syscall(99999); +#if defined(__LP64__) + } else if (!strcasecmp(arg, "xom")) { + // Try to read part of our code, which will fail if XOM is active. + printf("*%lx = %lx\n", reinterpret_cast(usage), *reinterpret_cast(usage)); +#endif #if defined(__arm__) } else if (!strcasecmp(arg, "kuser_helper_version")) { return __kuser_helper_version;