Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04a9837f authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Automerger Merge Worker
Browse files

Merge "Switch to new kernel ptrace interface for reading tags." am: 58429281

Change-Id: I77e4ad4e1decda803d12ad67f138fce983f56e4c
parents 8bf8c54b 58429281
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#if defined(ANDROID_EXPERIMENTAL_MTE)

#include <sys/ptrace.h>
#include <sys/uio.h>

#include <bionic/mte.h>
#include <bionic/mte_kernel.h>
@@ -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<void*>(addr), &iov) != 0 ||
      iov.iov_len != 1) {
    return -1;
  }
  return tag;
#else
  (void)addr;
  return -1;