[Lldb-commits] [PATCH] D95601: [lldb][AArch64] Add MTE memory tag reading to lldb-server

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 28 01:44:31 PST 2021


DavidSpickett created this revision.
Herald added subscribers: danielkiss, kristof.beyls, krytarowski, mgorny.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This enables memory tag reading for lldb-server when
on AArch64 Linux.

This is done with a new packet "qMemTags". Which is following
the GDB memory tagging format. (currently in review)

The ability to parse this packet is indicated with the
"memory-tagging+" feature in a "qSupported" response.

The feature only indicates the ability to parse the
packets. So it is enabled for any AArch64 Linux target just
because it's the only one that will have a realistic chance
of the host having memory tagging.

lldb (client) will do further checks for specific processes
and memory ranges later.

To generalise the handling of memory tags a new interface
MemoryTagHandler has been added. This can be specialised per
tagging architecture/tagging scheme and handles things like
removing tags, changing them, diffing pointers, etc.

In lldb-server this will be accessible from the native register
context on Linux. Along with the ptrace operations for the
particular tagging scheme.

While the register context is about registers primarily,
it already holds some non register data like mmap details.
So I've chosen to add this handler there instead of inventing
another per architecture class.

This patch adds a tag handler for MTE on Arch64 Linux, so any other
platforms will simply error to show they do not support tagging.
(note that the handler isn't tied to the OS, AArch64 Linux is just
the only one supported at the moment)

The response to the qMemTags packet contains the "raw" tag data
we get back from ptrace. Clients will then use the
same memory tag handler to unpack that data in whatever form
is expected. (this part will be added in a follow up patch)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95601

Files:
  lldb/include/lldb/Host/common/NativeProcessProtocol.h
  lldb/include/lldb/Host/linux/Ptrace.h
  lldb/include/lldb/Target/MemoryTagHandler.h
  lldb/include/lldb/Utility/StringExtractorGDBRemote.h
  lldb/packages/Python/lldbsuite/test/decorators.py
  lldb/source/Host/common/NativeProcessProtocol.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
  lldb/source/Plugins/Process/Utility/CMakeLists.txt
  lldb/source/Plugins/Process/Utility/MemoryTagHandlerAArch64MTE.cpp
  lldb/source/Plugins/Process/Utility/MemoryTagHandlerAArch64MTE.h
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
  lldb/source/Utility/StringExtractorGDBRemote.cpp
  lldb/test/API/tools/lldb-server/memory-tagging/Makefile
  lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py
  lldb/test/API/tools/lldb-server/memory-tagging/main.c
  lldb/unittests/Process/Utility/CMakeLists.txt
  lldb/unittests/Process/Utility/MemoryTagHandlerAArch64MTETest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95601.319791.patch
Type: text/x-patch
Size: 31713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210128/eccab034/attachment-0001.bin>


More information about the lldb-commits mailing list