summaryrefslogtreecommitdiff
path: root/debuggerd/handler/debuggerd_handler.cpp
diff options
context:
space:
mode:
authorDaniel Norman <danielnorman@google.com>2020-11-30 11:41:57 -0800
committerDaniel Norman <danielnorman@google.com>2020-11-30 11:41:57 -0800
commit4c9b114b037f54b903392ffd08768b43ae8cfa1e (patch)
tree94c4e861b823841effae4163e23f5dc733310f49 /debuggerd/handler/debuggerd_handler.cpp
parentf7d0ff192e03d75dc6afb65ad5a73c9e72216dda (diff)
parent4a25503197ee6d05784589c221a36bffe4f1b86c (diff)
Merge SP1A.201130.001
Change-Id: Ifcb754098c052feda32283cc056a9d760048832f
Diffstat (limited to 'debuggerd/handler/debuggerd_handler.cpp')
-rw-r--r--debuggerd/handler/debuggerd_handler.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/debuggerd/handler/debuggerd_handler.cpp b/debuggerd/handler/debuggerd_handler.cpp
index 1a7102d2a..07ca94457 100644
--- a/debuggerd/handler/debuggerd_handler.cpp
+++ b/debuggerd/handler/debuggerd_handler.cpp
@@ -167,7 +167,7 @@ static bool get_main_thread_name(char* buf, size_t len) {
* mutex is being held, so we don't want to use any libc functions that
* could allocate memory or hold a lock.
*/
-static void log_signal_summary(const siginfo_t* info, const ucontext_t* ucontext) {
+static void log_signal_summary(const siginfo_t* info) {
char thread_name[MAX_TASK_NAME_LEN + 1]; // one more for termination
if (prctl(PR_GET_NAME, reinterpret_cast<unsigned long>(thread_name), 0, 0, 0) != 0) {
strcpy(thread_name, "<name unknown>");
@@ -186,8 +186,7 @@ static void log_signal_summary(const siginfo_t* info, const ucontext_t* ucontext
// Many signals don't have an address or sender.
char addr_desc[32] = ""; // ", fault addr 0x1234"
if (signal_has_si_addr(info)) {
- async_safe_format_buffer(addr_desc, sizeof(addr_desc), ", fault addr %p",
- reinterpret_cast<void*>(get_fault_address(info, ucontext)));
+ async_safe_format_buffer(addr_desc, sizeof(addr_desc), ", fault addr %p", info->si_addr);
}
pid_t self_pid = __getpid();
char sender_desc[32] = {}; // " from pid 1234, uid 666"
@@ -544,7 +543,7 @@ static void debuggerd_signal_handler(int signal_number, siginfo_t* info, void* c
return;
}
- log_signal_summary(info, ucontext);
+ log_signal_summary(info);
debugger_thread_info thread_info = {
.crashing_tid = __gettid(),
@@ -642,5 +641,11 @@ void debuggerd_init(debuggerd_callbacks_t* callbacks) {
// Use the alternate signal stack if available so we can catch stack overflows.
action.sa_flags |= SA_ONSTACK;
+
+#define SA_EXPOSE_TAGBITS 0x00000800
+ // Request that the kernel set tag bits in the fault address. This is necessary for diagnosing MTE
+ // faults.
+ action.sa_flags |= SA_EXPOSE_TAGBITS;
+
debuggerd_register_handlers(&action);
}