From 118c5ee6e6d7517ca2a4b0723bd0e8b0d56e7b05 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 24 Apr 2020 17:33:37 -0700 Subject: [PATCH] Switch to new kernel ptrace interface for reading tags. Bug: 135772972 Change-Id: I506429d7bff79f83828e1f0d5c0ea0468ee1580b --- libunwindstack/MemoryMte.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libunwindstack/MemoryMte.cpp b/libunwindstack/MemoryMte.cpp index d1d0ebc29..46a546e1c 100644 --- a/libunwindstack/MemoryMte.cpp +++ b/libunwindstack/MemoryMte.cpp @@ -17,6 +17,7 @@ #if defined(ANDROID_EXPERIMENTAL_MTE) #include +#include #include #include @@ -28,7 +29,13 @@ namespace unwindstack { long MemoryRemote::ReadTag(uint64_t addr) { #if defined(__aarch64__) - return ptrace(PTRACE_PEEKTAG, pid_, (void*)addr, nullptr); + char tag; + iovec iov = {&tag, 1}; + if (ptrace(PTRACE_PEEKMTETAGS, pid_, reinterpret_cast(addr), &iov) != 0 || + iov.iov_len != 1) { + return -1; + } + return tag; #else (void)addr; return -1;